diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-11-07 08:09:14 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-11-07 08:09:14 -0400 |
commit | a10e27f93c8e7965c51b2e0372a7f4b19640452e (patch) | |
tree | b2d95b06c2edda94bb4684ed1298c6990169a888 /src | |
parent | 8197804433694865567c826ec0031e8ce73cbcd4 (diff) |
upd8: infer custom default language from internal default code
Diffstat (limited to 'src')
-rwxr-xr-x | src/upd8.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/upd8.js b/src/upd8.js index c011b660..7d7e48b9 100755 --- a/src/upd8.js +++ b/src/upd8.js @@ -1233,11 +1233,6 @@ async function main() { timeStart: Date.now(), }); - const customDefaultLanguage = - (wikiData.wikiInfo.defaultLanguage - ? languages[wikiData.wikiInfo.defaultLanguage] - : null); - let finalDefaultLanguage; let finalDefaultLanguageWatcher; let finalDefaultLanguageAnnotation; @@ -1262,14 +1257,25 @@ async function main() { return false; } - customDefaultLanguage.inheritedStrings = internalDefaultLanguage.strings; - logInfo`Applying new default strings from custom ${customDefaultLanguage.code} language file.`; + // The custom default language will be the new one providing fallback strings + // for other languages, but on its own, it still might not be a complete list + // of strings. So it falls back to the internal default language - which won't + // otherwise be presented on the site. + customDefaultLanguage.inheritedStrings = internalDefaultLanguage.strings; + finalDefaultLanguage = customDefaultLanguage; finalDefaultLanguageWatcher = customLanguageWatchers.find(({language}) => language === customDefaultLanguage); finalDefaultLanguageAnnotation = `using wiki-specified custom default language`; + } else if (languages[internalDefaultLanguage.code]) { + const customDefaultLanguage = languages[internalDefaultLanguage.code]; + customDefaultLanguage.inheritedStrings = internalDefaultLanguage.strings; + finalDefaultLanguage = customDefaultLanguage; + finalDefaultLanguageWatcher = + customLanguageWatchers.find(({language}) => language === customDefaultLanguage); + finalDefaultLanguageAnnotation = `using inferred custom default language`; } else { languages[internalDefaultLanguage.code] = internalDefaultLanguage; |