2022-06-15 13:25:51 +00:00
|
|
|
const packs = {
|
2022-08-08 23:58:40 +00:00
|
|
|
arabic: require("./languages/arabic"),
|
2022-07-01 06:27:34 +00:00
|
|
|
azerbaijan: require("./languages/azerbaijan"),
|
2022-06-22 05:24:06 +00:00
|
|
|
"brazilian-portuguese": require("./languages/brazilian-portuguese"),
|
2022-07-01 06:27:34 +00:00
|
|
|
bulgarian: require("./languages/bulgarian"),
|
|
|
|
"chinese-simplified": require("./languages/chinese-simplified"),
|
|
|
|
"chinese-traditional": require("./languages/chinese-traditional"),
|
2022-08-08 23:58:40 +00:00
|
|
|
czech: require("./languages/czech"),
|
2022-07-01 06:27:34 +00:00
|
|
|
dutch: require("./languages/dutch"),
|
|
|
|
english: require("./languages/english"),
|
2022-07-05 22:57:20 +00:00
|
|
|
estonian: require("./languages/estonian"),
|
2022-07-01 06:27:34 +00:00
|
|
|
"french-fr": require("./languages/french-fr"),
|
|
|
|
german: require("./languages/german"),
|
2022-08-08 23:58:40 +00:00
|
|
|
hindi: require("./languages/hindi"),
|
2022-08-20 10:06:43 +00:00
|
|
|
marathi: require("./languages/marathi"),
|
2022-08-10 11:20:35 +00:00
|
|
|
hungarian: require("./languages/hungarian"),
|
2022-07-01 06:27:34 +00:00
|
|
|
indonesian: require("./languages/indonesian"),
|
|
|
|
italian: require("./languages/italian"),
|
2022-10-19 05:14:22 +00:00
|
|
|
japanese: require("./languages/japanese"),
|
2022-07-01 06:27:34 +00:00
|
|
|
korean: require("./languages/korean"),
|
|
|
|
macedonian: require("./languages/macedonian"),
|
|
|
|
malay: require("./languages/malay"),
|
|
|
|
polish: require("./languages/polish"),
|
|
|
|
romanian: require("./languages/romanian"),
|
|
|
|
russian: require("./languages/russian"),
|
2022-08-13 02:44:30 +00:00
|
|
|
serbian: require("./languages/serbian"),
|
2022-07-01 06:27:34 +00:00
|
|
|
spanish: require("./languages/spanish"),
|
|
|
|
tamil: require("./languages/tamil"),
|
|
|
|
turkish: require("./languages/turkish"),
|
2022-07-05 22:57:20 +00:00
|
|
|
ukrainian: require("./languages/ukrainian"),
|
2022-08-08 23:58:40 +00:00
|
|
|
vietnamese: require("./languages/vietnamese"),
|
2022-06-22 05:24:06 +00:00
|
|
|
};
|
2022-06-15 13:25:51 +00:00
|
|
|
|
2022-06-18 00:04:33 +00:00
|
|
|
function module(subPack, listPacks) {
|
2022-06-15 13:25:51 +00:00
|
|
|
//--- List All Packs ---//
|
2022-06-15 13:40:13 +00:00
|
|
|
if (listPacks === true) return packs;
|
2022-06-15 13:25:51 +00:00
|
|
|
|
|
|
|
//--- Return Language Pack ---//
|
2022-06-15 00:55:45 +00:00
|
|
|
const selectedLanguage = localStorage.getItem("language") || "english";
|
2022-06-18 00:04:33 +00:00
|
|
|
const languagePack = packs[selectedLanguage];
|
2022-05-06 03:11:28 +00:00
|
|
|
|
2022-08-09 00:23:00 +00:00
|
|
|
//--- Send Full Language Pack ---//
|
2022-06-18 00:04:33 +00:00
|
|
|
if (!subPack) return languagePack;
|
2022-08-09 00:23:00 +00:00
|
|
|
//--- 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;
|
2022-05-06 03:11:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default ({ app }, inject) => {
|
|
|
|
inject("lang", module);
|
|
|
|
};
|