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

[i18n] Add initial stubs for translating the docs #1360

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Update i18n
# Ensure that i18n files (for docs and website) are up to date
# with any changes to the source docs

on:
pull_request:
push:
branches:
- main

jobs:
update-i18n-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install deps
working-directory: docs
run: pip install -r requirements.txt

- name: Update .po files
working-directory: docs
run: make i18n

- name: Test for uncommitted changes
run: |
if [ -z "$(git status --porcelain)" ];
then
echo "No changes detected, translations are up to date!" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "Changes to .po files detected, please run `make i18n` to reflect changes to source text" >> $GITHUB_STEP_SUMMARY
echo "$(git status)"
echo "$(git diff)"
exit 1
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ latest.dump*
/yarn-error.log
yarn-debug.log*
.yarn-integrity

__pycache__
venv
3 changes: 3 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ help:

.PHONY: help Makefile

i18n:
@python ./update_i18n.py

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
Expand Down
11 changes: 11 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,14 @@
"linkify",
"strikethrough"
]

# -- Internationalization ----------------------------------------------------
locale_dirs = ['locale/']
gettext_uuid=True

# All languages to generate .po files for
languages = [
"es", # Spanish
"nb", # Norwegian
"pl", # Polish
]
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ JOSS is a proud affiliate of the `Open Source Initiative <https://opensource.org
:maxdepth: 2

installing
translating
Loading