Skip to content

Commit

Permalink
Enable translation_progress_classes
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Jan 15, 2025
1 parent e4a8aff commit 50d6a37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
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

0 comments on commit 50d6a37

Please sign in to comment.