Skip to content

Commit

Permalink
suggestions from github pr 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul committed Aug 22, 2021
1 parent 96d3f29 commit 6da0ec3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions babel-mapping.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.i18n,jinja2.ext.autoescape,jinja2.ext.with_
32 changes: 32 additions & 0 deletions docs/source/language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,38 @@ those values will be returned. However, if a `fr-CH` tag can also be found, that

.. todo:: Add docs on HTML templating.

Translator guide
----------------

Hardcoded strings in pygeoapi templates are translated using the Babel translation system.
Translation files are stored on the /locale folder.
Translators can follow these steps to prepare their environment for translations.


1. Extract from latest code the keys to be translated. These keys are captured in a .pot file.

.. code-block:: bash
pybabel extract -F babel-mapping.ini -o locale/messages.pot ./
2. Update the existing .po language file:

.. code-block:: bash
pybabel update -d locale -l fr -i locale/messages.pot
3. Open the relevant .po file and contribute your translations. Then compile a .mo file to be used by the application:

.. code-block:: bash
pybabel compile -d locale -l fr
Within jinja templates keys are prepared to be translated by wrapping them in:

.. code-block:: python
{% trans %}Key{% endtrans %}
Developer guide
---------------
Expand Down
File renamed without changes.

0 comments on commit 6da0ec3

Please sign in to comment.