bs-react-i18next
v1.0.0
Published
Bucklescript bindings for react-i18next
Downloads
1
Maintainers
Readme
bs-react-i18next
Introduction
Bucklescript + ReasonReact binding for react-i18next components.
t and Trans components are minimally functional but HOC and Component bindings to provide t to the context are not yet available. If you want to use this in the current state, you need to initialize i18next in javascript above reason-react and pass t as a parameter. This is obviously suboptimal so if you have reason-react experience, please help improve this starting point!
See bs-ant-design repo for credit on binding pattern.
Installation
npm install --save bs-react-i18next
- Add
bs-react-i18next
tobs-dependencies
inbsconfig.json
.
Usage
// pass t down as prop
{t("keyWithValues", Some(Js.Dict.fromList([("placeholder", "value")])))}
{t("keyWithNoInterpolation", None)}
I18next.toString(t("keyForStringParameter", None))
// t will already be in scope if initialized in root of project.
<Trans i18nKey="mykey" values=[("placeholder", "value")] />
Components
t, Trans
Contributions
All contributions are welcomed. I intend to merge and release anything you pull request quickly.
TODO
- bs-react-intl has similar bindings to learn from potentially as examples of how to extend functionality here.
- HOC and Component
- figure out how to not have to pass None to t if there are no values
LICENSE
MIT