Skip to content

Commit

Permalink
Merge pull request #4486 from GeotrekCE/mfu-add-doc-infos
Browse files Browse the repository at this point in the history
[DOC]  Add new info about adding languages
  • Loading branch information
bruhnild authored Feb 5, 2025
2 parents c39231a + 0c1bcfc commit e68eb29
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ CHANGELOG

- Add clean and flush make command to init data in development mode

**Documentation**

- Update documentation theme and content, re-organize sections (#4484)
- Add infos about adding new languages (#4486)

2.113.0 (2025-01-30)
----------------------------
Expand Down
25 changes: 25 additions & 0 deletions docs/installation-and-configuration/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,31 @@ Languages of your project. It will be used to generate fields for translations.
.. note::
It is preferable, when in doubt, to include all necessary languages during the initial installation, even if some remain unused afterward, rather than missing some and facing complications to add them later.

Adding a new language
~~~~~~~~~~~~~~~~~~~~~

.. note::

When adding a new language to Geotrek, you must define default values for translated fields that are not ``NULLABLE``. The ``MODELTRANSLATION_LANGUAGES`` command used to generate translated fields does not automatically assign these values.

For example, if you add the German language (``de``) and need to add the ``published_de`` field (indicating whether content is published in German), you must set a default value.

To ensure the database functions correctly after adding a new language, execute the following SQL queries for each affected model:

.. code-block:: sql
ALTER TABLE infrastructure_infrastructure ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE signage_signage ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE trekking_trek ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE trekking_poi ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE tourism_touristiccontent ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE tourism_touristicevent ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE flatpages_flatpage ADD COLUMN published_de boolean NOT NULL DEFAULT False;
.. info::

Ensure that all tables containing translated fields include this column before running the ``MODELTRANSLATION_LANGUAGES`` command._

Spatial extents
----------------

Expand Down

0 comments on commit e68eb29

Please sign in to comment.