Skip to content

Instantly share code, notes, and snippets.



Last active Aug 12, 2020
What would you like to do?
// The Context typed with your Dictionary, which will be used by your components
export const myI18nCtx React.createContext<I18nContextType<MyDictionary>>({} as any);
export function App(props: Props) {
// Fallback locale and respective dictionary
const myI18nDefaults = { locale: "en", dictionary: english };
// All your dictionaries. The key of the Map object should follow the browser pattern
const myI18nDictionaries = new Map([
["en", english],
["pt", portuguese]
return (
<I18nDictionariesProvider defaults={myI18nDefaults} dictionaries={myI18nDictionaries} ctx={myI18nCtx}>
<MyComponent />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment