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

docs: change update translation sessions in nox #398

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

flpm
Copy link
Member

@flpm flpm commented Aug 27, 2024

What was done

Following the discussion in PR #397, this PR makes the following changes:

  • Modify the update-translations session to only update translation files for languages in RELEASE_LANGUAGES.
  • Added a new nox session update-langugage that can be used to update the translation files for a specific language.

This PR also fixes a small syntax issue in the documentation.po file for the Spanish translation (missing quote).

How to test

Run nox -s update-translations and confirm in the output that no languages are updated

❯ nox -s update-translations
nox > Running session update-translations
nox > Re-using existing virtual environment at .nox/update-translations.
nox > No release languages defined in RELEASE_LANGUAGES
nox > Session update-translations was successful.

Run nox -s update-language -- es and verify that the .po files for the Spanish translation are updated

❯ nox -s update-language -- es
(... some lines removed ...)
The message catalogs are in _build/gettext.
nox > Updating .po files for [es] translation
nox > sphinx-intl update -p _build/gettext -l es
Update: locales/es/LC_MESSAGES/tests.po +1, -1
Update: locales/es/LC_MESSAGES/documentation.po +1, -1
Update: locales/es/LC_MESSAGES/index.po +2, -2
Update: locales/es/LC_MESSAGES/tutorials.po +41, -19
Update: locales/es/LC_MESSAGES/TRANSLATING.po +2, -2
Update: locales/es/LC_MESSAGES/CONTRIBUTING.po +68, -15
Update: locales/es/LC_MESSAGES/package-structure-code.po +18, -18
nox > Session update-language was successful.

@flpm flpm added the translations Translation and localization of content label Aug 27, 2024
@sneakers-the-rat
Copy link
Contributor

minor thing: i wonder if we can pick one term to refer to a translation or language? currently we have something like this

update
build
single
`update_language`
`build_languages`
multi
`update_translations`
`build_translations`

i don't have a strong preference between four sessions vs two sessions s.t. with no arguments they build/update all languages but with an argument only update a single language (or only the released langs, etc), but i think in either case it would be good to pick either language or translation to refer to them

@flpm
Copy link
Member Author

flpm commented Aug 27, 2024

minor thing: i wonder if we can pick one term to refer to a translation or language?

Good point, that makes sense, maybe "languages" is more semantically correct?

@flpm
Copy link
Member Author

flpm commented Aug 29, 2024

I did a bit of reorganization of the nox sessions related to translations, to harmonize the names. I also simplified it a bit, to remove the internal build to release variable.

Here is the proposed setup:

  • update-language: Update the PO files for a single language passed as a positional argument from the command line. E.g. nox -s update-language -- es. To be used by the language teams during early stages of the translation.
  • update-all-languages: Update the PO files for all languages in LANGUAGES. To be used in dev, for tests.
  • update-all-release-languages: Update the PO files for all languages in RELEASE_LANGUAGES. To be used in CI to keep PO files updated (see PR [ci] Ensure i18n up to date #397)
  • build-language: Build the guide in a single language passed as a positional argument from the command line. E.g. nox -s build-language -- es. To be used in dev.
  • build-all-languages: Build the guide for all languages in LANGUAGES. To be used in dev, for tests.
  • build-all-release-languages: Build the guide for all languages in RELEASE_LANGUAGES. Called by the docs-test nox session, which is used in CI to build the guide for release.
  • build-all-languages-test: A convenience function to run build-all-languages using the same parameters that docs-test used.

Copy link
Contributor

@sneakers-the-rat sneakers-the-rat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it - good with me :)

as an aside, since i'm not asking you to fix nox in this PR - the only thing i wish is that nox had a bit of a better way of sharing venvs, because each of these will make their own venv which makes things big and slow. making each of the sessions independent (rather than using notify) i think makes them tidier and easier to read than notify and posargs, which i like tho, so it's an improvement imo :)

@tkoyama010
Copy link
Member

Thanks @flpm !

@tkoyama010 tkoyama010 changed the title Change update translation sessions in nox docs: change update translation sessions in nox Aug 29, 2024
@sneakers-the-rat
Copy link
Contributor

Wondering if we can merge this? i gave approval but i guess i don't have the right permissions or role or w/e to overcome the merge block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
translations Translation and localization of content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants