From 20c9168140eba025c3244c6001302376ede1ce32 Mon Sep 17 00:00:00 2001 From: McMatts Date: Thu, 10 Mar 2022 15:21:25 -0500 Subject: [PATCH] i18n section strings --- .../section/papertrail/type-editor.js | 1 + gui/app/components/section/pdf/type-editor.js | 8 +++-- .../section/plantuml/type-editor.js | 14 +++++--- .../section/papertrail/type-editor.hbs | 19 ++++++----- .../components/section/pdf/type-editor.hbs | 24 +++++++------- .../section/plantuml/type-editor.hbs | 20 ++++++------ gui/public/i18n/en-US.json | 32 +++++++++++++++++++ 7 files changed, 79 insertions(+), 39 deletions(-) diff --git a/gui/app/components/section/papertrail/type-editor.js b/gui/app/components/section/papertrail/type-editor.js index d37cbdcc..61c6dc3d 100644 --- a/gui/app/components/section/papertrail/type-editor.js +++ b/gui/app/components/section/papertrail/type-editor.js @@ -28,6 +28,7 @@ export default Component.extend(SectionMixin, NotifierMixin, { }, didReceiveAttrs() { + this._super(); let config = {}; try { diff --git a/gui/app/components/section/pdf/type-editor.js b/gui/app/components/section/pdf/type-editor.js index a89ae1cf..4293e099 100644 --- a/gui/app/components/section/pdf/type-editor.js +++ b/gui/app/components/section/pdf/type-editor.js @@ -28,6 +28,8 @@ export default Component.extend({ }, didReceiveAttrs() { + this._super(); + let pdfOption = {}; try { @@ -46,10 +48,10 @@ export default Component.extend({ this.set('pdfOption', pdfOption); this.setPDF(); }, - + didUpdateAttrs() { this._super(...arguments); - this.setPDF(); + this.setPDF(); }, setPDF() { @@ -60,7 +62,7 @@ export default Component.extend({ if (!_.isArray(files)) return; for (let i=0; i < files.length; i++) { - if (_.endsWith(files[i].get('extension'), 'pdf') && + if (_.endsWith(files[i].get('extension'), 'pdf') && files[i].get('pageId') === this.get('page.id')) { this.set('pdfName', files[i].get('filename')); this.set('pdfOption.fileId', files[i].get('id')); diff --git a/gui/app/components/section/plantuml/type-editor.js b/gui/app/components/section/plantuml/type-editor.js index 71964f40..295c3ed1 100644 --- a/gui/app/components/section/plantuml/type-editor.js +++ b/gui/app/components/section/plantuml/type-editor.js @@ -17,11 +17,12 @@ import Component from '@ember/component'; export default Component.extend({ appMeta: service(), sectionSvc: service('section'), + i18n: service(), isDirty: false, waiting: false, diagramText: '', diagramPreview: null, - previewButtonCaption: 'Preview', + previewButtonCaption: '', editorId: computed('page', function () { let page = this.get('page'); return `plantuml-editor-${page.id}`; @@ -34,9 +35,14 @@ export default Component.extend({ return _.isEmpty(this.get('diagramText')); }), + init(...args) { + this._super(...args); + this.previewButtonCaption = this.i18n.localize('preview'); + }, + generatePreview() { this.set('waiting', true); - this.set('previewButtonCaption', 'Generating preview...'); + this.set('previewButtonCaption', this.i18n.localize('preview_wait')); let self = this; let data = { data: this.get('diagramText') }; @@ -45,11 +51,11 @@ export default Component.extend({ this.get('sectionSvc').fetch(this.get('page'), 'preview', data).then(function (response) { self.set('diagramPreview', response.data); self.set('waiting', false); - self.set('previewButtonCaption', 'Preview'); + self.set('previewButtonCaption', this.i18n.localize('preview')); }, function (reason) { // eslint-disable-line no-unused-vars self.set('diagramPreview', null); self.set('waiting', false); - self.set('previewButtonCaption', 'Preview'); + self.set('previewButtonCaption', this.i18n.localize('preview')); }); }); }, diff --git a/gui/app/templates/components/section/papertrail/type-editor.hbs b/gui/app/templates/components/section/papertrail/type-editor.hbs index e5df209a..1ab76fc7 100644 --- a/gui/app/templates/components/section/papertrail/type-editor.hbs +++ b/gui/app/templates/components/section/papertrail/type-editor.hbs @@ -1,6 +1,6 @@ {{layout/logo-heading - title="Papertrail" - desc="Display your cloud-based logs (https://papertrailapp.com)" + title=(localize 'section_papertrail') + desc=(localize 'section_papertrail_explain') icon=constants.Icon.Integrations}} {{#section/base-editor document=document folder=folder page=page busy=waiting @@ -10,9 +10,8 @@
- + {{focus-input id="papertrail-apitoken" type="password" value=config.APIToken class="form-control"}} - API Token (from your profile)
{{ui/ui-button color=constants.Color.Green light=true label=(localize 'authenticate') onClick=(action "auth")}}
@@ -21,19 +20,19 @@ {{#if authenticated}}
- + {{input id="papertrail-query" type="text" class="form-control mousetrap" value=config.query}} - Determine which log entries you want to display e.g. bob OR ("some phrase" AND sally) + {{localize 'section_papertrail_search_explain'}}
- + {{input id="papertrail-max" type="number" class="form-control mousetrap" value=config.max}} - How many log entries do you want? + {{localize 'section_papetrail__max_explain'}}
- + {{ui/ui-select id="group-dropdown" prompt="" content=options.groups action=(action "onGroupsChange") optionValuePath="id" optionLabelPath="name" selection=config.group}} - Optional Papertrail group + {{localize 'section_papetrail_group_explain'}}
{{/if}} diff --git a/gui/app/templates/components/section/pdf/type-editor.hbs b/gui/app/templates/components/section/pdf/type-editor.hbs index 4067f5da..f85fb543 100644 --- a/gui/app/templates/components/section/pdf/type-editor.hbs +++ b/gui/app/templates/components/section/pdf/type-editor.hbs @@ -1,37 +1,37 @@ -{{#section/base-editor-inline document=document folder=folder page=page tip="Select PDF to render" isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}} +{{#section/base-editor-inline document=document folder=folder page=page tip=(localize 'section_pdf') isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}}
- + {{input type="text" class="form-control mousetrap" placeholder="click upload button below" value=pdfName readonly=true}} - First PDF uploaded will be used + {{localize 'section_pdf_upload_explain'}}
- + {{input type="number" class="form-control mousetrap" placeholder="e.g. 700" value=pdfOption.height}} - How tall is the PDF preview? + {{localize 'section_pdf_height_explain'}}
- + {{input type="number" class="form-control mousetrap" placeholder="e.g. 1" value=pdfOption.startPage}} - The first page to display + {{localize 'section_pdf_start_explain'}}
- + - Optionally, set sidebar content + {{localize 'section_pdf_sidebar_explain'}}
{{/section/base-editor-inline}} diff --git a/gui/app/templates/components/section/plantuml/type-editor.hbs b/gui/app/templates/components/section/plantuml/type-editor.hbs index db5463e7..60094de7 100644 --- a/gui/app/templates/components/section/plantuml/type-editor.hbs +++ b/gui/app/templates/components/section/plantuml/type-editor.hbs @@ -1,6 +1,6 @@ {{layout/logo-heading - title="PlantUML" - desc="Create UML diagrams from a plain text language (http://plantuml.com)" + title=(localize 'section_plantuml') + desc=(localize 'section_plantuml_explain') icon=constants.Icon.Integrations}} {{#section/base-editor document=document folder=folder page=page busy=waiting @@ -14,15 +14,15 @@ {{#if emptyDiagram}}
-

Insert sample diagrams:

+

{{localize 'insert'}}

- {{ui/ui-button color=constants.Color.Gray light=true label="Sequence" onClick=(action "onInsertSequence")}} - {{ui/ui-button color=constants.Color.Gray light=true label="Use Case" onClick=(action "onInsertUseCase")}} - {{ui/ui-button color=constants.Color.Gray light=true label="Class" onClick=(action "onInsertClass")}} - {{ui/ui-button color=constants.Color.Gray light=true label="Activity" onClick=(action "onInsertActivity")}} - {{ui/ui-button color=constants.Color.Gray light=true label="Activity (new syntax)" onClick=(action "onInsertActivityNew")}} - {{ui/ui-button color=constants.Color.Gray light=true label="Component" onClick=(action "onInsertComponent")}} - {{ui/ui-button color=constants.Color.Gray light=true label="State" onClick=(action "onInsertState")}} + {{ui/ui-button color=constants.Color.Gray light=true label=(localize 'section_plantuml_type_sequence') onClick=(action "onInsertSequence")}} + {{ui/ui-button color=constants.Color.Gray light=true label=(localize 'section_plantuml_type_usecase') onClick=(action "onInsertUseCase")}} + {{ui/ui-button color=constants.Color.Gray light=true label=(localize 'section_plantuml_type_class') onClick=(action "onInsertClass")}} + {{ui/ui-button color=constants.Color.Gray light=true label=(localize 'section_plantuml_type_activity') onClick=(action "onInsertActivity")}} + {{ui/ui-button color=constants.Color.Gray light=true label=(localize 'section_plantuml_type_activity2') onClick=(action "onInsertActivityNew")}} + {{ui/ui-button color=constants.Color.Gray light=true label=(localize 'section_plantuml_type_component') onClick=(action "onInsertComponent")}} + {{ui/ui-button color=constants.Color.Gray light=true label=(localize 'section_plantuml_type_state') onClick=(action "onInsertState")}}

{{/if}} diff --git a/gui/public/i18n/en-US.json b/gui/public/i18n/en-US.json index a242a8d8..e4d3f16c 100644 --- a/gui/public/i18n/en-US.json +++ b/gui/public/i18n/en-US.json @@ -19,6 +19,7 @@ "import": "Import", "export": "Export", "exported": "Exported", + "pdf": "PDF", "test": "Test", "configure": "Configure", "error": "Error", @@ -36,6 +37,7 @@ "next": "Next", "ok": "OK", "preview": "Preview", + "preview_wait": "Generating preview...", "publish": "Publish", "print": "Print", "reject": "Reject", @@ -313,6 +315,36 @@ "section_jira_explain": "Jira provides issue tracking and agile software", "section_jira_admin": "Your Documize Community administrator needs to provide Jira connection details before usage.", "section_jira_no_auth": "Jira connector not authenticated", + "section_papertrail": "Papertrail", + "section_papertrail_explain": "Display your cloud-based logs (https://papertrailapp.com)", + "section_papertrail_key": "Papertrail API Key", + "section_papertrail_search": "Search query", + "section_papertrail_search_explain": "Determine which log entries you want to display e.g. bob OR (\"some phrase\" AND sally)", + "section_papertrail_max": "Maximum results", + "section_papertrail_max_explain": "How many log entries do you want?", + "section_papertrail_group": "Group", + "section_papertrail_group_explain": "Optional Papertrail group", + "section_pdf": "PDF Viewer", + "section_pdf_upload_explain": "First PDF uploaded will be used", + "section_pdf_height": "Preview Height", + "section_pdf_height_explain": "How tall is the PDF preview?", + "section_pdf_start": "Start Page", + "section_pdf_start_explain": "The first page to display", + "section_pdf_sidebar": "Sidebar", + "section_pdf_sidebar_explain": "Optionally, set sidebar content", + "section_pdf_sidebar_none": "None", + "section_pdf_sidebar_bookmark": "Bookmarks", + "section_pdf_sidebar_thumbnail": "Thumbnails", + "section_plantuml": "PlantUML", + "section_plantuml_explain": "Create UML diagrams from a plain text language (http://plantuml.com)", + "section_plantuml_link": "PlantUML Diagram", + "section_plantuml_type_sequence": "Sequence", + "section_plantuml_type_usecase": "Use Case", + "section_plantuml_type_class": "Class", + "section_plantuml_type_activity": "Activity", + "section_plantuml_type_activity2": "Activity (new syntax)", + "section_plantuml_type_component": "Component", + "section_plantuml_type_state": "State", "login_cas": "Authenticating with CAS...", "login_cass_error": "CAS authentication failure",