mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Make function callbacks and returns more readable
This commit is contained in:
parent
4a11cdc564
commit
221eadcc20
@ -319,14 +319,16 @@ var Module = Class.extend({
|
|||||||
const fallbackLanguage = languages[0];
|
const fallbackLanguage = languages[0];
|
||||||
|
|
||||||
if (languages.length === 0) {
|
if (languages.length === 0) {
|
||||||
return callback();
|
callback();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const translationFile = translations[language];
|
const translationFile = translations[language];
|
||||||
const translationsFallbackFile = translations[fallbackLanguage];
|
const translationsFallbackFile = translations[fallbackLanguage];
|
||||||
|
|
||||||
if (!translationFile) {
|
if (!translationFile) {
|
||||||
return Translator.load(this, translationsFallbackFile, true, callback);
|
Translator.load(this, translationsFallbackFile, true, callback);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Translator.load(this, translationFile, false, () => {
|
Translator.load(this, translationFile, false, () => {
|
||||||
|
@ -107,7 +107,8 @@ var Translator = (function () {
|
|||||||
Log.log(`${module.name} - Load translation${isFallback && " fallback"}: ${file}`);
|
Log.log(`${module.name} - Load translation${isFallback && " fallback"}: ${file}`);
|
||||||
|
|
||||||
if (this.translationsFallback[module.name]) {
|
if (this.translationsFallback[module.name]) {
|
||||||
return callback();
|
callback();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadJSON(module.file(file), (json) => {
|
loadJSON(module.file(file), (json) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user