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

27 lines
731 B
JavaScript
Raw Normal View History

const packs = {
english: require('./languages/english'),
italian: require('./languages/italian'),
2022-06-16 03:26:46 +00:00
macedonian: require('./languages/macedonian'),
polish: require('./languages/polish'),
2022-06-16 03:26:46 +00:00
spanish: require('./languages/spanish'),
"chinese-traditional": require('./languages/chinese-traditional')
}
function module(text, 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";
2022-06-15 13:53:48 +00:00
const languagePack = require('./languages/'+selectedLanguage);
if (!text) return languagePack;
return languagePack[text];
}
export default ({ app }, inject) => {
inject("lang", module);
};