diff --git a/src/editor/Editor.js b/src/editor/Editor.js index 47934d1a..0664fe54 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -377,7 +377,7 @@ class Editor extends EditorStartup { this.exportWindow = window.open(blankPageObjectURL || '', exportWindowName); // A hack to get the window via JSON-able name without opening a new one if (!this.exportWindow || this.exportWindow.closed) { - seAlert(this.uiStrings.notification.popupWindowBlocked); + seAlert(this.i18next.t('notification.popupWindowBlocked')); return; } @@ -389,7 +389,7 @@ class Editor extends EditorStartup { // Check if there are issues if (issues.length) { const pre = '\n \u2022 '; - note += ('\n\n' + this.uiStrings.notification.noteTheseIssues + pre + issues.join(pre)); + note += ('\n\n' + this.i18next.t('notification..noteTheseIssues') + pre + issues.join(pre)); } // Note that this will also prevent the notice even though new issues may appear later. @@ -941,7 +941,7 @@ class Editor extends EditorStartup { }; if (!this.svgCanvas.setSvgString(e.detail.value)) { - const ok = await seConfirm(this.uiStrings.notification.QerrorsRevertToSource); + const ok = await seConfirm(this.i18next.t('notification.QerrorsRevertToSource')); if (ok === false || ok === 'Cancel') { return; } @@ -970,7 +970,7 @@ class Editor extends EditorStartup { if (editingsource) { const origSource = this.svgCanvas.getSvgString(); if (origSource !== e.detail.value) { - const ok = seConfirm(this.uiStrings.notification.QignoreSourceChanges); + const ok = seConfirm(this.i18next.t('notification.QignoreSourceChanges')); if (ok) { this.hideSourceEditor(); } @@ -1000,7 +1000,7 @@ class Editor extends EditorStartup { if (this.svgCanvas.undoMgr.getUndoStackSize() === 0) { return true; } - return await seConfirm(this.uiStrings.notification.QwantToOpen); + return await seConfirm(this.i18next.t('notification.QwantToOpen')); } /** @@ -1052,13 +1052,13 @@ class Editor extends EditorStartup { const $editDialog = document.getElementById('se-edit-prefs'); $editDialog.setAttribute('lang', lang); const oldLayerName = ($id('#layerlist')) ? $id('#layerlist').querySelector('tr.layersel td.layername').textContent : ""; - const renameLayer = (oldLayerName === this.uiStrings.common.layer + ' 1'); + const renameLayer = (oldLayerName === this.i18next.t('notification.common.layer') + ' 1'); // this.svgCanvas.setUiStrings(allStrings); this.setTitles(); if (renameLayer) { - this.svgCanvas.renameCurrentLayer(this.uiStrings.common.layer + ' 1'); + this.svgCanvas.renameCurrentLayer(this.i18next.t('notification.common.layer') + ' 1'); this.layersPanel.populateLayers(); } @@ -1151,7 +1151,7 @@ class Editor extends EditorStartup { dataType: 'text', cache: Boolean(cache), beforeSend() { - $.process_cancel(this.uiStrings.notification.loadingImage); + $.process_cancel(this.i18next.t('notification.loadingImage')); }, success(str) { this.loadSvgString(str, { noAlert }); diff --git a/src/editor/EditorStartup.js b/src/editor/EditorStartup.js index 49009cd0..f74cd956 100644 --- a/src/editor/EditorStartup.js +++ b/src/editor/EditorStartup.js @@ -165,7 +165,7 @@ class EditorStartup { this.exportWindow = window.open('', this.exportWindowName); // A hack to get the window via JSON-able name without opening a new one } if (!this.exportWindow || this.exportWindow.closed) { - seAlert(this.uiStrings.notification.popupWindowBlocked); + seAlert(this.i18next.t('notification.popupWindowBlocked')); return; } this.exportWindow.location.href = data.output; @@ -577,8 +577,8 @@ class EditorStartup { // showSaveWarning is set to 'false' when the page is saved. if (!this.configObj.curConfig.no_save_warning && this.showSaveWarning) { // Browser already asks question about closing the page - e.returnValue = this.uiStrings.notification.unsavedChanges; // Firefox needs this when beforeunload set by addEventListener (even though message is not used) - return this.uiStrings.notification.unsavedChanges; + e.returnValue = this.i18next.t('notification.unsavedChanges'); // Firefox needs this when beforeunload set by addEventListener (even though message is not used) + return this.i18next.t('notification.unsavedChanges'); } return true; }.bind(this)); diff --git a/src/editor/panels/LayersPanel.js b/src/editor/panels/LayersPanel.js index c5057f84..810a178c 100644 --- a/src/editor/panels/LayersPanel.js +++ b/src/editor/panels/LayersPanel.js @@ -219,7 +219,7 @@ class LayersPanel { } while (this.editor.svgCanvas.getCurrentDrawing().hasLayer(uniqName)); const newName = prompt( - this.uiStrings.notification.enterUniqueLayerName, + this.i18next.t('notification.enterUniqueLayerName'), uniqName ); if (!newName) { @@ -263,7 +263,7 @@ class LayersPanel { this.editor.svgCanvas.getCurrentDrawing().getCurrentLayerName() + " copy"; const newName = prompt( - this.uiStrings.notification.enterUniqueLayerName, + this.i18next.t('notification.enterUniqueLayerName'), name ); if (!newName) { @@ -331,7 +331,7 @@ class LayersPanel { oldName === newName || this.editor.svgCanvas.getCurrentDrawing().hasLayer(newName) ) { - alert(this.uiStrings.notification.layerHasThatName); + alert(this.i18next.t('notification.layerHasThatName')); return; } this.editor.svgCanvas.renameCurrentLayer(newName); diff --git a/src/editor/panels/TopPanel.js b/src/editor/panels/TopPanel.js index 99b213f4..1501b436 100644 --- a/src/editor/panels/TopPanel.js +++ b/src/editor/panels/TopPanel.js @@ -558,7 +558,7 @@ class TopPanel { if (!valid) { e.target.value = this.editor.selectedElement().getAttribute(attr); // eslint-disable-next-line no-alert - alert(this.uiStrings.notification.invalidAttrValGiven); + alert(this.i18next.t('notification.invalidAttrValGiven')); return false; } @@ -619,7 +619,7 @@ class TopPanel { if (!isNullish(this.editor.selectedElement) || this.multiselected) { // eslint-disable-next-line no-alert const url = prompt( - this.uiStrings.notification.enterNewLinkURL, + this.i18next.t('notification.enterNewLinkURL'), "http://" ); if (url) {