0
0
Fork 0
mirror of https://github.com/VueTubeApp/VueTube synced 2024-11-26 21:23:02 +00:00
VueTube/NUXT/plugins/language.js
Kenny 38d67fbf97 feat: Major Language Overhaul
Performance Optimisations, Fix Plugin Loader Bugs, Add More Translations, Fix Translation Related Bugs
2022-06-15 15:00:26 -04:00

25 lines
681 B
JavaScript

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