From a8254d4add4f04c68192f404e1023e29fdf72360 Mon Sep 17 00:00:00 2001 From: Felipe Moreno Date: Sat, 23 May 2026 12:34:26 -0700 Subject: [PATCH 1/5] removed duplication from build-all-languages that caused translations to be built twice --- noxfile.py | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/noxfile.py b/noxfile.py index c17b6e3ab..41b440f86 100644 --- a/noxfile.py +++ b/noxfile.py @@ -33,7 +33,13 @@ # Sphinx parameters used when checking that links work # ref: https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder -LINKCHECK_PARAMETERS = ["-b", "linkcheck", "-Dlinkcheck_timeout=5", "-Dlinkcheck_rate_limit_timeout=30", "--fail-on-warning"] +LINKCHECK_PARAMETERS = [ + "-b", + "linkcheck", + "-Dlinkcheck_timeout=5", + "-Dlinkcheck_rate_limit_timeout=30", + "--fail-on-warning", +] LINKCHECK_OUTPUT_DIR = pathlib.Path(BUILD_DIR, "linkcheck_output") # Sphinx parameters used to test the build of the guide @@ -384,6 +390,18 @@ def build_all_languages(session): session.warn("No languages defined in LANGUAGES") return session.install("-e", ".") + session.log(f"Declared languages: {LANGUAGES}") + session.log(f"Release languages: {RELEASE_LANGUAGES}") + sphinx_env = _sphinx_env(session) + # if running from the docs or docs-test sessions, build only release languages + BUILD_LANGUAGES = RELEASE_LANGUAGES if sphinx_env == "production" else LANGUAGES + # only build languages that have a locale folder + BUILD_LANGUAGES = [ + lang for lang in BUILD_LANGUAGES if (TRANSLATION_LOCALES_DIR / lang).exists() + ] + session.log( + f"Building languages{' for release' if sphinx_env == 'production' else ''}: {BUILD_LANGUAGES}" + ) for lang in LANGUAGES: session.log(f"Building [{lang}] guide") session.run( @@ -396,25 +414,6 @@ def build_all_languages(session): *session.posargs, ) session.log(f"Translations built for {LANGUAGES}") - sphinx_env = _sphinx_env(session) - - # if running from the docs or docs-test sessions, build only release languages - BUILD_LANGUAGES = RELEASE_LANGUAGES if sphinx_env == "production" else LANGUAGES - # only build languages that have a locale folder - BUILD_LANGUAGES = [ - lang for lang in BUILD_LANGUAGES if (TRANSLATION_LOCALES_DIR / lang).exists() - ] - session.log(f"Declared languages: {LANGUAGES}") - session.log(f"Release languages: {RELEASE_LANGUAGES}") - session.log( - f"Building languages{' for release' if sphinx_env == 'production' else ''}: {BUILD_LANGUAGES}" - ) - if not BUILD_LANGUAGES: - session.warn("No translations to build") - else: - session.notify( - "build-languages", [sphinx_env, BUILD_LANGUAGES, *session.posargs] - ) @nox.session(name="build-all-languages-test") From 5dc8ea3410ef7073d91e7336a42a04a9843c37dd Mon Sep 17 00:00:00 2001 From: Felipe Moreno Date: Sat, 23 May 2026 12:34:43 -0700 Subject: [PATCH 2/5] enabled ES and PT translations --- conf.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/conf.py b/conf.py index ffc4e2deb..193e33fec 100644 --- a/conf.py +++ b/conf.py @@ -12,11 +12,13 @@ # import os import sys -sys.path.insert(0, os.path.abspath('.')) -from datetime import datetime -import subprocess + +sys.path.insert(0, os.path.abspath(".")) import os +import subprocess +from datetime import datetime from typing import TYPE_CHECKING + from _ext import rss if TYPE_CHECKING: @@ -45,7 +47,7 @@ languages = ["es", "ja", "pt"] # the languages that will be included in a production build # (also excluding english) -release_languages = ["ja"] +release_languages = ["es", "ja", "pt"] # languages that will be included in the language dropdown # (ie. all that are being built in this nox build session) @@ -146,7 +148,7 @@ "github_url": "https://github.com/pyopensci/python-package-guide", "footer_start": ["code_of_conduct", "copyright"], "footer_end": [], - "navbar_persistent": ["language-selector", "search-button"] + "navbar_persistent": ["language-selector", "search-button"], } html_context = { @@ -182,7 +184,7 @@ "venv", "env", "LICENSE.rst", - "SECURITY.md" + "SECURITY.md", ] # For sitemap generation @@ -228,6 +230,7 @@ r"https:\/\/discord\.gg/NQtTTqtv", ] + def _post_build(app: "Sphinx", exception: Exception | None) -> None: rss.generate_tutorials_feed(app) From ab0c66717cf979872dced802eea1179917f23719 Mon Sep 17 00:00:00 2001 From: Felipe Moreno Date: Mon, 25 May 2026 09:45:16 -0700 Subject: [PATCH 3/5] various fixes in the Spanish translation --- locales/es/LC_MESSAGES/documentation.po | 9 ++++----- locales/es/LC_MESSAGES/tutorials.po | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/locales/es/LC_MESSAGES/documentation.po b/locales/es/LC_MESSAGES/documentation.po index 4ffa68bbe..50eb41970 100644 --- a/locales/es/LC_MESSAGES/documentation.po +++ b/locales/es/LC_MESSAGES/documentation.po @@ -42,7 +42,7 @@ msgstr "" #: ../../documentation/glossary.md:6 msgid "API token" -msgstr "" +msgstr "token de API" #: ../../documentation/glossary.md:19 msgid "" @@ -108,7 +108,7 @@ msgstr "" #: ../../documentation/glossary.md:37 msgid "Python package" -msgstr "" +msgstr "paquete de Python" #: ../../documentation/glossary.md:50 msgid "" @@ -483,9 +483,8 @@ msgid "Documentation" msgstr "Resumen de la Documentación" #: ../../documentation/glossary.md -#, fuzzy msgid "Code of conduct" -msgstr "Archivo de Código de Conducta" +msgstr "código de conducta" #: ../../documentation/glossary.md:232 msgid "" @@ -2864,7 +2863,7 @@ msgstr "" #: ../../documentation/repository-files/readme-file-best-practices.md:157 msgid "Your code of conduct" -msgstr "" +msgstr "Tu código de conducta" #: ../../documentation/repository-files/readme-file-best-practices.md:158 msgid "Licensing information" diff --git a/locales/es/LC_MESSAGES/tutorials.po b/locales/es/LC_MESSAGES/tutorials.po index 7698e2b9b..6399ed883 100644 --- a/locales/es/LC_MESSAGES/tutorials.po +++ b/locales/es/LC_MESSAGES/tutorials.po @@ -1192,7 +1192,8 @@ msgstr "" "**Qué son estas tablas:** Estas tablas resumen los comandos de línea de comandos " "(por ejemplo, `pipx install hatch`, `hatch build` o `python -m build`) necesarios " "para completar todos los pasos del proceso de creación de un paquete, desde la " -"instalación de Hatch hasta la publicación del paquete en PyPI y conda-forge." +"instalación de [Hatch](get-to-know-hatch) hasta la publicación del paquete en [PyPI" +"](publish-pypi) y conda-forge." #: ../../tutorials/command-line-reference.md:14 @@ -2870,7 +2871,7 @@ msgstr "" #: ../../tutorials/intro.md:53 msgid "Add a license & code of conduct" -msgstr "" +msgstr "Añadir una licencia y un código de conducta" #: ../../tutorials/intro.md:53 msgid "Update metadata in pyproject.toml" From 4e2d93eca4d0ef3b35b658fa1da83afc4e35d306 Mon Sep 17 00:00:00 2001 From: Felipe Moreno Date: Mon, 25 May 2026 09:45:41 -0700 Subject: [PATCH 4/5] various fixes in the Portuguese translation --- locales/pt/LC_MESSAGES/documentation.po | 4 ++-- locales/pt/LC_MESSAGES/index.po | 4 ++-- locales/pt/LC_MESSAGES/tutorials.po | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/locales/pt/LC_MESSAGES/documentation.po b/locales/pt/LC_MESSAGES/documentation.po index cee9fc7ee..0b501bdd2 100644 --- a/locales/pt/LC_MESSAGES/documentation.po +++ b/locales/pt/LC_MESSAGES/documentation.po @@ -480,7 +480,7 @@ msgstr "" #: ../../documentation/glossary.md msgid "Code of conduct" -msgstr "" +msgstr "código de conduta" #: ../../documentation/glossary.md:232 msgid "" @@ -2555,7 +2555,7 @@ msgstr "" #: ../../documentation/repository-files/readme-file-best-practices.md:157 msgid "Your code of conduct" -msgstr "" +msgstr "Seu código de conduta" #: ../../documentation/repository-files/readme-file-best-practices.md:158 msgid "Licensing information" diff --git a/locales/pt/LC_MESSAGES/index.po b/locales/pt/LC_MESSAGES/index.po index 241b85bee..11bba953a 100644 --- a/locales/pt/LC_MESSAGES/index.po +++ b/locales/pt/LC_MESSAGES/index.po @@ -195,7 +195,7 @@ msgstr "[O que é um pacote Python?](/tutorials/intro)" #: ../../index.md:73 msgid "[Create a Python package](/tutorials/create-python-package)" -msgstr "Crie um pacote Python" +msgstr "[Crie um pacote Python](/tutorials/create-python-package)" #: ../../index.md:74 msgid "[Publish your package to (test) PyPI](/tutorials/publish-pypi)" @@ -380,7 +380,7 @@ msgid "" "[Set norms with a Code of Conduct](/documentation/repository-files/code-" "of-conduct-file)" msgstr "" -"[Defina normas com um Código de Conduta](/documentation/repository-files/code-of-conduct-file)" +"[Defina normas com um Código de conduta](/documentation/repository-files/code-of-conduct-file)" #: ../../index.md:162 msgid "[License your package](/documentation/repository-files/license-files)" diff --git a/locales/pt/LC_MESSAGES/tutorials.po b/locales/pt/LC_MESSAGES/tutorials.po index f247368b3..3568a33f6 100644 --- a/locales/pt/LC_MESSAGES/tutorials.po +++ b/locales/pt/LC_MESSAGES/tutorials.po @@ -349,6 +349,8 @@ msgid "" "A `CODE_OF_CONDUCT` file is a {term}`Code of conduct` used to establish " "guidelines for how people in your community interact." msgstr "" +"Um arquivo CODE_OF_CONDUCT é um {term}`código de conduta` usado para estabelecer" +"diretrizes sobre como as pessoas em sua comunidade interagem." #: ../../tutorials/add-license-coc.md:152 msgid "" @@ -2600,7 +2602,7 @@ msgstr "" #: ../../tutorials/intro.md:53 msgid "Add a license & code of conduct" -msgstr "" +msgstr "Adicionar uma licença e um código de conduta" #: ../../tutorials/intro.md:53 msgid "Update metadata in pyproject.toml" From 16784cfe0ae095e17b676bc8f3d75f4d6c43e20a Mon Sep 17 00:00:00 2001 From: Felipe Moreno Date: Mon, 25 May 2026 09:49:32 -0700 Subject: [PATCH 5/5] disable inconsistent reference warnings for translations --- conf.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index 193e33fec..42290896d 100644 --- a/conf.py +++ b/conf.py @@ -213,7 +213,15 @@ # Bibliographies bibtex_bibfiles = ["bibliography.bib"] # myst complains about bibtex footnotes because of render order -suppress_warnings = ["myst.footnote"] +suppress_warnings = [ + "myst.footnote", + # Suppress false positives for translated :term: references. When a + # translator correctly translates a glossary term in the target language + # (e.g. "Code of conduct" to "código de conducta"), Sphinx still warns + # because it is different from the English original, despite the fact that + # the translated term is properly defined in the glossary. + "i18n.inconsistent_references", +] # -- Options for linkcheck -------------------------------------------------