@serendie/ui
Version:
Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric
21 lines (20 loc) • 1 kB
TypeScript
import { dictionary } from './dictionary';
import { Language } from './provider';
export { SerendieProvider, LanguageProvider, type Language, type SerendieProviderProps, } from './provider';
export type TranslationKey = keyof typeof dictionary.ja;
/**
* 翻訳関数を生成するヘルパー
* Context不要な場合や、サーバーサイドで直接使う場合に使用
*/
export declare function getTranslations(lang: Language): (key: TranslationKey, params?: Record<string, string | number>) => string;
/**
* 翻訳関数を取得するReact Hook
* SerendieProviderがない場合はデフォルト言語(ja)を使用します
*/
export declare function useTranslations(): (key: TranslationKey, params?: Record<string, string | number>) => string;
/**
* 言語に合わせて日付文字列をフォーマットする
* @param date ISO形式などDateが解釈できる文字列
* @param lang 言語
*/
export declare function formatDateByLang(date: string, lang: Language): string;