Set up
- In your index file, import your JSON translations
- Wrap your App with Talkr's
Provider
- Pass it your available
languages
and yourdefaultLanguage
. - You also have the option to let Talkr detect browser's language with the prop
detectBrowserLanguage
(see props).
import * as React from "react";
import { createRoot } from "react-dom/client";
import { Talkr } from "talkr";
import App from "./app";
import en from "./i18n/en.json";
import fr from "./i18n/fr.json";
const root = createRoot(document.getElementById("root"));
root.render(
<Talkr languages={{ en, fr }} defaultLanguage="en">
<App />
</Talkr>
);