0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-23 03:35:15 +00:00
VueTube/NUXT/plugins/language.js

35 lines
1.1 KiB
JavaScript
Raw Normal View History

const packs = {
bulgarian: require('./languages/bulgarian'),
english: require('./languages/english'),
2022-06-17 13:38:00 +00:00
"french-fr": require('./languages/french-fr'),
2022-06-16 16:56:19 +00:00
german: require('./languages/german'),
italian: require('./languages/italian'),
2022-06-16 03:26:46 +00:00
macedonian: require('./languages/macedonian'),
2022-06-16 16:56:19 +00:00
malay: require('./languages/malay'),
dutch: require('./languages/dutch'),
polish: require('./languages/polish'),
2022-06-16 03:26:46 +00:00
spanish: require('./languages/spanish'),
2022-06-16 16:56:19 +00:00
"chinese-traditional": require('./languages/chinese-traditional'),
"chinese-simplified": require('./languages/chinese-simplified'),
"brazilian-portuguese": require('./languages/brazilian-portuguese'),
indonesian: require('./languages/indonesian'),
}
function module(subPack, listPacks) {
//--- List All Packs ---//
2022-06-15 13:40:13 +00:00
if (listPacks === true) return packs;
//--- Return Language Pack ---//
const selectedLanguage = localStorage.getItem("language") || "english";
const languagePack = packs[selectedLanguage];
if (!subPack) return languagePack;
return languagePack[subPack];
}
export default ({ app }, inject) => {
inject("lang", module);
};