mon-entreprise/site/source/entry-en.tsx

33 lines
879 B
TypeScript
Raw Normal View History

import { I18nProvider } from '@react-aria/i18n'
2018-07-12 08:09:41 +00:00
import { render } from 'react-dom'
import App from './App'
import i18next from './locales/i18n'
import ruleTranslations from './locales/rules-en.yaml'
import translateRules from './locales/translateRules'
import translations from './locales/ui-en.yaml'
2022-04-13 16:42:50 +00:00
import { withProfiler } from '@sentry/react'
import './sentry'
export const AppEn = () => (
<I18nProvider locale="en-GB">
2021-12-27 11:46:40 +00:00
<App
basename="infrance"
2022-01-04 10:11:31 +00:00
rulesPreTransform={(rules) =>
translateRules('en', ruleTranslations, rules)
}
2021-12-27 11:46:40 +00:00
/>
</I18nProvider>
)
2022-04-13 16:42:50 +00:00
const AppEnWithProfiler = withProfiler(AppEn)
i18next.addResourceBundle('en', 'translation', translations)
if (!import.meta.env.SSR) {
2022-03-28 13:34:12 +00:00
i18next.changeLanguage('en').catch((err) =>
// eslint-disable-next-line no-console
console.error(err)
)
2022-04-13 16:42:50 +00:00
render(<AppEnWithProfiler />, document.querySelector('#js'))
}