Capital/utils/locale.ts

10 lines
257 B
TypeScript
Raw Normal View History

2024-09-28 05:29:05 +00:00
export function getLocale(locale?: any) {
2024-08-13 14:44:36 +00:00
const fallbackLocale = "en"
const supportedLocales = ["en", "zh-CN"]
2024-09-28 05:29:05 +00:00
if (locale == null) {
locale = useI18n().locale
}
2024-08-13 14:44:36 +00:00
2024-09-28 05:29:05 +00:00
return supportedLocales.includes(locale.value) ? locale.value : fallbackLocale
2024-08-13 14:44:36 +00:00
}