Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork74
Enable theme translation#246
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
10 commits Select commitHold shift + click to select a range
c75ef67 Commit
StanFromIreland6377d64 Remove CI step
StanFromIreland9dede66 Fixup
StanFromIreland49f99d8 Apply suggestions from Maciek
StanFromIreland7c1c487 Fixup
StanFromIreland62f3a27 Merge remote-tracking branch 'origin/localize-theme' into localize-theme
StanFromIrelanda690993 Review
StanFromIreland9c017a1 Fixup
StanFromIreland151cfe9 Review
StanFromIrelandba7c178 Merge branch 'main' into localize-theme
StanFromIrelandFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions.github/workflows/pypi-package.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions.github/workflows/tests.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
33 changes: 22 additions & 11 deletionsbabel_runner.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| """Script for handling translations with Babel""" | ||
| from __future__ import annotations | ||
| import argparse | ||
| @@ -8,18 +8,18 @@ | ||
| import tomllib | ||
| from pathlib import Path | ||
| # Global variables used by pybabel below (paths relative to PROJECT_DIR) | ||
| DOMAIN = "python-docs-theme" | ||
| COPYRIGHT_HOLDER = "Python Software Foundation" | ||
| SOURCE_DIR = "python_docs_theme" | ||
StanFromIreland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| MAPPING_FILE = ".babel.cfg" | ||
| PROJECT_DIR = Path(__file__).resolve().parent | ||
| PYPROJECT_TOML = Path(PROJECT_DIR, "pyproject.toml") | ||
| INIT_PY = PROJECT_DIR / SOURCE_DIR / "__init__.py" | ||
| LOCALES_DIR = Path(f"{SOURCE_DIR}", "locale") | ||
| POT_FILE = Path(LOCALES_DIR, f"{DOMAIN}.pot") | ||
| def get_project_info() -> dict: | ||
| """Retrieve project's info to populate the message catalog template""" | ||
| @@ -75,21 +75,32 @@ def init_locale(locale: str) -> None: | ||
| if pofile.exists(): | ||
| print(f"There is already a message catalog for locale {locale}, skipping.") | ||
| return | ||
| cmd = [ | ||
| "pybabel", | ||
| "init", | ||
| "-i", | ||
| POT_FILE, | ||
| "-d", | ||
| LOCALES_DIR, | ||
| "-D", | ||
| DOMAIN, | ||
| "-l", | ||
| locale, | ||
| ] | ||
| subprocess.run(cmd, cwd=PROJECT_DIR, check=True) | ||
| def update_catalogs(locale: str) -> None: | ||
| """Update translations from existing message catalogs""" | ||
| cmd = ["pybabel", "update", "-i", POT_FILE, "-d", LOCALES_DIR, "-D", DOMAIN] | ||
| if locale: | ||
| cmd.extend(["-l", locale]) | ||
| subprocess.run(cmd, cwd=PROJECT_DIR, check=True) | ||
| def compile_catalogs(locale: str) -> None: | ||
| """Compile existing message catalogs""" | ||
| cmd = ["pybabel", "compile", "-d", LOCALES_DIR, "-D", DOMAIN] | ||
| if locale: | ||
| cmd.extend(["-l", locale]) | ||
| subprocess.run(cmd, cwd=PROJECT_DIR, check=True) | ||
11 changes: 11 additions & 0 deletionspython_docs_theme/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletionspython_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| # Polish (Poland) translations for python-docs-theme. | ||
| # Copyright (C) 2025 Python Software Foundation | ||
| # This file is distributed under the same license as the python-docs-theme | ||
| # project. | ||
| # Stan Ulbrych, 2025. | ||
| # | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: python-docs-theme 2025.5\n" | ||
| "Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n" | ||
| "POT-Creation-Date: 2025-08-07 19:09+0200\n" | ||
| "PO-Revision-Date: 2025-08-07 15:11+0200\n" | ||
| "Last-Translator: Stan Ulbrych \n" | ||
| "Language: pl\n" | ||
| "Language-Team: pl <LL@li.org>\n" | ||
| "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && " | ||
| "(n%100<10 || n%100>=20) ? 1 : 2);\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=utf-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "Generated-By: Babel 2.16.0\n" | ||
| #: python_docs_theme/footerdonate.html:1 | ||
| msgid "The Python Software Foundation is a non-profit corporation." | ||
| msgstr "Python Software Foundation jest organizacją non-profit." | ||
| #: python_docs_theme/footerdonate.html:2 | ||
| msgid "Please donate." | ||
| msgstr "Prosimy o wsparcie." | ||
| #: python_docs_theme/layout.html:6 | ||
| msgid "Navigation" | ||
| msgstr "Nawigacja" | ||
| #: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111 | ||
| msgid "Quick search" | ||
| msgstr "Szybkie wyszukiwanie" | ||
| #: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112 | ||
| msgid "Go" | ||
| msgstr "Szukaj" | ||
| #: python_docs_theme/layout.html:60 | ||
| msgid "Theme" | ||
| msgstr "Motyw" | ||
| #: python_docs_theme/layout.html:62 | ||
| msgid "Auto" | ||
| msgstr "auto" | ||
| #: python_docs_theme/layout.html:63 | ||
| msgid "Light" | ||
| msgstr "jasny" | ||
| #: python_docs_theme/layout.html:64 | ||
| msgid "Dark" | ||
| msgstr "ciemny" | ||
| #: python_docs_theme/layout.html:96 | ||
| msgid "Menu" | ||
| msgstr "Menu" | ||
| #: python_docs_theme/layout.html:142 | ||
| msgid "Copyright" | ||
| msgstr "Prawa autorskie" | ||
| #: python_docs_theme/layout.html:147 | ||
| msgid "" | ||
| "This page is licensed under the Python Software Foundation License " | ||
| "Version 2." | ||
| msgstr "" | ||
| "Ta strona jest objęta licencją Python Software " | ||
| "Foundation w wersji 2." | ||
| #: python_docs_theme/layout.html:149 | ||
| msgid "" | ||
| "Examples, recipes, and other code in the documentation are additionally " | ||
| "licensed under the Zero Clause BSD License." | ||
| msgstr "" | ||
| "Przykłady, przepisy i inny kod w dokumentacji są dodatkowo objęte " | ||
| "licencją Zero Clause BSD." | ||
| #: python_docs_theme/layout.html:152 | ||
| #, python-format | ||
| msgid "" | ||
| "See <a href=\"%(license_file)s\">History and License</a> for more " | ||
| "information." | ||
| msgstr "" | ||
| "Zobacz <a href=\"%(license_file)s\">Historię i licencję</a> aby uzyskać " | ||
| "więcej informacji." | ||
| #: python_docs_theme/layout.html:155 | ||
| #, python-format | ||
| msgid "Hosted on %(hosted_on)s." | ||
| msgstr "Hostowane na %(hosted_on)s." | ||
| #: python_docs_theme/layout.html:163 | ||
| #, python-format | ||
| msgid "Last updated on %(last_updated)s." | ||
| msgstr "Ostatnia aktualizacja %(last_updated)s." | ||
| #: python_docs_theme/layout.html:166 | ||
| #, python-format | ||
| msgid "<a href=\"%(theme_issues_url)s\">Found a bug</a>?" | ||
| msgstr "<a href=\"%(theme_issues_url)s\">Znalazłeś(-aś) błąd</a>?" | ||
| #: python_docs_theme/layout.html:170 | ||
| #, python-format | ||
| msgid "" | ||
| "Created using <a href=\"https://www.sphinx-doc.org/\">Sphinx</a> " | ||
| "%(sphinx_version)s." | ||
| msgstr "" | ||
| "Stworzone za pomocą <a href=\"https://www.sphinx-doc.org/\">Sphinx</a> " | ||
| "%(sphinx_version)s." | ||
| #: python_docs_theme/static/copybutton.js:30 | ||
| #: python_docs_theme/static/copybutton.js:55 | ||
| msgid "Copy" | ||
| msgstr "Kopiuj" | ||
| #: python_docs_theme/static/copybutton.js:31 | ||
| msgid "Copy to clipboard" | ||
| msgstr "Skopiuj do schowka" | ||
| #: python_docs_theme/static/copybutton.js:53 | ||
| msgid "Copied!" | ||
| msgstr "Skopiowano!" |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.