volto/i18n-improvements: Added documentation about update or add a new language
"Leonardo J. Caballero G" <jenkins-z4DKO/[email protected]> Sat, 14 Dec 2019 19:46:18 -0800 (PST)
| Newsgroups | gmane.comp.web.zope.plone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Repository: volto Branch: refs/heads/i18n-improvements Date: 2019-12-14T23:43:18-04:00 Author: Leonardo J. Caballero G (macagua) <[email protected]> Commit: https://github.com/plone/volto/commit/bda67277bb75742723cb895e7ac649a104ec731e Added documentation about update or add a new language Files changed: M README.md M docs/source/customizing/i18n.md b"diff --git a/README.md b/README.md\nindex afd65b1ba..980e4347f 100644\n--- a/README.md\n+++ b/README.md\n@@ -290,7 +290,8 @@ $ yarn ci:start-api-plone-guillotina\n \n ## Translations\n \n-You can contribute to translate Volto into severals languages at [Transifex.net](https://www.transifex.com/plone/plone5/volto-pot/).\n+If you would like contribute to translate Volto into several languages, please, read the [Internationalization (i18n) guide](https://docs.voltocms.com/customizing/i18n/).\n+\n \n ## License\n \ndiff --git a/docs/source/customizing/i18n.md b/docs/source/customizing/i18n.md\nindex 1a88dd28a..bd3b28f79 100644\n--- a/docs/source/customizing/i18n.md\n+++ b/docs/source/customizing/i18n.md\n@@ -2,7 +2,7 @@\n \n Internationalization (i18n) is the process of creating user interfa ces which are suitable for different languages and cultural contexts. \n Volto uses the library [react-intl](https://www.npmjs.com/package/react-intl) to provide translations for any potential language.\n-Anything you can read in the [official documentation of react-intl](https://github.com/formatjs/react-intl/blob/master/docs/README.md) also applies for Volto. \n+Anything you can read in the [official documentation of react-intl](https://github.com/formatjs/react-intl/blob/master/docs/README.md) also applies for Volto.\n \n However this section teaches you about the most common use cases relating to i18n you probably will have when developing your [own Add-on](add-ons.md) or contributing to the Volto core itself. \n \n@@ -24,24 +24,32 @@ This might look like this:\n $ tree locales/\n l ocales/\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 de\n-\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n-\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 de.json\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 en\n-\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n-\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 en.json\n+\xe2\x94\x9c\xe2\x94\x 80\xe2\x94\x80 es\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n+\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 es.json\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 it\n-\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n-\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 it.json\n+\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 ja\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n+\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 ja. json\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 nl\n-\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n-\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 LC_MESSAGES\n+\xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.po\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 nl.json\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 volto.pot\n \n-8 directories, 9 files\n+12 directories, 13 files\n ``` \n \n The file `volto.pot` holds all extracted i18n strings and acts as master template for all the `*.po` files.\n@@ -147,3 +155,60 @@ This script will combine the messages located in Volto itself and the current pr\n ## Contributing translations for a unsupported language\n \n The Volto project we lcomes all speakers from the world to include any language, which is not supported yet.\n+\n+You can contribute to translate Volto into severals languages at [Transifex.net](https://www.transifex.com/plone/plone5/volto-pot/).\n+\n+When you done your translation resource at Transifex.net, you need to add the locales files into Volto project, for that you need use [transifex-client](https://docs.transifex.com/client/introduction) tool and [install it](https://docs.transifex.com/client/installing-the-client).\n+\n+### Update language from Transifex\n+\n+To get translate the latest translation changes, you have to do the following steps:\n+\n+1. You can pull the latest changes for a specific language, for example **'de'** from **Transifex.net** for *Volto project*, by this command:\n+```sh\n +$ tx pull -f -l de\n+```\n+This will generate the following output:\n+```sh\n+tx INFO: Pulling translations for resource plone5.volto-pot (source: locales/volto.pot)\n+tx INFO: -> de: locales/de/LC_MESSAGES/volto.po\n+tx INFO: Done.\n+```\n+Also can pull the latest changes for all languages available at from **Transifex.net** for *Volto project*, by this command:\n+```sh\n+$ tx pull -f --all\n+```\n+2. You need updated the json file for the language updated from **Transifex.net** for *Volto project*, by this command:\n+```sh\n+$ yarn i18n\n+```\n+This command generate again the ``locales/de.json`` file updated, it is needed for Volto app.\n+3. Please, update the ``CHANGELOG.md`` file, make commits and push the changes via pull request at the repository.\n+\n+**Tip:** For more informati on about each command, use ``tx <command> --help``. As an example, to learn more about the ``tx pull`` command, run ``tx pull --help``.\n+\n+### Add new language from Transifex\n+\n+1. You should check what languages are available in **Transifex.net** to translate for the [Volto project](https://www.transifex.com/plone/plone5/volto-pot/). If the language to be translated does not exist, please [request it](https://docs.transifex.com/projects/adding-and-removing-project-languages). \n+2. You can pull the new language for example *Portuguese (Brazil)* aka **'pt_BR'** from **Transifex.net** for *Volto project*, by this command:\n+```sh\n+$ tx pull -f -l pt_BR\n+```\n+3. You new to modify the ``src/server.jsx`` file and add in the *'import section'* as the follow:\n+```\n+import ptBrLocale f rom '~/../locales/pt_BR.json';\n+```\n+Also you need define the new locale into *'locales const'* as the follow:\n+```\n+ pt: ptBrLocale,\n+```\n+4. You new to modify the ``src/constants/Languages.js`` file and add a new line at *'module.exports'* section as the follow:\n+```\n+ pt_BR: 'Portugu\xc3\xaas (Brasil)',\n+```\n+5. You need create the json file for the language created from **Transifex.net** for *Volto project*, by this command:\n+```sh\n+$ yarn i18n\n+```\n+This command generate the ``locales/pt_BR.json`` file, it is needed for Volto app.\n+6. Please, update the ``CHANGELOG.md`` file, make commits and push the changes via pull request at the repository.\n"