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

Is there a way to internationalize json domain titles ? #274

Closed
rperrot opened this issue Jul 27, 2023 · 2 comments · Fixed by #364
Closed

Is there a way to internationalize json domain titles ? #274

rperrot opened this issue Jul 27, 2023 · 2 comments · Fixed by #364

Comments

@rperrot
Copy link

rperrot commented Jul 27, 2023

Hi,

first of all, thank you for your really helpful theme/extension.

I' trying to use json domain in a non english document and I'm stuck with the "required/optional" members string. I'd like to change it but I can't find a way to change it using a parameter/option.

I think the issue is because theses strings are hard coded here :

heading = "%s members" % ("Required" if required else "Optional")

Is there a way to customize it or it's impossible ?

Yours,

@2bndy5
Copy link
Collaborator

2bndy5 commented Jul 27, 2023

True, the strings are hardcoded in English, and there is no config option to change or remove them. We could use Sphinx' own translation mechanism, but I think that would require a .po file (in the doc project's source) that defines the translation for the words phrases "Required members" and "Optional members". This idea would be simple to implement on our end:

                heading = "%s members" % ("Required" if required else "Optional") 
                field_list, body = self._make_field(_(heading))

But it will require a message catalog (.po file) of translations on the user's end.

2bndy5 added a commit that referenced this issue Jul 5, 2024
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"
@2bndy5 2bndy5 closed this as completed in 3951651 Jul 5, 2024
@2bndy5 2bndy5 added the pending release has been resolved but is pending a new release label Jul 5, 2024
@2bndy5
Copy link
Collaborator

2bndy5 commented Jul 21, 2024

The solution for this was released in v0.12.0

@2bndy5 2bndy5 removed the pending release has been resolved but is pending a new release label Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants