fix: update crowdin config (#658)
This commit is contained in:
+21
-9
@@ -3,15 +3,29 @@ import { initReactI18next } from "react-i18next";
|
||||
import Backend from "i18next-http-backend";
|
||||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
|
||||
export type Lang = { code: string; name: string; flag: string };
|
||||
export type Lang = {
|
||||
code: Intl.Locale["language"];
|
||||
name: string;
|
||||
flag: string;
|
||||
};
|
||||
|
||||
export type LangCode = Lang["code"];
|
||||
|
||||
function getFlagEmoji(regionCode: string): string {
|
||||
const A_LETTER_CODE = 0x1F1E6;
|
||||
const a_char_code = "A".charCodeAt(0);
|
||||
const codePoints = regionCode
|
||||
.toUpperCase()
|
||||
.split("")
|
||||
.map((char) => A_LETTER_CODE + char.charCodeAt(0) - a_char_code);
|
||||
return String.fromCodePoint(...codePoints);
|
||||
}
|
||||
|
||||
export const supportedLanguages: Lang[] = [
|
||||
// { code: "de", name: "Deutsch", flag: "🇩🇪" },
|
||||
{ code: "en", name: "English", flag: "🇺🇸" },
|
||||
// { code: "es", name: "Español", flag: "🇪🇸" },
|
||||
// { code: "fr", name: "Français", flag: "🇫🇷" },
|
||||
// { code: "zh", name: "中文", flag: "🇨🇳" },
|
||||
{ code: "de", name: "German", flag: getFlagEmoji("de") },
|
||||
{ code: "en", name: "English", flag: getFlagEmoji("us") },
|
||||
{ code: "fi", name: "Finnish", flag: getFlagEmoji("fi") },
|
||||
{ code: "sv", name: "Swedish", flag: getFlagEmoji("se") },
|
||||
];
|
||||
|
||||
i18next
|
||||
@@ -28,15 +42,13 @@ i18next
|
||||
},
|
||||
detection: {
|
||||
order: ["navigator", "localStorage"],
|
||||
caches: ["localStorage"],
|
||||
},
|
||||
fallbackLng: {
|
||||
"en-US": ["en"],
|
||||
"en-CA": ["en-US", "en"],
|
||||
"default": ["en"],
|
||||
},
|
||||
fallbackNS: ["common", "ui", "dialog"],
|
||||
debug: import.meta.env.MODE === "development",
|
||||
supportedLngs: supportedLanguages?.map((lang) => lang.code),
|
||||
ns: [
|
||||
"channels",
|
||||
"commandPalette",
|
||||
|
||||
Reference in New Issue
Block a user