A JavaScript Internationalization Framework
Clone or download
Peter van der Zee and facebook-github-bot Fix adding jsx expression children in fbt
Summary:
The fbt plugin supports `<fbt>...</fbt>` syntax and will transform these all the same. However, when the remainder of the jsx is not transformed it leaves it in a bad state;

```
<div><fbt>hi</fbt></div>
->
<div>fbt._("hi")</div>
```

Where it should be

```
<div>{fbt._("hi")}</div>
```

Reviewed By: motiz88

Differential Revision: D13750092

fbshipit-source-id: 79a3f2dcdefc07749ecaf45da0a5a0907cb4a5a1
Latest commit 79e76d6 Jan 21, 2019

README.md

FBT is an internationalization framework for JavaScript designed to be both powerful and flexible, but also simple and intuitive. It helps with the following:

  • Organizing your source text for translation
  • Composing grammatically correct translatable UI
  • Eliminating verbose boilerplate for generating UI

Examples

See our demo here

Requirements

Building fbt

git clone git@github.com:facebookincubator/fbt.git
cd fbt
yarn install

Installing fbt

We will make the transform and runtime installable as an npm package soon. Until then, See how to use the source directly with Babel and Webpack in our demo-app:

cd demo-app # from fbt repo
yarn install
yarn manifest
yarn collect-fbts
yarn translate-fbts
yarn start

How FBT works

FBT works by transforming your <fbt> and fbt(...) constructs via Babel plugins. These plugins serve to extract strings from source and lookup translate payloads generated at build-time. FBT creates tables of all possible variations for the given fbt phrase and accesses this at runtime.

Full documentation

https://facebookincubator.github.io/fbt

Join the fbt community

See the CONTRIBUTING file for how to help out.

License

FBT is MIT licensed, as found in the LICENSE file.