Skip to content

Commit c75ef67

Browse files
Commit
1 parent 8e36158 commit c75ef67

File tree

7 files changed

+146
-8
lines changed

7 files changed

+146
-8
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
pip install -r requirements.txt
7272
- name: Remove locale file for testing
7373
shell: bash
74-
run: rm -rf locales/pt_BR/
74+
run: rm -rf python_docs_theme/locales/pt_BR/
7575
- run: python babel_runner.py extract
7676
- run: python babel_runner.py init -l pt_BR
7777
- run: python babel_runner.py update
@@ -80,10 +80,10 @@ jobs:
8080
- run: python babel_runner.py compile -l pt_BR
8181
- name: Print .pot file
8282
shell: bash
83-
run: cat locales/messages.pot
83+
run: cat python_docs_theme/locales/messages.pot
8484
- name: Print .po file
8585
shell: bash
86-
run: cat locales/pt_BR/LC_MESSAGES/messages.po
86+
run: cat python_docs_theme/locales/pt_BR/LC_MESSAGES/messages.po
8787
- name: list files in locales dir
8888
shell: bash
8989
run: ls -R locales/

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ coverage.xml
4747
.hypothesis/
4848

4949
# Translations
50-
*.mo
5150
*.pot
5251

5352
# Django stuff:

babel_runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/venv python3
1+
#!/usr/bin/env python3
22
"""Script for handling translations with Babel"""
33
from __future__ import annotations
44

@@ -15,9 +15,9 @@
1515
# Global variables used by pybabel below (paths relative to PROJECT_DIR)
1616
DOMAIN = "messages"
1717
COPYRIGHT_HOLDER = "Python Software Foundation"
18-
LOCALES_DIR = "locales"
19-
POT_FILE = Path(LOCALES_DIR, f"{DOMAIN}.pot")
2018
SOURCE_DIR = "python_docs_theme"
19+
LOCALES_DIR = f"{SOURCE_DIR}/locales"
20+
POT_FILE = Path(LOCALES_DIR, f"{DOMAIN}.pot")
2121
MAPPING_FILE = ".babel.cfg"
2222

2323

python_docs_theme/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import gettext
34
from pathlib import Path
45

56
TYPE_CHECKING = False
@@ -12,9 +13,22 @@
1213
THEME_PATH = Path(__file__).resolve().parent
1314

1415

16+
def setup_translations(app):
17+
translation = gettext.translation(
18+
domain="messages",
19+
localedir=str(THEME_PATH / "locales"),
20+
languages=[app.config.language],
21+
fallback=True,
22+
)
23+
app.builder.templates.environment.install_gettext_translations(
24+
translation, newstyle=True
25+
)
26+
27+
1528
def setup(app: Sphinx) -> ExtensionMetadata:
1629
app.require_sphinx("7.3")
1730

31+
app.connect("builder-inited", setup_translations)
1832
app.add_html_theme("python_docs_theme", str(THEME_PATH))
1933

2034
return {

python_docs_theme/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ <h3>{{ _('Navigation') }}</h3>
160160
<br>
161161

162162
{%- if last_updated %}
163-
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
163+
{% trans last_updated=last_updated|e %}Last updated on %(last_updated)s.{% endtrans %}
164164
{%- endif %}
165165
{% if theme_issues_url %}
166166
{% trans %}<a href="{{ theme_issues_url }}">Found a bug</a>?{% endtrans %}
2.18 KB
Binary file not shown.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Polish (Poland) translations for python-docs-theme.
2+
# Copyright (C) 2025 Python Software Foundation
3+
# This file is distributed under the same license as the python-docs-theme
4+
# project.
5+
# Stan Ulbrych, 2025.
6+
#
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: python-docs-theme 2025.5\n"
10+
"Report-Msgid-Bugs-To: https://github.com/python/python-docs-theme/issues\n"
11+
"POT-Creation-Date: 2025-08-07 15:11+0200\n"
12+
"PO-Revision-Date: 2025-08-07 15:11+0200\n"
13+
"Last-Translator: Stan Ulbrych \n"
14+
"Language: pl_PL\n"
15+
"Language-Team: pl_PL <[email protected]>\n"
16+
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && "
17+
"(n%100<10 || n%100>=20) ? 1 : 2);\n"
18+
"MIME-Version: 1.0\n"
19+
"Content-Type: text/plain; charset=utf-8\n"
20+
"Content-Transfer-Encoding: 8bit\n"
21+
"Generated-By: Babel 2.17.0\n"
22+
23+
#: python_docs_theme/footerdonate.html:1
24+
msgid "The Python Software Foundation is a non-profit corporation."
25+
msgstr "Python Software Foundation jest organizacją non-profit."
26+
27+
#: python_docs_theme/footerdonate.html:2
28+
msgid "Please donate."
29+
msgstr "Prosimy o wsparcie."
30+
31+
#: python_docs_theme/layout.html:6
32+
msgid "Navigation"
33+
msgstr "Nawigacja"
34+
35+
#: python_docs_theme/layout.html:51 python_docs_theme/layout.html:111
36+
msgid "Quick search"
37+
msgstr "Szybkie wyszukiwanie"
38+
39+
#: python_docs_theme/layout.html:52 python_docs_theme/layout.html:112
40+
msgid "Go"
41+
msgstr "Szukaj"
42+
43+
#: python_docs_theme/layout.html:60
44+
msgid "Theme"
45+
msgstr "Motyw"
46+
47+
#: python_docs_theme/layout.html:62
48+
msgid "Auto"
49+
msgstr "Auto"
50+
51+
#: python_docs_theme/layout.html:63
52+
msgid "Light"
53+
msgstr "Jasny"
54+
55+
#: python_docs_theme/layout.html:64
56+
msgid "Dark"
57+
msgstr "Ciemny"
58+
59+
#: python_docs_theme/layout.html:96
60+
msgid "Menu"
61+
msgstr "Menu"
62+
63+
#: python_docs_theme/layout.html:142
64+
msgid "Copyright"
65+
msgstr "Prawa autorskie"
66+
67+
#: python_docs_theme/layout.html:147
68+
msgid ""
69+
"This page is licensed under the Python Software Foundation License "
70+
"Version 2."
71+
msgstr "Ta strona jest licencjonowana na podstawie licencji Python Software "
72+
"Foundation License Version 2."
73+
74+
#: python_docs_theme/layout.html:149
75+
msgid ""
76+
"Examples, recipes, and other code in the documentation are additionally "
77+
"licensed under the Zero Clause BSD License."
78+
msgstr "Przykłady, przepisy i inny kod w dokumentacji są dodatkowo udostępnione "
79+
"na podstawie licencji Zero Clause BSD."
80+
81+
#: python_docs_theme/layout.html:152
82+
#, python-format
83+
msgid ""
84+
"See <a href=\"%(license_file)s\">History and License</a> for more "
85+
"information."
86+
msgstr ""
87+
"Zobacz <a href=\"%(license_file)s\">Historię i licencję</a> aby uzyskać "
88+
"więcej informacji."
89+
90+
#: python_docs_theme/layout.html:155
91+
#, python-format
92+
msgid "Hosted on %(hosted_on)s."
93+
msgstr "Hostowane na %(hosted_on)s."
94+
95+
#: python_docs_theme/layout.html:163
96+
#, python-format
97+
msgid "Last updated on %(last_updated)s."
98+
msgstr "Ostatnia aktualizacja %(last_updated)."
99+
100+
#: python_docs_theme/layout.html:166
101+
#, python-format
102+
msgid "<a href=\"%(theme_issues_url)s\">Found a bug</a>?"
103+
msgstr "<a href=\"%(theme_issues_url)s\">Znalazłeś(-aś) błąd</a>?"
104+
105+
#: python_docs_theme/layout.html:170
106+
#, python-format
107+
msgid ""
108+
"Created using <a href=\"https://www.sphinx-doc.org/\">Sphinx</a> "
109+
"%(sphinx_version)s."
110+
msgstr ""
111+
"Stworzone za pomocą <a href=\"https://www.sphinx-doc.org/\">Sphinx</a> "
112+
"%(sphinx_version)s."
113+
114+
#: python_docs_theme/static/copybutton.js:30
115+
#: python_docs_theme/static/copybutton.js:55
116+
msgid "Copy"
117+
msgstr "Kopiuj"
118+
119+
#: python_docs_theme/static/copybutton.js:31
120+
msgid "Copy to clipboard"
121+
msgstr "Skopiuj do schowka"
122+
123+
#: python_docs_theme/static/copybutton.js:53
124+
msgid "Copied!"
125+
msgstr "Skopiowano!"

0 commit comments

Comments
 (0)