A translation library to help react applications managing, loading and applying translations.
Simple example of translation
Add context on top of page
import TranslationJSContext from "react-translation.js"
ReactDOM.render(<React.StrictMode><TranslationJSContext><App/></TranslationJSContext></React.StrictMode>, document.getElementById("root"))
Add translation
import { LoadTrans, useTranslation } from 'react-translation.js'
const translation = useTranslation();
LoadTrans("pt", { global: { missing: { text: "Texto em Falta" } } }, translation, true)
Use translation
import { T } from 'react-translation.js'
T("global.missing.text")
T will return Texto em Falta
You can also directly load a JSON.parse()
into the LoadTrans function
To build the library all you have to do is run the following commands
yarn
yarn build