Fallback to english if no translation in the current language is available

Change-Id: I94ecf5f2d742b1653177c49cef6b1b7fd6e96df0
This commit is contained in:
Manuel Stahl 2024-04-22 10:57:44 +02:00
parent 441f7749a2
commit e666c9c7bd

View file

@ -6,6 +6,7 @@ import {
resolveBrowserLocale,
} from "react-admin";
import polyglotI18nProvider from "ra-i18n-polyglot";
import merge from "lodash/merge";
import authProvider from "./synapse/authProvider";
import dataProvider from "./synapse/dataProvider";
import users from "./components/users";
@ -33,7 +34,8 @@ const messages = {
zh: chineseMessages,
};
const i18nProvider = polyglotI18nProvider(
locale => (messages[locale] ? messages[locale] : messages.en),
locale =>
messages[locale] ? merge({}, messages.en, messages[locale]) : messages.en,
resolveBrowserLocale(),
[
{ locale: "en", name: "English" },