Revert "Import translations as raw to improve compatibility."

This reverts commit 86de15178f.
This commit is contained in:
Buster Neece 2023-10-19 18:13:08 -05:00
parent 86de15178f
commit abc22c1266
No known key found for this signature in database
1 changed files with 4 additions and 11 deletions

View File

@ -11,21 +11,14 @@ export function useTranslate(): Language {
export async function installTranslate(vueApp: App): Promise<void> {
const {locale} = useAzuraCast();
const translationsRaw = import.meta.glob('../../../translations/**/translations.json', {
as: 'raw',
});
const translations = import.meta.glob('../../../translations/**/translations.json', {as: 'json'});
const localePath = '../../../translations/' + locale + '.UTF-8/translations.json';
let translations = {};
if (localePath in translationsRaw) {
translations = await JSON.parse(
await translationsRaw[localePath]()
);
}
gettext = createGettext({
defaultLanguage: locale,
translations: translations,
translations: (localePath in translations) ?
await translations[localePath]()
: {},
silent: true
});