Merge pull request #501 from SVG-Edit/V7-dev

localized strings
This commit is contained in:
JFH
2021-05-10 00:13:16 +02:00
committed by GitHub
5 changed files with 11 additions and 11 deletions

View File

@@ -1165,7 +1165,7 @@ class Editor extends EditorStartup {
reject(new Error('URLLoadFail')); reject(new Error('URLLoadFail'));
return; return;
} }
seAlert(this.uiStrings.notification.URLLoadFail + ': \n' + err); seAlert(this.i18next.t('notification.URLLoadFail') + ': \n' + err);
resolve(); resolve();
}, },
complete() { complete() {

View File

@@ -216,7 +216,7 @@ class EditorStartup {
let promptMoveLayerOnce = false; let promptMoveLayerOnce = false;
$id('selLayerNames').addEventListener('change', function(evt) { $id('selLayerNames').addEventListener('change', function(evt) {
const destLayer = evt.currentTarget.options[evt.currentTarget.selectedIndex].value; const destLayer = evt.currentTarget.options[evt.currentTarget.selectedIndex].value;
const confirmStr = self.uiStrings.notification.QmoveElemsToLayer.replace('%s', destLayer); const confirmStr = self.i18next.t('notification.QmoveElemsToLayer').replace('%s', destLayer);
/** /**
* @param {boolean} ok * @param {boolean} ok
* @returns {void} * @returns {void}
@@ -594,7 +594,7 @@ class EditorStartup {
*/ */
const editorObj = this; const editorObj = this;
const importImage = function (e) { const importImage = function (e) {
document.getElementById('se-prompt-dialog').title = editorObj.uiStrings.notification.loadingImage; document.getElementById('se-prompt-dialog').title = editorObj.i18next.t('notification.loadingImage');
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
const file = (e.type === 'drop') ? e.dataTransfer.files[0] : this.files[0]; const file = (e.type === 'drop') ? e.dataTransfer.files[0] : this.files[0];

View File

@@ -27,7 +27,7 @@ class MainMenu {
*/ */
async clickClear() { async clickClear() {
const [x, y] = this.editor.configObj.curConfig.dimensions; const [x, y] = this.editor.configObj.curConfig.dimensions;
const ok = await seConfirm(this.editor.uiStrings.notification.QwantToClear); const ok = await seConfirm(this.editor.i18next.t('notification.QwantToClear'));
if (ok === "Cancel") { if (ok === "Cancel") {
return; return;
} }
@@ -72,15 +72,15 @@ class MainMenu {
this.editor.svgCanvas.setDocumentTitle(title); this.editor.svgCanvas.setDocumentTitle(title);
if (w !== "fit" && !isValidUnit("width", w)) { if (w !== "fit" && !isValidUnit("width", w)) {
seAlert(this.editor.uiStrings.notification.invalidAttrValGiven); seAlert(this.editor.i18next.t('notification.invalidAttrValGiven'));
return false; return false;
} }
if (h !== "fit" && !isValidUnit("height", h)) { if (h !== "fit" && !isValidUnit("height", h)) {
seAlert(this.editor.uiStrings.notification.invalidAttrValGiven); seAlert(this.editor.i18next.t('notification.invalidAttrValGiven'));
return false; return false;
} }
if (!this.editor.svgCanvas.setResolution(w, h)) { if (!this.editor.svgCanvas.setResolution(w, h)) {
seAlert(this.editor.uiStrings.notification.noContentToFitTo); seAlert(this.editor.i18next.t('notification.noContentToFitTo'));
return false; return false;
} }
// Set image save option // Set image save option

View File

@@ -226,7 +226,7 @@ class LayersPanel {
return; return;
} }
if (this.editor.svgCanvas.getCurrentDrawing().hasLayer(newName)) { if (this.editor.svgCanvas.getCurrentDrawing().hasLayer(newName)) {
alert(this.uiStrings.notification.dupeLayerName); alert(this.i18next.t('notification.dupeLayerName'));
return; return;
} }
this.editor.svgCanvas.createLayer(newName); this.editor.svgCanvas.createLayer(newName);
@@ -270,7 +270,7 @@ class LayersPanel {
return; return;
} }
if (this.editor.svgCanvas.getCurrentDrawing().hasLayer(newName)) { if (this.editor.svgCanvas.getCurrentDrawing().hasLayer(newName)) {
alert(this.uiStrings.notification.dupeLayerName); alert(this.i18next.t('notification.dupeLayerName'));
return; return;
} }
this.editor.svgCanvas.cloneLayer(newName); this.editor.svgCanvas.cloneLayer(newName);
@@ -323,7 +323,7 @@ class LayersPanel {
*/ */
layerRename() { layerRename() {
const oldName = document.querySelector("#layerlist tr.layersel td.layername").textContent; const oldName = document.querySelector("#layerlist tr.layersel td.layername").textContent;
const newName = prompt(this.uiStrings.notification.enterNewLayerName, ""); const newName = prompt(this.i18next.t('notification.enterNewLayerName'), "");
if (!newName) { if (!newName) {
return; return;
} }

View File

@@ -138,7 +138,7 @@ class TopPanel {
curhref = curhref.startsWith("data:") ? "" : curhref; curhref = curhref.startsWith("data:") ? "" : curhref;
// eslint-disable-next-line no-alert // eslint-disable-next-line no-alert
const url = prompt( const url = prompt(
this.editor.uiStrings.notification.enterNewImgURL, this.editor.i18next.t('notification.enterNewImgURL'),
curhref curhref
); );
if (url) { if (url) {