From e226f6c95811275c1f34161d285ce038fb72b86b Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 10 Feb 2024 18:12:57 +0100 Subject: update docs about new lang display name feature --- doc/developer/language-pack.rst | 5 ++++- doc/developer/localize.rst | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/doc/developer/language-pack.rst b/doc/developer/language-pack.rst index 71cf9e8..ae6042d 100644 --- a/doc/developer/language-pack.rst +++ b/doc/developer/language-pack.rst @@ -86,7 +86,10 @@ translate them: .. code-block:: bash - cp -rv $FB_PATH/locale/en/html + cp -rv $FB_PATH/locale/en/html $PACK_PATH/fb_i18n_nl/locale/nl + +Don't forget to adjust the :file:`locale/.../DISPLAY_NAME` file to give your +language pack the correct human-readable representation. Translating & Compiling ----------------------- diff --git a/doc/developer/localize.rst b/doc/developer/localize.rst index 91a51eb..d33b22d 100644 --- a/doc/developer/localize.rst +++ b/doc/developer/localize.rst @@ -52,6 +52,11 @@ The :file:`justfile` (requires just_) contains a shortcut for this command: Creating a New Language ----------------------- +.. note:: + + Consider creating a :doc:`Language Pack ` instead, that way + you can update the translation independently of fietsboek development. + If you want to add a translation for a language that does not yet exist, first generate the ``.po`` file containing the messages using :program:`pybabel`: @@ -62,7 +67,7 @@ generate the ``.po`` file containing the messages using :program:`pybabel`: This will create the directory :file:`fietsboek/locale/{language}`. -Finally, you need to copy the non-gettext messages. This is best done by +Then, you need to copy the non-gettext messages. This is best done by copying over the english original texts: .. code:: bash @@ -70,6 +75,16 @@ copying over the english original texts: # Replace nl with the locale that you just generated cp -r fietsboek/locale/en/html fietsboek/locale/nl/ +Finally, you can adjust the name under which the language is shown by adjusting +the content of the :file:`DISPLAY_NAME` file in the locale's folder: + +.. code:: bash + + echo "Nederlands" > fietsboek/locale/nl/DISPLAY_NAME + +Note that this file should be UTF-8 encoded, and you can use country flag +emojies to add visual representations. + Again, there is a shortcut in the :file:`justfile` that does both steps: .. code:: bash -- cgit v1.2.3