diff --git a/src/editor/components/jgraduate/jQuery.jGraduate.js b/src/editor/components/jgraduate/jQuery.jGraduate.js index 6e14a3bd..22ef3182 100644 --- a/src/editor/components/jgraduate/jQuery.jGraduate.js +++ b/src/editor/components/jgraduate/jQuery.jGraduate.js @@ -1,7 +1,6 @@ /* eslint-disable no-loop-func */ /* eslint-disable prefer-destructuring */ /* eslint-disable no-unsanitized/property */ -/* gl#bals svgEditor */ /** * @file jGraduate 0.4 * @@ -189,7 +188,7 @@ function mkElem (name, attrs, newparent) { * @param {external:jQuery.fn.jGraduate.CancelCallback} [cancelCallback] Called with no arguments when Cancel is pressed * @returns {external:jQuery} */ -export function jGraduateMethod (elem, options, okCallback, cancelCallback) { +export function jGraduateMethod (elem, options, okCallback, cancelCallback, i18next) { const $this = elem, $settings = Object.assign({}, jGraduateDefaults, options || {}), id = $this.getAttribute('id'), @@ -237,9 +236,9 @@ export function jGraduateMethod (elem, options, okCallback, cancelCallback) { $this.classList.add('jGraduate_Picker'); // eslint-disable-next-line no-unsanitized/property $this.innerHTML = `
@@ -256,88 +255,88 @@ export function jGraduateMethod (elem, options, okCallback, cancelCallback) {
- +
- + - +
- +
- + - +
- +
- + - +
- +
-
+
- + - +
- +
- -
+ +
- -
+ +
- -
+ +
- +
- -
+ +
- - + +
`; const div = document.createElement('div'); div.innerHTML = html; @@ -637,7 +636,9 @@ export function jGraduateMethod (elem, options, okCallback, cancelCallback) { }, null, function () { $this.querySelector('#jGraduate_LightBox').style.display = 'none'; $this.querySelector('#' + id + '_jGraduate_stopPicker').style.display = 'none'; - }); + }, + i18next + ); }); const jqStopEls = curGradient.querySelectorAll('stop'); for (const jqStopEl of jqStopEls) { @@ -1197,7 +1198,8 @@ export function jGraduateMethod (elem, options, okCallback, cancelCallback) { okClicked(); }, null, - function () { cancelClicked(); } + function () { cancelClicked(); }, + i18next ); // JFH !!!! diff --git a/src/editor/components/jgraduate/jQuery.jPicker.js b/src/editor/components/jgraduate/jQuery.jPicker.js index 61b0190f..b4f6ce55 100755 --- a/src/editor/components/jgraduate/jQuery.jPicker.js +++ b/src/editor/components/jgraduate/jQuery.jPicker.js @@ -603,7 +603,7 @@ const { Color, List, ColorMethods } = jPicker; // local copies for YUI compresso * @param {module:jPicker.CancelCallback} [cancelCallback] * @returns {void} */ -export function jPickerMethod (elem, options, commitCallback, liveCallback, cancelCallback) { +export function jPickerMethod (elem, options, commitCallback, liveCallback, cancelCallback, i18next) { let sets = mergeDeep({}, jPickerDefaults); // local copies for YUI compressor sets = mergeDeep(sets, options); @@ -632,7 +632,7 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc content.innerHTML = `     -   +     `; that.insertAdjacentElement('afterend', content); @@ -1331,39 +1331,39 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc

${win.title || 'config.jpicker_title'}

   
      
- #svgEditor.i18next.t('config.jpicker_new_color')}
  
#svgEditor.i18next.t('config.jpicker_current_color')} -
+ ${i18next.t('config.jpicker_new_color')}
  
${i18next.t('config.jpicker_current_color')} +
- -  ° + +  ° - -  % + +  % -

-  %

+

+  %

- - + + - - + + - - + + - ${win.alphaSupport ? `` : ' '} - ${win.alphaSupport ? ` %` : ' '} + ${win.alphaSupport ? `` : ' '} + ${win.alphaSupport ? ` %` : ' '} - ${win.alphaSupport ? `` : ' '} + ${win.alphaSupport ? `` : ' '} `; if (win.expandable) { diff --git a/src/editor/components/seColorPicker.js b/src/editor/components/seColorPicker.js index 9fe6f888..55570939 100644 --- a/src/editor/components/seColorPicker.js +++ b/src/editor/components/seColorPicker.js @@ -1,5 +1,4 @@ /* eslint-disable max-len */ -/* gl#bals svgEditor */ import { jGraduate, jGraduateMethod } from './jgraduate/jQuery.jGraduate.js'; import PaintBox from './PaintBox.js'; @@ -643,7 +642,7 @@ div.jGraduate_Slider img {
- +
@@ -666,15 +665,25 @@ export class SeColorPicker extends HTMLElement { this.$label = this._shadowRoot.getElementById('label'); this.$block = this._shadowRoot.getElementById('block'); this.paintBox = null; + this.i18next = null; this.$picker = this._shadowRoot.getElementById('picker'); this.$color_picker = this._shadowRoot.getElementById('color_picker'); } + /** + * @function init + * @param {any} name + * @returns {void} + */ + init (i18next) { + this.i18next = i18next; + this.setAttribute('config-change_xxx_color', i18next.t('config.change_xxx_color')); + } /** * @function observedAttributes * @returns {any} observed */ static get observedAttributes () { - return [ 'label', 'src', 'type' ]; + return [ 'label', 'src', 'type', 'config-change_xxx_color' ]; } /** * @function attributeChangedCallback @@ -695,6 +704,9 @@ export class SeColorPicker extends HTMLElement { case 'type': this.$label.setAttribute('title', 'config.pick_paint_opavity'); break; + case 'config-change_xxx_color': + this.$label.setAttribute('title', newValue); + break; default: // eslint-disable-next-line no-console console.error(`unknown attribute: ${name}`); @@ -797,7 +809,8 @@ export class SeColorPicker extends HTMLElement { }, () => { this.$color_picker.style.display = 'none'; - } + }, + this.i18next ); }); } diff --git a/src/editor/components/sePalette.js b/src/editor/components/sePalette.js index 1272a7c2..66844a1a 100644 --- a/src/editor/components/sePalette.js +++ b/src/editor/components/sePalette.js @@ -1,5 +1,4 @@ /* eslint-disable max-len */ -/* gl#bals svgEditor */ const palette = [ // Todo: Make into configuration item? 'none', '#000000', '#3f3f3f', '#7f7f7f', '#bfbfbf', '#ffffff', @@ -78,8 +77,7 @@ template.innerHTML = ` } } -
+
@@ -127,6 +125,35 @@ export class SEPalette extends HTMLElement { }); } + /** + * @function init + * @param {any} name + * @returns {void} + */ + init (i18next) { + this.setAttribute('ui-palette_info', i18next.t('ui.palette_info')); + } + /** + * @function observedAttributes + * @returns {any} observed + */ + static get observedAttributes () { + return [ 'ui-palette_info' ]; + } + /** + * @function attributeChangedCallback + * @param {string} name + * @param {string} oldValue + * @param {string} newValue + * @returns {void} + */ + attributeChangedCallback (name, oldValue, newValue) { + let node; + if (name === 'ui-palette_info') { + node = this._shadowRoot.querySelector('#palette_holder'); + node.setAttribute('title', newValue); + } + } /** * @function connectedCallback * @returns {void} diff --git a/src/editor/extensions/ext-storage/ext-storage.js b/src/editor/extensions/ext-storage/ext-storage.js index 9495c890..d75e985e 100644 --- a/src/editor/extensions/ext-storage/ext-storage.js +++ b/src/editor/extensions/ext-storage/ext-storage.js @@ -83,6 +83,7 @@ export default { const storageBox = document.createElement('se-storage-dialog'); storageBox.setAttribute('id', 'se-storage-dialog'); document.body.append(storageBox); + storageBox.init(svgEditor.i18next); // manage the change in the storageDialog diff --git a/src/editor/extensions/ext-storage/storageDialog.js b/src/editor/extensions/ext-storage/storageDialog.js index 92f4a2af..93333678 100644 --- a/src/editor/extensions/ext-storage/storageDialog.js +++ b/src/editor/extensions/ext-storage/storageDialog.js @@ -1,15 +1,5 @@ /* eslint-disable max-len */ -/* globals svgEditor */ const template = document.createElement('template'); -const notification = svgEditor.i18next.t('notification.editorPreferencesMsg'); -const prefs_and_content = svgEditor.i18next.t('properties.prefs_and_content'); -const prefs_only = svgEditor.i18next.t('properties.prefs_only'); -const no_prefs_or_content = svgEditor.i18next.t('properties.no_prefs_or_content'); -const remember_this_choice = svgEditor.i18next.t('tools.remember_this_choice'); -const remember_this_choice_title = svgEditor.i18next.t('tools.remember_this_choice_title'); -const ok = svgEditor.i18next.t('common.ok'); -const cancel = svgEditor.i18next.t('common.cancel'); -// eslint-disable-next-line no-unsanitized/property template.innerHTML = `