Skip to content

Add Greek translation #248

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

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
14 changes: 12 additions & 2 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,21 @@ class Language:
in_prod: bool
sphinxopts: tuple
html_only: bool = False
repo_name: str = None

@property
def tag(self):
return self.iso639_tag.replace("_", "-").lower()

@property
def repo_url(self):
repo_name = (
self.repo_name
if self.repo_name is not None
else f"python-docs-{self.iso639_tag}"
)
return f"https://github.com/python/{repo_name}.git"

@property
def switcher_label(self):
if self.translated_name:
Expand Down Expand Up @@ -681,15 +691,14 @@ def clone_translation(self):
def translation_repo(self):
"""See PEP 545 for translations repository naming convention."""

locale_repo = f"https://github.com/python/python-docs-{self.language.tag}.git"
locale_clone_dir = (
self.build_root
/ self.version.name
/ "locale"
/ self.language.iso639_tag
/ "LC_MESSAGES"
)
return Repository(locale_repo, locale_clone_dir)
return Repository(self.language.repo_url, locale_clone_dir)

@property
def translation_branch(self):
Expand Down Expand Up @@ -1170,6 +1179,7 @@ def parse_languages_from_config() -> list[Language]:
in_prod=section.get("in_prod", default_in_prod),
sphinxopts=section.get("sphinxopts", default_sphinxopts),
html_only=section.get("html_only", default_html_only),
repo_name=section.get("repo_name"),
)
for iso639_tag, section in config["languages"].items()
]
Expand Down
4 changes: 4 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,7 @@ sphinxopts = [
'-D latex_elements.inputenc=',
'-D latex_elements.fontenc=\\usepackage{xeCJK}',
]

[languages.el]
name = "Greek"
repo_name = "python-docs-gr"
Copy link
Member

@AA-Turner AA-Turner Feb 27, 2025

Choose a reason for hiding this comment

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

Please also update to add the new translated_name key.

Suggested change
repo_name = "python-docs-gr"