Skip to content

Commit

Permalink
allow translating English phrases in json domain output
Browse files Browse the repository at this point in the history
resolves #274 by leveraging `sphinx.locale._` as a translation proxy.

Users will have to create .po files with the following phrases translated:
- "Required members"
- "Optional members"
  • Loading branch information
2bndy5 committed Jul 5, 2024
1 parent 99ba8ab commit ddf4698
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sphinx_immaterial/apidoc/json/domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import sphinx.util.docutils
import sphinx.util.logging
import sphinx.util.matching
from sphinx.locale import _
import yaml # pylint: disable=import-error

from .. import object_description_options
Expand Down Expand Up @@ -864,7 +865,7 @@ def _render_related_type_list(related: Optional[List[str]], label: str) -> None:
):
continue
heading = "%s members" % ("Required" if required else "Optional")
field_list, body = self._make_field(heading)
field_list, body = self._make_field(_(heading))
result.append(field_list)
for member_name, member_schema in properties.items():
if (member_name in required_properties) != required:
Expand Down

0 comments on commit ddf4698

Please sign in to comment.