New Crowdin updates (#364)
* New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Arabic) * feat: add it lang * New translations en.json (French) * New translations en.json (Spanish) * New translations en.json (Arabic) * New translations en.json (German) * New translations en.json (Hungarian) * New translations en.json (Japanese) * New translations en.json (Chinese Simplified) * New translations en.json (Indonesian) * New translations en.json (Korean) * New translations en.json (Italian) * New translations en.json (Arabic) * New translations en.json (Japanese) * New translations en.json (Indonesian) * New translations en.json (Indonesian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (Italian) * New translations en.json (French) * New translations en.json (Spanish) * New translations en.json (Arabic) * New translations en.json (German) * New translations en.json (Hungarian) * New translations en.json (Japanese) * New translations en.json (Chinese Simplified) * New translations en.json (Indonesian) * New translations en.json (Korean) * New translations en.json (Italian) * New translations en.json (Arabic) * New translations en.json (Italian) * New translations en.json (Japanese) * New translations en.json (Indonesian) * New translations en.json (Italian) * Read preferences directly from localStorage * Add Indonesian to language picker * Update translators
This commit is contained in:
@ -1,9 +1,7 @@
|
||||
import { type ReactNode } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { IntlProvider as ReactIntlProvider } from "react-intl";
|
||||
|
||||
import { RootState } from "State/Store";
|
||||
|
||||
import { ReadPreferences } from "State/Login";
|
||||
import enMessages from "translations/en.json";
|
||||
import esMessages from "translations/es.json";
|
||||
import zhMessages from "translations/zh.json";
|
||||
@ -12,6 +10,7 @@ import frMessages from "translations/fr.json";
|
||||
import huMessages from "translations/hu.json";
|
||||
import idMessages from "translations/id.json";
|
||||
import arMessages from "translations/ar.json";
|
||||
import itMessages from "translations/it.json";
|
||||
|
||||
const DEFAULT_LOCALE = "en-US";
|
||||
|
||||
@ -19,8 +18,6 @@ const getMessages = (locale: string) => {
|
||||
const truncatedLocale = locale.toLowerCase().split(/[_-]+/)[0];
|
||||
|
||||
switch (truncatedLocale) {
|
||||
case "en":
|
||||
return enMessages;
|
||||
case "es":
|
||||
return esMessages;
|
||||
case "zh":
|
||||
@ -35,14 +32,16 @@ const getMessages = (locale: string) => {
|
||||
return idMessages;
|
||||
case "ar":
|
||||
return arMessages;
|
||||
case "it":
|
||||
return itMessages;
|
||||
default:
|
||||
return enMessages;
|
||||
}
|
||||
};
|
||||
|
||||
export const IntlProvider = ({ children }: { children: ReactNode }) => {
|
||||
const lang = useSelector((s: RootState) => s.login.preferences.language);
|
||||
const locale = lang ?? getLocale();
|
||||
const { language } = ReadPreferences();
|
||||
const locale = language ?? getLocale();
|
||||
|
||||
return (
|
||||
<ReactIntlProvider locale={locale} messages={getMessages(locale)}>
|
||||
|
Reference in New Issue
Block a user