#101 dialog i18n are change to new approach

master
Agriya Dev5 2021-05-21 18:15:09 +05:30
parent c60d1bf645
commit 88512f2088
2 changed files with 26 additions and 1 deletions

View File

@ -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;

View File

@ -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));