Convert localization from AMD to ES modules

This commit is contained in:
Dannon Baker
2025-12-02 12:11:05 -05:00
parent 873740e912
commit 00a8127aea
8 changed files with 52 additions and 16 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
/** en/main localization hash - for use with requirejs' i18n plugin */
define({
export default {
// ----------------------------------------------------------------------------- masthead
"Analyze Data": "Daten analysieren",
Workflow: "Arbeitsablauf",
@@ -201,4 +201,4 @@ define({
// ---------------------------------------------------------------------------- misc. MVC
Tags: "Variablen",
"Edit annotation": "Anmerkung bearbeiten",
});
};
+2 -2
View File
@@ -1,6 +1,6 @@
/** en/main localization hash - for use with requirejs' i18n plugin */
define({
export default {
// ----------------------------------------------------------------------------- masthead
"Analyze Data": "Analizar Datos",
@@ -817,4 +817,4 @@ define({
// ---------------------------------------------------------------------------- workflow_editor_tests
"tool tooltip": "Mensaje de información sobre herramientas",
// ----------------------------------------------------------------------------
});
};
+2 -2
View File
@@ -1,5 +1,5 @@
/** fr localization */
define({
export default {
// ----------------------------------------------------------------------------- masthead
"Analyze Data": "Analyse de données",
Workflow: "Workflow",
@@ -453,4 +453,4 @@ define({
// ---------------------------------------------------------------------------- workflow_editor_tests
"tool tooltip": false,
// ----------------------------------------------------------------------------
});
};
+35
View File
@@ -0,0 +1,35 @@
/**
* ES module locale aggregator
* This replaces the RequireJS i18n plugin functionality
* Loads all languages and returns them in the expected format
*/
// Import root strings and supported languages
import { root, supportedLanguages } from './locale.js';
// Import all language files
import frLocale from './fr/locale.js';
import esLocale from './es/locale.js';
import jaLocale from './ja/locale.js';
import zhLocale from './zh/locale.js';
import deLocale from './de/locale.js';
// Build the locale strings object with the same structure
// that the i18n loader would have created
const localeStrings = {
__root: root,
__fr: frLocale,
__es: esLocale,
__ja: jaLocale,
__zh: zhLocale,
__de: deLocale,
// Add language codes without underscores for compatibility
fr: frLocale,
es: esLocale,
ja: jaLocale,
zh: zhLocale,
de: deLocale
};
// Export with the same structure that the i18n loader would have created
export default localeStrings;
+2 -2
View File
@@ -1,5 +1,5 @@
/** ja localization */
define({
export default {
// ----------------------------------------------------------------------------- masthead
"Analyze Data": "データ解析",
Workflow: "ワークフロー",
@@ -279,4 +279,4 @@ define({
"Edit annotation": "アノテーションを編集",
//false,
"Your workflows": "あなたのワークフロー",
});
};
+6 -5
View File
@@ -1,6 +1,5 @@
/** en/main localization hash - for use with requirejs' i18n plugin */
define({
root: {
/** en/main localization hash - converted to ES module */
export const root = {
// ----------------------------------------------------------------------------- masthead
"Analyze Data": false,
Workflow: false,
@@ -459,9 +458,11 @@ define({
"Forgot password?": false,
"Register here.": false,
"Click here to reset your password.": false,
},
};
export const supportedLanguages = {
ja: true,
fr: true,
zh: true,
es: true,
});
};
+2 -2
View File
@@ -1,6 +1,6 @@
/** zh localization */
/* any suggestions, please contact me: ishenweiyan@foxmail.com */
define({
export default {
// ----------------------------------------------------------------------------- masthead
"Analyze Data": "数据分析",
Workflow: "工作流程",
@@ -471,4 +471,4 @@ define({
ja: true,
fr: true,
zh: true,
});
};
+1 -1
View File
@@ -1,4 +1,4 @@
import localeStrings from "i18n!nls/locale";
import localeStrings from "@/nls/index.js";
/**
* @param {String} strToLocalize