https://github.com/i18next/bs-react-i18next
Bucklescript + ReasonReact binding for react-i18next components.
https://github.com/i18next/bs-react-i18next
Last synced: 11 months ago
JSON representation
Bucklescript + ReasonReact binding for react-i18next components.
- Host: GitHub
- URL: https://github.com/i18next/bs-react-i18next
- Owner: i18next
- Created: 2018-10-29T19:17:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-30T17:57:26.000Z (about 7 years ago)
- Last Synced: 2025-01-08T09:14:00.233Z (about 1 year ago)
- Language: OCaml
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-list - bs-react-i18next - i18next components. | i18next | 1 | (OCaml)
README
# bs-react-i18next
## Introduction
Bucklescript + ReasonReact binding for [react-i18next](https://github.com/i18next/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](https://github.com/thangngoc89/bs-ant-design) repo for credit on binding pattern.
## Installation
```
npm install --save bs-react-i18next
```
* Add `bs-react-i18next` to `bs-dependencies` in `bsconfig.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.
```
## Components
t, Trans
## Contributions
All contributions are welcomed. I intend to merge and release anything you pull request quickly.
## TODO
- [bs-react-intl](https://github.com/alexfedoseev/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