GithubHelp home page GithubHelp logo

isabella232 / bs-react-i18next Goto Github PK

View Code? Open in Web Editor NEW

This project forked from i18next/bs-react-i18next

0.0 0.0 0.0 2 KB

Bucklescript + ReasonReact binding for react-i18next components.

OCaml 100.00%

bs-react-i18next's Introduction

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 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.
<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

bs-react-i18next's People

Contributors

enalmada avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.