internationalization.rst 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. Internationalization and Localization
  2. =====================================
  3. This section describes the various elements at play to create localized strings for
  4. JupyterLab.
  5. Four elements are used to handle the internationalization of JupyterLab:
  6. - `language-packs <https://github.com/jupyterlab/language-packs>`_ repository: It contains
  7. the source strings, their translations, the language packs and the GitHub workflows to
  8. update and publish the translations.
  9. - `Crowdin project <https://crowdin.com/project/jupyterlab>`_: Crowdin is the cloud-based solution
  10. that streamlines localization management for JupyterLab. This is the place where contributors
  11. can translate JupyterLab strings.
  12. - `jupyterlab-translate <https://github.com/jupyterlab/jupyterlab-translate>`_ repository: Python
  13. library defining helpers to deal with internationalization (e.g. extracting the strings).
  14. - `Cookiecutter template <https://github.com/jupyterlab/language-pack-cookiecutter>`_ repository: It
  15. defines the Python package template of a language pack.
  16. The *language-packs* repository is the main entry point. It interacts with Crowdin to publish
  17. newer source strings and get the latest translation. It also creates and updates the language packs.
  18. And finally it publishes them. All those actions are carried out using helpers defined in
  19. ``jupyterlab-translate`` and the cookiecutter template.
  20. Workflows
  21. ---------
  22. The workflows at play will be described next, in the order they are usually called.
  23. .. note::
  24. Automatic tasks are carried out through the *jupyterlab-bot*. To do that, that bot has
  25. access to the GitHub repository, the Crowdin project and all language packs projects on
  26. `PyPI <https://www.pypi.org>`_.
  27. Source strings generation
  28. ^^^^^^^^^^^^^^^^^^^^^^^^^
  29. Source strings are extracted for JupyterLab and a list of extensions at a given version defined
  30. in `repository-map.yaml <https://github.com/jupyterlab/language-packs/blob/master/repository-map.yml>`_
  31. file in *language-packs* repository. The workflow to trigger an update is as follow:
  32. 1. Edit ``repository-map.yaml`` by adding new repositories and/or updating the target version.
  33. 2. Push the change in a pull request.
  34. 3. Once the pull request is merged, the workflow `Update source strings <https://github.com/jupyterlab/language-packs/blob/master/.github/workflows/update_pot.yml>`_ will automatically be triggered.
  35. 4. That workflow will open a new pull request that will update the source strings and optionally the Crowdin configuration.
  36. 5. Once that pull request is merged, Crowdin will upload the new source strings automatically.
  37. 6. If the placement of strings in the user interface changed (or new interface components were added) consider preparing new screenshots for Crowdin (see note below) and either
  38. upload them directly to Crowdin (filename should include the version number), or open an issue in the `language-packs <https://github.com/jupyterlab/language-packs>`_ repository.
  39. .. note::
  40. Translating on Crowdin can be difficult when no sufficient context information is present, especially for Jupyter-specific terms.
  41. While some technically skilled translators will navigate to the codebase to check the context of a string, it is not an efficient workflow
  42. and prevents other translators from contributing. To enable more translators to contribute, and achieve higher accuracy of translations
  43. we should provide translators with annotated screenshots of the relevant usage of specific translatable strings
  44. (see `Crowdin guide on screenshots <https://support.crowdin.com/adding-screenshots/>`_).
  45. .. note::
  46. Crowdin is uploading automatically its source strings using `GitHub Integration <https://support.crowdin.com/github-integration/>`_ set up
  47. with the Crowdin account of *jupyterlab-bot*.
  48. The script used for this workflow is `02_update_catalogs.py <https://github.com/jupyterlab/language-packs/blob/master/scripts/02_update_catalogs.py>`_.
  49. Translation update
  50. ^^^^^^^^^^^^^^^^^^
  51. The new and/or updated translation are automatically pushed to the *language-packs* repository.
  52. The workflow is as follow:
  53. 1. A contributor updates the translation on JupyterLab Crowdin project
  54. 2. A new commit with those changes is pushed to the *language-packs* repository on a branch named
  55. ``l10n_master``.
  56. 3. If there is no pull request associated with that branch, a new pull request will be opened.
  57. 4. A maintainer needs to merge that pull request.
  58. .. note::
  59. Crowdin is automatically uploading the translation using `GitHub Integration <https://support.crowdin.com/github-integration/>`_ set up
  60. with the Crowdin account of *jupyterlab-bot*. Hence the commits and pull request is attributed
  61. to the bot.
  62. If the branch is deleted, it will be re-created.
  63. .. warning::
  64. To avoid merge conflicts on those translation update pull requests, they should be merged before
  65. any ``repository-map.yaml`` pull requests as those will update the source strings. If not, the pull
  66. requests updating the source strings need to be closed in order for the Crowdin integration to
  67. re-open the PR.
  68. Language packs update
  69. ^^^^^^^^^^^^^^^^^^^^^
  70. Before a release of updated language packs with new translations from Crowdin the language packs need to be prepared by updating the version strings of all packages.
  71. This is done by manually triggering the `Prepare language packs for release <https://github.com/jupyterlab/language-packs/blob/master/.github/workflows/prepare_release.yml>`_ workflow.
  72. There is one optional setting:
  73. - The new version in form *X.Y.postZ* - if not provided, the post number will be bumped.
  74. .. image:: prep_language_packs.png
  75. The workflow is:
  76. 1. Trigger the manual *Prepare language packs for release* workflow
  77. 2. That workflow will open a new pull request with the changes to the language packs
  78. 3. The validation workflow `Check language packs version <https://github.com/jupyterlab/language-packs/blob/master/.github/workflows/check_version.yml>`_ should pass on that pull request
  79. 4. A maintainer needs to merge the pull request
  80. .. note::
  81. The version policy for the language packs is to follow major and minor version numbers of
  82. JupyterLab and bumping the post number for any intermediate updates. The version
  83. of all language packs is identical to ease maintenance.
  84. The script used for this workflow is `03_prepare_release.py <https://github.com/jupyterlab/language-packs/blob/master/scripts/03_prepare_release.py>`_.
  85. Language packs publication
  86. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  87. Each time a ``.bumpversion.cfg`` in any *language packs* is modified the `Create Release and publish packages <https://github.com/jupyterlab/language-packs/blob/master/.github/workflows/release_publish.yml>`_
  88. will be automatically triggered. Its steps are:
  89. 1. Check that all language packs have identical versions
  90. 2. Start a matrix of job (one for each language pack)
  91. 1. Build the source and wheel artifacts
  92. 2. Create a GitHub release with tag *<locale>@v<version>*
  93. 3. Publish the artifacts to PyPI
  94. .. note::
  95. Publication is done using jupyterlab-bot credentials on all PyPI projects.
  96. `Conda recipe <https://github.com/conda-forge/jupyterlab-language-packs-feedstock>`_ should be updated by the auto-tick bot of conda-forge.