mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-11-01 01:12:39 +00:00
feat: ♿ translation fallback 1/2
This commit is contained in:
parent
3102584dec
commit
407348a7e0
1 changed files with 18 additions and 1 deletions
|
@ -35,8 +35,25 @@ function module(subPack, listPacks) {
|
||||||
const selectedLanguage = localStorage.getItem("language") || "english";
|
const selectedLanguage = localStorage.getItem("language") || "english";
|
||||||
const languagePack = packs[selectedLanguage];
|
const languagePack = packs[selectedLanguage];
|
||||||
|
|
||||||
|
//--- Send Full Language Pack ---//
|
||||||
if (!subPack) return languagePack;
|
if (!subPack) return languagePack;
|
||||||
return languagePack[subPack];
|
//--- Allow Subpack Fallback ---//
|
||||||
|
let builtSubPack = new Object();
|
||||||
|
for (const i in packs.english[subPack]) {
|
||||||
|
const englishEntry = packs.english[subPack][i];
|
||||||
|
const entry = languagePack[subPack][i];
|
||||||
|
|
||||||
|
if (!entry) {
|
||||||
|
builtSubPack[i] = englishEntry;
|
||||||
|
} else {
|
||||||
|
builtSubPack[i] = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//--- Return Built Subpack ---//
|
||||||
|
console.log("RETURNING:",builtSubPack)
|
||||||
|
return builtSubPack;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ({ app }, inject) => {
|
export default ({ app }, inject) => {
|
||||||
|
|
Loading…
Reference in a new issue