Revert "Import translations as raw to improve compatibility."
This reverts commit 86de15178f
.
This commit is contained in:
parent
86de15178f
commit
abc22c1266
|
@ -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
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue