From 124bcf39704e17d366b7269e278f84b87950373e Mon Sep 17 00:00:00 2001 From: Derek P Sifford Date: Sun, 11 Dec 2016 21:37:40 -0500 Subject: [PATCH] chore: update i18n for new views --- scripts/fixtures.js | 4 + .../EditReferenceWindow.tsx | 8 +- src/lib/php/i18n.php | 5 + types/globals.d.ts | 158 +++++++++--------- 4 files changed, 95 insertions(+), 80 deletions(-) diff --git a/scripts/fixtures.js b/scripts/fixtures.js index 0ea489a5..987d8f01 100644 --- a/scripts/fixtures.js +++ b/scripts/fixtures.js @@ -262,6 +262,10 @@ exports.ABT_i18n = { }, }, tinymce: { + editReferenceWindow: { + title: 'Edit Reference', + confirm: 'Confirm', + }, importWindow: { title: 'Import References from File', upload: 'Choose File', diff --git a/src/lib/js/tinymce/components/edit-reference-window/EditReferenceWindow.tsx b/src/lib/js/tinymce/components/edit-reference-window/EditReferenceWindow.tsx index 89f95d12..fe815f83 100644 --- a/src/lib/js/tinymce/components/edit-reference-window/EditReferenceWindow.tsx +++ b/src/lib/js/tinymce/components/edit-reference-window/EditReferenceWindow.tsx @@ -11,7 +11,9 @@ const DevTool = DevTools(); @observer export class EditReferenceWindow extends React.Component<{}, {}> { - modal: Modal = new Modal('Edit Reference'); // FIXME: i18n here + + labels = top.ABT_i18n.tinymce.editReferenceWindow; + modal: Modal = new Modal(this.labels.title); // FIXME: i18n here params = top.tinyMCE.activeEditor.windowManager.windows[0].settings.params; @observable @@ -80,13 +82,13 @@ export class EditReferenceWindow extends React.Component<{}, {}> { people={this.people} /> -
+
diff --git a/src/lib/php/i18n.php b/src/lib/php/i18n.php index 08e105f9..37892d42 100644 --- a/src/lib/php/i18n.php +++ b/src/lib/php/i18n.php @@ -65,6 +65,11 @@ function abt_generate_translations() { ], ]; + $ABT_i18n->tinymce->editReferenceWindow = [ + 'title' => __('Edit Reference', 'academic-bloggers-toolkit'), + 'confirm' => __('Confirm', 'academic-bloggers-toolkit'), + ]; + $ABT_i18n->tinymce->importWindow = [ 'importBtn' => __('Import', 'academic-bloggers-toolkit'), 'title' => __('Import References from File', 'academic-bloggers-toolkit'), diff --git a/types/globals.d.ts b/types/globals.d.ts index 58f6e10c..3c2da45b 100644 --- a/types/globals.d.ts +++ b/types/globals.d.ts @@ -21,101 +21,105 @@ declare namespace BackendGlobals { // tslint:disable-next-line interface ABT_i18n { - readonly citationTypes: ABT.CitationTypes; - readonly errors: { - readonly badRequest: 'Request not valid'; - readonly broken: 'BROKEN!'; - readonly denied: 'Site denied request'; - readonly fileExtensionError: 'Invalid file extension. Extension must be .ris, .bib, or .bibtex'; - readonly filetypeError: 'The file could not be processed.'; - readonly identifiersNotFound: { - readonly all: 'The following identifiers could not be found'; - readonly some: 'The following identifiers could not be found'; + citationTypes: ABT.CitationTypes; + errors: { + badRequest: 'Request not valid'; + broken: 'BROKEN!'; + denied: 'Site denied request'; + fileExtensionError: 'Invalid file extension. Extension must be .ris, .bib, or .bibtex'; + filetypeError: 'The file could not be processed.'; + identifiersNotFound: { + all: 'The following identifiers could not be found'; + some: 'The following identifiers could not be found'; }; - readonly networkError: 'Network Error'; - readonly noResults: 'Your search returned 0 results'; - readonly prefix: 'Error'; - readonly risLeftovers: 'The following references were unable to be processed'; - readonly statusError: 'Request returned a non-200 status code'; - readonly warnings: { - readonly warning: 'Warning'; - readonly reason: 'Reason'; - readonly noBib: { - readonly message: 'Cannot create publication list for currently selected citation style'; - readonly reason: 'Style does not include bibliography'; + networkError: 'Network Error'; + noResults: 'Your search returned 0 results'; + prefix: 'Error'; + risLeftovers: 'The following references were unable to be processed'; + statusError: 'Request returned a non-200 status code'; + warnings: { + warning: 'Warning'; + reason: 'Reason'; + noBib: { + message: 'Cannot create publication list for currently selected citation style'; + reason: 'Style does not include bibliography'; }; }; - readonly unexpected: { - readonly message: 'An unexpected error occurred'; - readonly reportInstructions: 'Please report this error, including the steps taken to trigger it, here: \nhttps://github.com/dsifford/academic-bloggers-toolkit/issues'; // tslint:disable-line + unexpected: { + message: 'An unexpected error occurred'; + reportInstructions: 'Please report this error, including the steps taken to trigger it, here: \nhttps://github.com/dsifford/academic-bloggers-toolkit/issues'; // tslint:disable-line }; }; - readonly fieldmaps: ABT.FieldMappings; - readonly misc: { - readonly footnotes: 'Footnotes'; + fieldmaps: ABT.FieldMappings; + misc: { + footnotes: 'Footnotes'; }; - readonly referenceList: { - readonly menu: { + referenceList: { + menu: { tooltips: { - readonly destroy: 'Delete all references'; - readonly help: 'Usage instructions'; - readonly importRIS: 'Import references from file'; - readonly refresh: 'Refresh reference list'; - readonly staticPubList: 'Insert Static Publication List'; + destroy: 'Delete all references'; + help: 'Usage instructions'; + importRIS: 'Import references from file'; + refresh: 'Refresh reference list'; + staticPubList: 'Insert Static Publication List'; }; }; - readonly referenceList: { - readonly citedItems: 'Cited Items'; - readonly tooltips: { - readonly add: 'Add reference to reference list'; - readonly insert: 'Insert selected references'; - readonly pin: 'Pin reference list to visible window'; - readonly remove: 'Remove selected references from reference list'; + referenceList: { + citedItems: 'Cited Items'; + tooltips: { + add: 'Add reference to reference list'; + insert: 'Insert selected references'; + pin: 'Pin reference list to visible window'; + remove: 'Remove selected references from reference list'; }; - readonly uncitedItems: 'Uncited Items'; + uncitedItems: 'Uncited Items'; }; }; - readonly tinymce: { - readonly importWindow: { - readonly importBtn: 'Import'; - readonly title: 'Import References from File'; - readonly upload: 'Choose File'; + tinymce: { + editReferenceWindow: { + title: 'Edit Reference', + confirm: 'Confirm', + }; + importWindow: { + importBtn: 'Import'; + title: 'Import References from File'; + upload: 'Choose File'; }; - readonly pubmedWindow: { - readonly addReference: 'Select'; - readonly next: 'Next'; - readonly previous: 'Previous'; - readonly search: 'Search'; - readonly title: 'Search PubMed for Reference'; - readonly viewReference: 'View'; + pubmedWindow: { + addReference: 'Select'; + next: 'Next'; + previous: 'Previous'; + search: 'Search'; + title: 'Search PubMed for Reference'; + viewReference: 'View'; }; - readonly referenceWindow: { - readonly buttonRow: { - readonly addManually: 'Add Manually'; - readonly addReference: 'Add Reference'; - readonly addWithIdentifier: 'Add with Identifier'; - readonly insertInline: 'Insert citation inline'; - readonly pubmedWindowTitle: 'Search PubMed for Reference'; - readonly searchPubmed: 'Search PubMed'; + referenceWindow: { + buttonRow: { + addManually: 'Add Manually'; + addReference: 'Add Reference'; + addWithIdentifier: 'Add with Identifier'; + insertInline: 'Insert citation inline'; + pubmedWindowTitle: 'Search PubMed for Reference'; + searchPubmed: 'Search PubMed'; }; - readonly identifierInput: { - readonly label: 'DOI/PMID/PMCID'; + identifierInput: { + label: 'DOI/PMID/PMCID'; }; - readonly manualEntryContainer: { - readonly autocite: 'Autocite'; - readonly citationType: 'Citation Type'; - readonly ISBN: 'ISBN'; - readonly search: 'Search'; - readonly URL: 'URL'; + manualEntryContainer: { + autocite: 'Autocite'; + citationType: 'Citation Type'; + ISBN: 'ISBN'; + search: 'Search'; + URL: 'URL'; }; - readonly people: { - readonly add: 'Add Contributor'; - readonly contributors: 'Contributors'; - readonly given: 'Given Name, M.I.'; - readonly surname: 'Surname'; + people: { + add: 'Add Contributor'; + contributors: 'Contributors'; + given: 'Given Name, M.I.'; + surname: 'Surname'; }; - readonly referenceWindow: { - readonly title: 'Add Reference'; + referenceWindow: { + title: 'Add Reference'; }; }; };