This uses react-intl@2.0.0-beta-2, which is still in beta, but is feature-complete and pretty close to a stable release.
Build step
bin/generate-html.js outputs a single html file to www. In a future patch this can be changed to output to multiple folders i.e. 1 per locale.
bin/generate-locale-data.js outputs a js file containing messages and react-intl locale-specific stuff such as pluralization functions. It attaches them to globals, i.e. window.reactIntlLocaleData and window.newTabLocaleInfo
Usage
Basic usage is as follows, where newtab-customize-cog-title2 is the key of a string:
This uses
react-intl@2.0.0-beta-2
, which is still in beta, but is feature-complete and pretty close to a stable release.Build step
bin/generate-html.js
outputs a single html file towww
. In a future patch this can be changed to output to multiple folders i.e. 1 per locale.bin/generate-locale-data.js
outputs a js file containing messages and react-intl locale-specific stuff such as pluralization functions. It attaches them to globals, i.e.window.reactIntlLocaleData
andwindow.newTabLocaleInfo
Usage
Basic usage is as follows, where
newtab-customize-cog-title2
is the key of a string:There are also components and functions for rendering plurals, numbers, currencies, etc.