9 lines
228 B
TypeScript
9 lines
228 B
TypeScript
import type { LocaleBundle, SiteLocale } from '~/types/locale'
|
|
|
|
export function pickLocale<T>(bundle: LocaleBundle<T>, locale: SiteLocale): T {
|
|
if (locale === 'zh' && bundle.zh) {
|
|
return bundle.zh
|
|
}
|
|
return bundle.en
|
|
}
|