0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-29 14:43:04 +00:00
VueTube/NUXT/plugins/language.js
2022-06-15 23:26:46 -04:00

26 lines
731 B
JavaScript

const packs = {
english: require('./languages/english'),
italian: require('./languages/italian'),
macedonian: require('./languages/macedonian'),
polish: require('./languages/polish'),
spanish: require('./languages/spanish'),
"chinese-traditional": require('./languages/chinese-traditional')
}
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);
};