0
0
Fork 0
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:
Kenny 2022-08-08 20:23:00 -04:00
parent 3102584dec
commit 407348a7e0

View file

@ -35,8 +35,25 @@ function module(subPack, listPacks) {
const selectedLanguage = localStorage.getItem("language") || "english";
const languagePack = packs[selectedLanguage];
//--- Send Full Language Pack ---//
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) => {