From c60c5847a0133a8e4f0a28cfc87865ef263246db Mon Sep 17 00:00:00 2001 From: agriyadev5 Date: Mon, 30 Aug 2021 20:06:59 +0530 Subject: [PATCH] #631 translate changes --- src/editor/components/seColorPicker.js | 5 +- src/editor/components/seList.js | 20 +++++++- .../extensions/ext-polystar/ext-polystar.js | 16 +++--- src/editor/locale/lang.en.js | 16 ++++++ src/editor/panels/BottomPanel.js | 14 +++--- src/editor/panels/TopPanel.js | 50 +++++++++---------- 6 files changed, 78 insertions(+), 43 deletions(-) diff --git a/src/editor/components/seColorPicker.js b/src/editor/components/seColorPicker.js index 8aab6862..7f147c5a 100644 --- a/src/editor/components/seColorPicker.js +++ b/src/editor/components/seColorPicker.js @@ -1,6 +1,7 @@ /* eslint-disable max-len */ import { jGraduate, jGraduateMethod } from './jgraduate/jQuery.jGraduate.js'; import PaintBox from './PaintBox.js'; +import { t } from '../locale.js'; const template = document.createElement('template'); // eslint-disable-next-line no-unsanitized/property @@ -673,7 +674,7 @@ export class SeColorPicker extends HTMLElement { */ init (i18next) { this.i18next = i18next; - this.setAttribute('config-change_xxx_color', i18next.t('config.change_xxx_color')); + this.setAttribute('config-change_xxx_color', t('config.change_xxx_color')); } /** * @function observedAttributes @@ -696,7 +697,7 @@ export class SeColorPicker extends HTMLElement { this.$logo.setAttribute('src', newValue); break; case 'label': - this.setAttribute('title', newValue); + this.setAttribute('title', t(newValue)); break; case 'type': this.$label.setAttribute('title', 'config.pick_paint_opavity'); diff --git a/src/editor/components/seList.js b/src/editor/components/seList.js index 7da9426b..e36a19ab 100644 --- a/src/editor/components/seList.js +++ b/src/editor/components/seList.js @@ -46,7 +46,7 @@ export class SeList extends HTMLElement { * @returns {any} observed */ static get observedAttributes () { - return [ 'label', 'width', 'height' ]; + return [ 'label', 'width', 'height', 'title' ]; } /** @@ -59,6 +59,9 @@ export class SeList extends HTMLElement { attributeChangedCallback (name, oldValue, newValue) { if (oldValue === newValue) return; switch (name) { + case 'title': + this.$dropdown.setAttribute('title', `${t(newValue)}`); + break; case 'label': this.$label.textContent = t(newValue); break; @@ -74,6 +77,21 @@ export class SeList extends HTMLElement { break; } } + /** + * @function get + * @returns {any} + */ + get title () { + return this.getAttribute('title'); + } + + /** + * @function set + * @returns {void} + */ + set title (value) { + this.setAttribute('title', value); + } /** * @function get * @returns {any} diff --git a/src/editor/extensions/ext-polystar/ext-polystar.js b/src/editor/extensions/ext-polystar/ext-polystar.js index 97a3eed4..f6d1ffd9 100644 --- a/src/editor/extensions/ext-polystar/ext-polystar.js +++ b/src/editor/extensions/ext-polystar/ext-polystar.js @@ -110,14 +110,14 @@ export default { } }); - const label0 = svgEditor.i18next.t(`${name}:contextTools.0.label`); - const title0 = svgEditor.i18next.t(`${name}:contextTools.0.title`); - const label1 = svgEditor.i18next.t(`${name}:contextTools.1.label`); - const title1 = svgEditor.i18next.t(`${name}:contextTools.1.title`); - const label2 = svgEditor.i18next.t(`${name}:contextTools.2.label`); - const title2 = svgEditor.i18next.t(`${name}:contextTools.2.title`); - const label3 = svgEditor.i18next.t(`${name}:contextTools.3.label`); - const title3 = svgEditor.i18next.t(`${name}:contextTools.3.title`); + const label0 = `${name}:contextTools.0.label`; + const title0 = `${name}:contextTools.0.title`; + const label1 = `${name}:contextTools.1.label`; + const title1 = `${name}:contextTools.1.title`; + const label2 = `${name}:contextTools.2.label`; + const title2 = `${name}:contextTools.2.title`; + const label3 = `${name}:contextTools.3.label`; + const title3 = `${name}:contextTools.3.title`; // Add the context panel and its handler(s) const panelTemplate = document.createElement("template"); // eslint-disable-next-line no-unsanitized/property diff --git a/src/editor/locale/lang.en.js b/src/editor/locale/lang.en.js index d996a40b..c9d05b41 100644 --- a/src/editor/locale/lang.en.js +++ b/src/editor/locale/lang.en.js @@ -78,6 +78,22 @@ export default { text_anchor_start: 'Align the text in start', text_anchor_middle: 'Align the text in middle', text_anchor_end: 'Align the text in end', + r_label: 'r', + x_label: 'x', + y_label: 'y', + x1_label: 'x1', + y1_label: 'y1', + x2_label: 'x2', + y2_label: 'y2', + rx_label: 'rx', + ry_label: 'ry', + cx_label: 'cx', + cy_label: 'cy', + w_label: 'w', + h_label: 'h', + id_label: 'id', + class_label: 'class', + label: 'label', class: 'Element class', serif: 'Serif', sans_serif: 'Sans-serif', diff --git a/src/editor/panels/BottomPanel.js b/src/editor/panels/BottomPanel.js index 4fd14c87..2ead1d6d 100644 --- a/src/editor/panels/BottomPanel.js +++ b/src/editor/panels/BottomPanel.js @@ -182,18 +182,18 @@ class BottomPanel {
${i18next.t('tools.fit_to_layer_content')}
${i18next.t('tools.fit_to_all')}
- - + + - - + + ... - - - . - .. - + - + - diff --git a/src/editor/panels/TopPanel.js b/src/editor/panels/TopPanel.js index 73eddc51..4543fd56 100644 --- a/src/editor/panels/TopPanel.js +++ b/src/editor/panels/TopPanel.js @@ -867,10 +867,10 @@ class TopPanel {
- +
- +
- + - +
@@ -920,7 +920,7 @@ class TopPanel { - + ${i18next.t('tools.selected_objects')} ${i18next.t('tools.largest_object')} ${i18next.t('tools.smallest_object')} @@ -928,49 +928,49 @@ class TopPanel {
- + - + -
- + -
- +
- - + +
- +
- + - +
- + - +
- + - + - + - +
@@ -998,7 +998,7 @@ class TopPanel {
- +
- + - +