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

Enable translation_progress_classes #239

Open
wants to merge 1 commit 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
26 changes: 14 additions & 12 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def __gt__(self, other):
return self.as_tuple() > other.as_tuple()


@dataclass(frozen=True, order=True)
@dataclass(order=True, frozen=True, kw_only=True)
class Language:
iso639_tag: str
name: str
Expand Down Expand Up @@ -710,6 +710,7 @@ def build(self):
f"-D locale_dirs={locale_dirs}",
f"-D language={self.language.iso639_tag}",
"-D gettext_compact=0",
"-D translation_progress_classes=1",
)
)
if self.language.tag == "ja":
Expand Down Expand Up @@ -1141,19 +1142,20 @@ def parse_versions_from_devguide(http: urllib3.PoolManager) -> list[Version]:
def parse_languages_from_config() -> list[Language]:
"""Read config.toml to discover languages to build."""
config = tomlkit.parse((HERE / "config.toml").read_text(encoding="UTF-8"))
languages = []
defaults = config["defaults"]
for iso639_tag, section in config["languages"].items():
languages.append(
Language(
iso639_tag,
section["name"],
section.get("in_prod", defaults["in_prod"]),
sphinxopts=section.get("sphinxopts", defaults["sphinxopts"]),
html_only=section.get("html_only", defaults["html_only"]),
)
default_in_prod = defaults.get("in_prod", True)
default_sphinxopts = defaults.get("sphinxopts", [])
default_html_only = defaults.get("html_only", False)
return [
Language(
iso639_tag=iso639_tag,
name=section["name"],
in_prod=section.get("in_prod", default_in_prod),
sphinxopts=section.get("sphinxopts", default_sphinxopts),
html_only=section.get("html_only", default_html_only),
)
return languages
for iso639_tag, section in config["languages"].items()
]


def format_seconds(seconds: float) -> str:
Expand Down
1 change: 0 additions & 1 deletion config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ in_prod = false

[languages.it]
name = "Italian"
in_prod = true

[languages.ja]
name = "Japanese"
Expand Down
Loading