1.0.2 • Published 6 years ago
react-simple-localize v1.0.2
Really minimal localization module based on the new context api
Zero dependencies, only 3kb ( not minified )
How to Use
// main.jsx
import { LocalizeProvider } from 'react-simple-localize'
import { YourApp } from './yourapp'
const messages = {
en: {
message: "hello"
},
it: {
message: "ciao"
}
}
render(
<LocalizeProvider locale="en" messages={messages}>
<YourApp />
</LocalizeProvider>,
document.getElementById('yourapp')
)
// yourapp.jsx
import { Localize } from 'react-simple-localize'
export function App() {
return <div>
<Localize path="message" />
<Localize path="another.nested.message" />
<Localize path="nested.message[0].inside_an_array" />
</div>
}