Capital/utils/locale.ts
2024-09-28 13:29:05 +08:00

10 lines
257 B
TypeScript

export function getLocale(locale?: any) {
const fallbackLocale = "en"
const supportedLocales = ["en", "zh-CN"]
if (locale == null) {
locale = useI18n().locale
}
return supportedLocales.includes(locale.value) ? locale.value : fallbackLocale
}