Add Russian case

This commit is contained in:
Alexey Krainev
2025-11-08 15:08:08 +05:00
parent b3b1e94b8c
commit 58182fcbdf

View File

@@ -1,15 +1,18 @@
import { createIntl, createIntlCache } from "react-intl"; import { createIntl, createIntlCache } from "react-intl";
import langEn from "./lang/en.json"; import langEn from "./lang/en.json";
import langRu from "./lang/ru.json";
import langList from "./lang/lang-list.json"; import langList from "./lang/lang-list.json";
// first item of each array should be the language code, // first item of each array should be the language code,
// not the country code // not the country code
// Remember when adding to this list, also update check-locales.js script // Remember when adding to this list, also update check-locales.js script
const localeOptions = [["en", "en-US"]]; const localeOptions = [["en", "en-US"], ["ru", "ru-RU"]];
const loadMessages = (locale?: string): typeof langList & typeof langEn => { const loadMessages = (locale?: string): typeof langList & typeof langEn => {
const thisLocale = locale || "en"; const thisLocale = locale || "en";
switch (thisLocale.slice(0, 2)) { switch (thisLocale.slice(0, 2)) {
case "ru":
return Object.assign({}, langList, langRu);
default: default:
return Object.assign({}, langList, langEn); return Object.assign({}, langList, langEn);
} }
@@ -17,6 +20,8 @@ const loadMessages = (locale?: string): typeof langList & typeof langEn => {
const getFlagCodeForLocale = (locale?: string) => { const getFlagCodeForLocale = (locale?: string) => {
switch (locale) { switch (locale) {
case "ru":
return "RU";
default: default:
return "EN"; return "EN";
} }