This commit is contained in:
vabene1111
2025-09-21 13:16:16 +02:00
parent dccfdcc11c
commit 64d2108ef6
3 changed files with 29 additions and 2 deletions

View File

@@ -572,19 +572,31 @@ LANGUAGES = [
('bg', _('Bulgarian')),
('ca', _('Catalan')),
('cs', _('Czech')),
('cr', _('Croatian')),
('da', _('Danish')),
('nl', _('Dutch')),
('en', _('English')),
('fr', _('French')),
('fi', _('Finnish')),
('de', _('German')),
('el', _('Greek')),
('he', _('Hebrew')),
('hu', _('Hungarian')),
('it', _('Italian')),
('lv', _('Latvian')),
('nb', _('Norwegian ')),
('nb', _('Norwegian')),
#('nb-NO', _('Norwegian Bokmål')),
('pl', _('Polish')),
('pt', _('Portuguese')),
('ru', _('Russian')),
('ro', _('Romanian')),
('es', _('Spanish')),
('sl', _('Slovenian')),
('sv', _('Swedish')),
('tr', _('Turkish')),
('uk', _('Ukranian')),
#('zh-Hant', _('Chinese (Traditional Han script)')),
#('zh-Hans', _('Chinese (Simplified Han script)')),
]
# Static files (CSS, JavaScript, Images)

View File

@@ -15,6 +15,7 @@ import {onMounted, ref} from "vue";
import {ApiApi, Localization} from "@/openapi";
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore.ts";
import {useI18n} from "vue-i18n";
import {SUPPORT_LOCALES} from "@/i18n.ts";
const availableLocalizations = ref([] as Localization[])
const {locale} = useI18n()
@@ -28,6 +29,19 @@ onMounted(() => {
}).catch(err => {
useMessageStore().addError(ErrorMessageType.FETCH_ERROR, err)
})
// console.log(locale.value)
// const regionNames = new Intl.DisplayNames([locale.value], { type: "language" });
//
// availableLocalizations.value = []
// SUPPORT_LOCALES.forEach(locale => {
// const lang = new Intl.Locale(locale.replace('_', '-'))
// console.log(lang)
// availableLocalizations.value.push({
// code: lang.baseName,
// language: `${regionNames.of(lang.baseName)} [${lang.baseName}]`
// } as Localization)
// })
})
/**

View File

@@ -103,7 +103,8 @@ function getSupportedLocales(localeFiles = import.meta.glob('@/locales/*.json'))
let supportedLocales: string[] = []
for (const path in localeFiles) {
supportedLocales.push(path.split('/').slice(-1)[0].split('.')[0]);
let locale = path.split('/').slice(-1)[0].split('.')[0].replace('_', '-')
supportedLocales.push(locale);
}
return supportedLocales
}