- Added translations

- Added pluralization example
  - Added formatter example (with Luxon)
  - Used HTTP loader
- Added a suspense fallback page for app loading
- Added cypress eslint rules
This commit is contained in:
2022-07-08 15:05:05 +02:00
parent 7d9c7037bc
commit 0003df5fab
19 changed files with 527 additions and 21 deletions

View File

@@ -0,0 +1,22 @@
import { FunctionComponent, ReactNode } from "react";
import { I18nextProvider, useTranslation } from "react-i18next";
import i18n from "./i18n";
type Props = { children?: ReactNode; keysOnly?: boolean };
const ProvidedComponent: FunctionComponent<Props> = ({ children, keysOnly }) => {
const [_translate, i18nSettings] = useTranslation();
if (keysOnly) {
i18nSettings.changeLanguage("noLang");
}
return <>{children}</>;
};
export const WithTestTranslations: FunctionComponent<Props> = ({ children, keysOnly = false }) => {
return (
<I18nextProvider i18n={i18n}>
<ProvidedComponent keysOnly={keysOnly}>{children}</ProvidedComponent>
</I18nextProvider>
);
};