Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update doc translation #4000

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
37 changes: 31 additions & 6 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ env:

jobs:
doc:
name: Documentation
runs-on: ubuntu-latest
container:
image: python:3.8
env:
LANG: C.UTF-8
name: Doc structure
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-20.04']
python-version: ['3.8']

steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/python-cache-requirements
Expand All @@ -38,3 +39,27 @@ jobs:
run: |
cd docs/
make html SPHINXOPTS="-W"

- name: Check translations build
run: |
cd docs/
make gettext
rm ./_build/locale/changelog.pot
sphinx-intl update -l fr
sphinx-intl build
sphinx-build -b html -D language='fr' -d _build/doctrees . _build/html/fr

- name: Check missing translations
uses: tj-actions/verify-changed-files@v17
id: verify-changed-files
with:
files: |
**/*.po

- name: Check no translation file has changed
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
echo "Translation file(s) changed: ${{ steps.verify-changed-files.outputs.changed_files }}"
git diff
core.setFailed('Please update doc translation y running `make gettext` and `sphinx-intl update -l fr`, then fix or update translation, and commit the changes.')

3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ serve:
deps:
$(docker_compose) run --rm web bash -c "pip-compile -q && pip-compile -q dev-requirements.in && pip-compile -q docs/requirements.in"

doc_translations:
$(docker_compose) run --rm sphinx bash -c "make gettext && rm ./_build/locale/changelog.pot && sphinx-intl update -l fr"

flake8:
$(docker_compose) run --rm web flake8 geotrek

Expand Down
118 changes: 59 additions & 59 deletions docs/changelog.rst

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import sphinx_rtd_theme # noqa
import datetime
import os

root = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))

extensions = [
'sphinx.ext.todo',
Expand All @@ -23,10 +26,7 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '2.103'
# The full version, including alpha/beta/rc tags.
release = '2.103.2+dev'
release = open(os.path.join(root, "VERSION")).read()

exclude_patterns = ['_build']

Expand Down Expand Up @@ -61,3 +61,6 @@
'Makina Corpus', 'Geotrek', 'One line description of project.',
'Miscellaneous'),
]

locale_dirs = ['locale'] # path is example but recommended.
gettext_compact = False # optional.
6 changes: 3 additions & 3 deletions docs/contribute/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Check TODO in the source tree:
Pull requests
-------------

Before creating a pull request, ensure you follow thoses rules :
Before creating a pull request, ensure you follow those rules :

* Follow the guidelines of this page
* Self-review your code
Expand Down Expand Up @@ -103,12 +103,12 @@ Release

On master branch:

* Update files *VERSION*, *docs/conf.py* and *docs/changelog.rst* to remove ``+dev`` suffix and increment version (please use semver rules)
* Update files *VERSION* and *docs/changelog.rst* to remove ``+dev`` suffix and increment version (please use semver rules)
* Run ``dch -r -D RELEASED``, update version in the same way and save
* Commit with message 'Release x.y.z' and push to ``master``
* Create new release on Github, with tag X.Y.Z, click on "Generate release notes"
* Wait for release to be published through CI
* Update files *VERSION*, *docs/conf.py* and *docs/changelog.rst* to add ``+dev`` suffix
* Update files *VERSION* and *docs/changelog.rst* to add ``+dev`` suffix
* Run ``dch -v <version>+dev --no-force-save-on-release`` and save
* Commit with message 'Back to development' and push to ```master``

Expand Down
4 changes: 2 additions & 2 deletions docs/contribute/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Adding or upgrade dependencies

Consider using pip-tools to manage dependencies.

* add your dependency in setup.py for general dependency, dev-requirements.in for dev dependency, then run :
* add your dependency in setup.py for general dependency, dev-requirements.in for dev dependency, then run:

::

Expand All @@ -64,7 +64,7 @@ Model modification
docker-compose run --rm web ./manage.py makemigrations <appName>
docker-compose run --rm web ./manage.py migrate

.. note ::
.. note::

Add migration file to source control.

Expand Down
2 changes: 1 addition & 1 deletion docs/contribute/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ We use sphinx doc and sphinx-rtd-theme. Requirements are included.
A container based on sphinx image is created using docker-compose-dev.yml,
documentation is built in watch mode thanks to sphinx-autobuild.

To compile and test documentation on local environment, run :
To compile and test documentation on local environment, run:

.. code-block :: bash

Expand Down
4 changes: 2 additions & 2 deletions docs/contribute/translating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You could also choose language first
- Select the project to translate


Select a coponent to translate
Select a component to translate
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Select a component (a module or a piece of documentation)
Expand All @@ -80,7 +80,7 @@ Translation features
Weblate shows all translation by language and by module.
Errors and left to translate can be displayed easily.

Weblate can identify problematic translations as chains between projects, punctuation inconsistancy.
Weblate can identify problematic translations as chains between projects, punctuation inconsistency.

.. figure:: /images/translating/weblate-check.png
:alt: image
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Welcome to Geotrek's documentation!
===================================
Welcome to Geotrek-admin documentation!
=======================================

.. toctree::
:caption: 💡 About
Expand Down
Loading
Loading