20 行
598 B
TypeScript
20 行
598 B
TypeScript
import { translateUIMessage } from '@/lib/i18n'
|
|
|
|
import type navigation from '@/locales/ja/navigation.json'
|
|
import type { LocaleCode } from '@/lib/locales'
|
|
|
|
export type UIMessageKey = keyof typeof navigation
|
|
|
|
|
|
export const uiMessage = (
|
|
locale: LocaleCode,
|
|
key: UIMessageKey,
|
|
values: Record<string, string | number> = { },
|
|
): string => translateUIMessage (key, 'navigation', locale, values).text
|
|
|
|
|
|
export const uiMessageLanguage = (locale: LocaleCode, key: UIMessageKey): 'ja' | 'ain' =>
|
|
translateUIMessage (key, 'navigation', locale).language === 'ain-Kana'
|
|
? 'ain'
|
|
: 'ja'
|