An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

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