From 3e72486966fda61f766c2d045ae10c0485ec2ddd Mon Sep 17 00:00:00 2001 From: Julie Pichon Date: Fri, 27 Jan 2017 11:57:58 +0000 Subject: [PATCH] Include information for translating ReactJS projects For projects set up for translation using the react-intl library. Change-Id: I2dfa62b178572c0859bfaf18462c69df3c98cbff Depends-On: If48e4ec58dfd51d8bbf7c89871e4e7c67d77142f --- doc/source/creators.rst | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/source/creators.rst b/doc/source/creators.rst index cfc074a..fcff201 100644 --- a/doc/source/creators.rst +++ b/doc/source/creators.rst @@ -1081,7 +1081,7 @@ are done by the i18n team, and they have to prioritize which projects to translate. First enable translation in your project, depending on whether it is a -Django project or a Python project. +Django project, a Python project or a ReactJS project. .. note:: @@ -1171,6 +1171,27 @@ Create file ``babel-djangojs.cfg`` with the following content: # that plugins are also translated. [angular: **/static/**.html] +ReactJS Projects +--------------- + +Three new dependencies are required : ``react-intl``, +``babel-plugin-react-intl``, and ``react-intl-po``. + +Update your ``package.json`` file. It should contain references to the +``json2pot`` and ``po2json`` commands. + +.. code-block:: javascript + + "scripts": { + ... + "json2pot": "rip json2pot ./i18n/extracted-messages/**/*.json -o ./i18n/messages.pot", + "po2json": "rip po2json -m ./i18n/extracted-messages/**/*.json" + } +}, + +The translated PO files will converted into JSON and placed into the +``./i18n/locales`` directory. + Add Translation Server Support ------------------------------