2024-03-21 11:14:54 +00:00
|
|
|
const langs = import.meta.glob(`./**/*.js`);
|
|
|
|
const files = import.meta.glob(`../pages/**/Translation/en.js`);
|
|
|
|
const importLang = {};
|
|
|
|
|
|
|
|
for (const fileLang in langs) {
|
|
|
|
const lang = fileLang.split('/').at(1);
|
|
|
|
|
|
|
|
import(fileLang)
|
|
|
|
.then((t) => {
|
|
|
|
importLang[lang] = t.default;
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
for (const file in files) {
|
|
|
|
const splittedFile = file.split('/');
|
|
|
|
splittedFile.pop();
|
|
|
|
const langFiles = splittedFile.join('/') + '/' + lang + '.js';
|
|
|
|
console.log('myFile: ', langFiles);
|
|
|
|
import(langFiles)
|
|
|
|
.then((t) => {
|
|
|
|
Object.assign(importLang[lang], t.default);
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.log('no va: ' + err, file, importLang);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2024-01-03 08:18:35 +00:00
|
|
|
}
|
2024-03-21 11:14:54 +00:00
|
|
|
|
|
|
|
export const localeEquivalence = {
|
|
|
|
en: 'en-GB',
|
2022-03-24 13:57:11 +00:00
|
|
|
};
|
2024-03-21 11:14:54 +00:00
|
|
|
export default importLang;
|