refactor: update language configuration

This commit is contained in:
radishzzz 2025-03-15 01:02:45 +00:00
parent ff59dc1a7c
commit 22dc899a95
25 changed files with 53 additions and 188 deletions

View file

@ -1,5 +1,23 @@
import { themeConfig } from '@/config'
// Global Language Map
export const langMap: Record<string, string[]> = {
'zh': ['zh-CN'],
'zh-tw': ['zh-TW'],
'ja': ['ja-JP'],
'en': ['en-US'],
'es': ['es-ES'],
'ru': ['ru-RU'],
}
export const defaultLocale = themeConfig.global.locale
export const moreLocales = themeConfig.global.moreLocales
export const allLocales = [defaultLocale, ...moreLocales]
// Waline Language Map
// docs: https://waline.js.org/guide/i18n.html
export const walineLocaleMap: Record<string, string> = {
'zh': 'zh-CN',
'zh-tw': 'zh-TW',
'ja': 'jp-JP', // Waline uses jp-JP not ja-JP
'en': 'en-US',
'es': 'es-ES',
'ru': 'ru-RU',
}
// Supported Languages
export const supportedLangs = Object.keys(langMap).flat()