Add complete Russian language support to Open Notebook following the established i18n patterns from ja-JP and pt-BR implementations. Changes: - Create ru-RU locale file with all translation keys - Register ru-RU in locales/index.ts resources and languages array - Add ru-RU key integrity test - Add Russian date-fns locale mapping - Add Russian option to LanguageToggle dropdown - Add `russian: "Русский"` key to all existing locales - Update README.md supported languages list - Update locales CLAUDE.md documentation Fixes #523 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Luis Novo <lfnovo@gmail.com>
25 lines
659 B
TypeScript
25 lines
659 B
TypeScript
import { zhCN, enUS, zhTW, ptBR, ja, ru, Locale } from 'date-fns/locale'
|
|
|
|
/**
|
|
* Mapping of language codes to date-fns locales.
|
|
* Add new languages here as needed.
|
|
*/
|
|
const LOCALE_MAP: Record<string, Locale> = {
|
|
'zh-CN': zhCN,
|
|
'zh-TW': zhTW,
|
|
'en-US': enUS,
|
|
'pt-BR': ptBR,
|
|
'ja-JP': ja,
|
|
'ru-RU': ru,
|
|
}
|
|
|
|
/**
|
|
* Get the date-fns locale for a given language code.
|
|
* Falls back to English (en-US) if the language is not found.
|
|
*
|
|
* @param language - The language code (e.g., 'zh-CN', 'en-US')
|
|
* @returns The corresponding date-fns Locale object
|
|
*/
|
|
export function getDateLocale(language: string): Locale {
|
|
return LOCALE_MAP[language] || enUS
|
|
}
|