MCPcopy
hub / github.com/MagicMirrorOrg/MagicMirror / load

Function load

js/translator.js:88–98  ·  view source on GitHub ↗

* Load a translation file (json) and remember the data. * @param {Module} module The module to load the translation file for. * @param {string} file Path of the file we want to load. * @param {boolean} isFallback Flag to indicate fallback translations.

(module, file, isFallback)

Source from the content-addressed store, hash-verified

86 * @param {boolean} isFallback Flag to indicate fallback translations.
87 */
88 async load (module, file, isFallback) {
89 Log.log(`[translator] ${module.name} - Load translation${isFallback ? " fallback" : ""}: ${file}`);
90
91 if (this.translationsFallback[module.name]) {
92 return;
93 }
94
95 const json = await loadJSON(module.file(file));
96 const property = isFallback ? "translationsFallback" : "translations";
97 this[property][module.name] = json;
98 },
99
100 /**
101 * Load the core translations.

Callers

nothing calls this directly

Calls 2

loadJSONFunction · 0.85
fileMethod · 0.80

Tested by

no test coverage detected