diff --git a/src/editor/dialogs/cmenuLayersDialog.js b/src/editor/dialogs/cmenuLayersDialog.js index 7c6e3096..93e91da8 100644 --- a/src/editor/dialogs/cmenuLayersDialog.js +++ b/src/editor/dialogs/cmenuLayersDialog.js @@ -93,12 +93,23 @@ export class SeCMenuLayerDialog extends HTMLElement { this.$mergeDownLink = this._shadowRoot.querySelector('#se-merge-down'); this.$mergeAllLink = this._shadowRoot.querySelector('#se-merge-all'); } + /** + * @function init + * @param {any} name + * @returns {void} + */ + init (i18next) { + this.setAttribute('layers-dupe', i18next.t('layers.dupe')); + this.setAttribute('layers-del', i18next.t('layers.del')); + this.setAttribute('layers-merge_down', i18next.t('layers.merge_down')); + this.setAttribute('layers-merge_all', i18next.t('layers.merge_all')); + } /** * @function observedAttributes * @returns {any} observed */ static get observedAttributes () { - return [ 'value', 'leftclick' ]; + return [ 'value', 'leftclick', 'layers-dupe', 'layers-del', 'layers-merge_down', 'layers-merge_all' ]; } /** * @function attributeChangedCallback @@ -117,6 +128,18 @@ export class SeCMenuLayerDialog extends HTMLElement { this._workarea = document.getElementById(this.source); } break; + case 'layers-dupe': + this.$duplicateLink.textContent = newValue; + break; + case 'layers-del': + this.$deleteLink.textContent = newValue; + break; + case 'layers-merge_down': + this.$mergeDownLink.textContent = newValue; + break; + case 'layers-merge_all': + this.$mergeAllLink.textContent = newValue; + break; default: // super.attributeChangedCallback(name, oldValue, newValue); break; diff --git a/src/editor/panels/LayersPanel.js b/src/editor/panels/LayersPanel.js index b374ea9a..34eac5be 100644 --- a/src/editor/panels/LayersPanel.js +++ b/src/editor/panels/LayersPanel.js @@ -150,11 +150,13 @@ class LayersPanel { menuMore.value = "layer_moreopts"; menuMore.setAttribute("leftclick", true); document.body.append(menuMore); + menuMore.init(i18next); const menuLayerBox = document.createElement("se-cmenu-layers"); menuLayerBox.setAttribute("id", "se-cmenu-layers-list"); menuLayerBox.value = "layerlist"; menuLayerBox.setAttribute("leftclick", false); document.body.append(menuLayerBox); + menuLayerBox.init(i18next); document .getElementById("layer_new") .addEventListener("click", this.newLayer.bind(this));