From f735ae12788d5589c6ed44aaf64d21996861bc29 Mon Sep 17 00:00:00 2001 From: McMatts Date: Thu, 10 Mar 2022 12:10:39 -0500 Subject: [PATCH] i18n section types --- .../section/airtable/type-editor.js | 1 + .../components/section/base-editor-inline.js | 2 +- gui/app/components/section/base-editor.js | 4 ++- .../components/section/code/type-editor.js | 6 ++-- .../section/flowchart/type-editor.js | 7 ++-- .../section/airtable/type-editor.hbs | 9 +++--- .../components/section/base-editor-inline.hbs | 24 +++++++------- .../components/section/base-editor.hbs | 14 ++++---- .../components/section/code/type-editor.hbs | 2 +- .../section/flowchart/type-editor.hbs | 4 +-- gui/public/i18n/en-US.json | 32 +++++++++++++------ 11 files changed, 61 insertions(+), 44 deletions(-) diff --git a/gui/app/components/section/airtable/type-editor.js b/gui/app/components/section/airtable/type-editor.js index 00855a12..eaf47a4e 100644 --- a/gui/app/components/section/airtable/type-editor.js +++ b/gui/app/components/section/airtable/type-editor.js @@ -15,6 +15,7 @@ export default Component.extend({ data: "", didReceiveAttrs() { + this._super(); this.set("data", this.get("meta.rawBody")); }, diff --git a/gui/app/components/section/base-editor-inline.js b/gui/app/components/section/base-editor-inline.js index 218e2322..6fb390b7 100644 --- a/gui/app/components/section/base-editor-inline.js +++ b/gui/app/components/section/base-editor-inline.js @@ -34,7 +34,7 @@ export default Component.extend(Modals, Notifier, { pageTitle: '', didReceiveAttrs() { - this._super(...arguments); + this._super(); this.set('pageTitle', this.get('page.title')); }, diff --git a/gui/app/components/section/base-editor.js b/gui/app/components/section/base-editor.js index 77b5ccab..524ea425 100644 --- a/gui/app/components/section/base-editor.js +++ b/gui/app/components/section/base-editor.js @@ -21,7 +21,9 @@ export default Component.extend(ModalMixin, { hasNameError: empty('page.title'), hasDescError: empty('page.excerpt'), - didRender() { + didRender(...args) { + this._super(...args); + let self = this; Mousetrap.bind('esc', function () { self.send('onCancel'); diff --git a/gui/app/components/section/code/type-editor.js b/gui/app/components/section/code/type-editor.js index 3cbe2037..5c8b883a 100644 --- a/gui/app/components/section/code/type-editor.js +++ b/gui/app/components/section/code/type-editor.js @@ -67,7 +67,8 @@ export default Component.extend({ } }, - didInsertElement() { + didInsertElement(...args) { + this._super(...args); var editor = CodeMirror.fromTextArea(document.getElementById(this.get('editorId')), { theme: "material", lineNumbers: true, @@ -91,7 +92,8 @@ export default Component.extend({ this.set('codeEditor', editor); }, - willDestroyElement() { + willDestroyElement(...args) { + this._super(...args); let editor = this.get('codeEditor'); if (!_.isNull(editor)) { diff --git a/gui/app/components/section/flowchart/type-editor.js b/gui/app/components/section/flowchart/type-editor.js index afb899f0..6aaccf79 100644 --- a/gui/app/components/section/flowchart/type-editor.js +++ b/gui/app/components/section/flowchart/type-editor.js @@ -17,13 +17,14 @@ import Component from '@ember/component'; export default Component.extend({ appMeta: service(), sectionSvc: service('section'), + i18n: service(), isDirty: false, waiting: false, diagram: '', diagramXML: '', title: '', readyToSave: false, - previewButtonCaption: 'Preview', + previewButtonCaption: '', flowCallback: null, editorId: computed('page', function () { let page = this.get('page'); @@ -40,6 +41,8 @@ export default Component.extend({ didInsertElement() { this._super(...arguments); + this.previewButtonCaption = this.i18n.localize('preview'); + schedule('afterRender', () => { this.setupEditor(); }); @@ -125,7 +128,7 @@ export default Component.extend({ action: 'export', format: 'xmlpng', xml: this.get('diagramXML'), - spin: 'Updating' + spin: this.i18n.localize('updating') } ), '*'); }, diff --git a/gui/app/templates/components/section/airtable/type-editor.hbs b/gui/app/templates/components/section/airtable/type-editor.hbs index f20cf253..be08b01d 100644 --- a/gui/app/templates/components/section/airtable/type-editor.hbs +++ b/gui/app/templates/components/section/airtable/type-editor.hbs @@ -1,12 +1,11 @@ {{layout/logo-heading - title="Airtable" - desc="Part spreadsheet, part database, and entirely flexible (https://airtable.com)" + title=(localize 'section_airtable') + desc=(localize 'section_airtable_explain') icon=constants.Icon.Integrations}} {{#section/base-editor document=document folder=folder page=page isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}}
- - {{textarea value=data rows="3" id="airtable-embed-code" class="form-control mousetrap" placeholder="Enter code" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"}} - Paste the Airtable embed code snippet + + {{textarea value=data rows="3" id="airtable-embed-code" class="form-control mousetrap" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"}}
{{/section/base-editor}} diff --git a/gui/app/templates/components/section/base-editor-inline.hbs b/gui/app/templates/components/section/base-editor-inline.hbs index 3da46c01..0fa5768a 100644 --- a/gui/app/templates/components/section/base-editor-inline.hbs +++ b/gui/app/templates/components/section/base-editor-inline.hbs @@ -5,15 +5,15 @@
{{#if blockMode}}
- {{focus-input id="page-id-{{pageId}}" value=pageTitle placeholder="Enter name" + {{focus-input id="page-id-{{pageId}}" value=pageTitle placeholder=(localize 'name') class=(if hasNameError "form-control mousetrap form-control-lg is-invalid" "form-control form-control-lg mousetrap")}}
- {{textarea id="page-excerpt-{{pageId}}" value=page.excerpt rows="2" class=(if hasDescError "form-control mousetrap form-control-lg is-invalid" "form-control form-control-lg mousetrap") placeholder="Enter description"}} + {{textarea id="page-excerpt-{{pageId}}" value=page.excerpt rows="2" class=(if hasDescError "form-control mousetrap form-control-lg is-invalid" "form-control form-control-lg mousetrap") placeholder=(localize 'description')}}
{{else}}
- {{focus-input type="text" id=pageId value=pageTitle class=(if hasNameError "form-control mousetrap form-control-lg is-invalid" "form-control form-control-lg mousetrap") placeholder="Enter name"}} + {{focus-input type="text" id=pageId value=pageTitle class=(if hasNameError "form-control mousetrap form-control-lg is-invalid" "form-control form-control-lg mousetrap") placeholder=(localize 'name')}}
{{/if}}
@@ -25,15 +25,13 @@ {{/if}} {{#ui/ui-toolbar dark=false light=true raised=true large=true bordered=true}} {{#if contentLinkerButton}} - {{ui/ui-toolbar-icon icon=constants.Icon.Link color=constants.Color.Gray - tooltip="Insert Link" onClick=(action "onShowLinkModal")}} + {{ui/ui-toolbar-icon icon=constants.Icon.Link color=constants.Color.Gray tooltip=(localize 'link_insert') onClick=(action "onShowLinkModal")}} {{/if}} {{#if previewButton}} - {{ui/ui-toolbar-icon icon=previewIcon color=constants.Color.Gray - tooltip=previewText onClick=(action "onPreview")}} + {{ui/ui-toolbar-icon icon=previewIcon color=constants.Color.Gray tooltip=previewText onClick=(action "onPreview")}} {{/if}} - {{ui/ui-toolbar-icon icon=constants.Icon.Tick color=constants.Color.Green tooltip="Save changes" onClick=(action "onAction")}} - {{ui/ui-toolbar-icon icon=constants.Icon.Cross color=constants.Color.Red tooltip="Cancel editing" onClick=(action "onCancel")}} + {{ui/ui-toolbar-icon icon=constants.Icon.Tick color=constants.Color.Green tooltip=(localize 'save') onClick=(action "onAction")}} + {{ui/ui-toolbar-icon icon=constants.Icon.Cross color=constants.Color.Red tooltip=(localize 'cancel') onClick=(action "onCancel")}} {{/ui/ui-toolbar}} @@ -47,13 +45,13 @@