mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-07 07:44:18 -07:00
Fix I18n and testing (#387)
Get snapshots working with Gatsby Intl plugin.
This commit is contained in:
parent
e5908cf7d7
commit
609506d98d
4 changed files with 188 additions and 179 deletions
|
@ -1,6 +1,15 @@
|
|||
import React, {ReactNode} from 'react';
|
||||
import {IntlContextProvider} from 'gatsby-plugin-intl';
|
||||
import {IntlProvider, IntlContextProvider} from 'gatsby-plugin-intl';
|
||||
import messages from '../intl/en.json'; // this is updated by `formatjs extract`
|
||||
|
||||
const intlConfig = {
|
||||
language: 'en',
|
||||
languages: ['en', 'es'],
|
||||
messages,
|
||||
originalPath: '/',
|
||||
redirect: true,
|
||||
routed: true,
|
||||
};
|
||||
interface ILocalizedComponentProps {
|
||||
children: ReactNode
|
||||
}
|
||||
|
@ -8,8 +17,10 @@ interface ILocalizedComponentProps {
|
|||
export const LocalizedComponent = ({children}: ILocalizedComponentProps) => {
|
||||
return (
|
||||
<>
|
||||
<IntlContextProvider value={{language: 'en', routed: true}}>
|
||||
{children}
|
||||
<IntlContextProvider value={intlConfig} >
|
||||
<IntlProvider locale={'en'}>
|
||||
{children}
|
||||
</IntlProvider>
|
||||
</IntlContextProvider>,
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue