0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-01 09:22:39 +00:00
VueTube/NUXT/plugins/language.js
2022-06-16 12:56:19 -04:00

31 lines
989 B
JavaScript

const packs = {
english: require('./languages/english'),
dutch: require('./languages/dutch'),
german: require('./languages/german'),
italian: require('./languages/italian'),
macedonian: require('./languages/macedonian'),
malay: require('./languages/malay'),
polish: require('./languages/polish'),
spanish: require('./languages/spanish'),
"chinese-traditional": require('./languages/chinese-traditional'),
"chinese-simplified": require('./languages/chinese-simplified'),
"brazilian-portuguese": require('./languages/brazilian-portuguese'),
}
function module(text, listPacks) {
//--- List All Packs ---//
if (listPacks === true) return packs;
//--- Return Language Pack ---//
const selectedLanguage = localStorage.getItem("language") || "english";
const languagePack = require('./languages/'+selectedLanguage);
if (!text) return languagePack;
return languagePack[text];
}
export default ({ app }, inject) => {
inject("lang", module);
};