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

Add translation for Authors folder #51

Merged
merged 3 commits into from
Dec 4, 2023
Merged

Conversation

jnptk
Copy link
Contributor

@jnptk jnptk commented Dec 1, 2023

ToDo

  • Add tests
  • Fix id not being translated

Fix #50

@jnptk jnptk linked an issue Dec 1, 2023 that may be closed by this pull request
@jnptk jnptk removed request for sneridagh and tisto December 1, 2023 14:16
Copy link
Member

@davisagli davisagli left a comment

Choose a reason for hiding this comment

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

@jonaspiterek Have you actually tested this with a different language? I don't think it will work.

Message id objects created with the _ helper are automatically translated into the current language in certain places -- such as when they appear in a template or are serialized to JSON for an API response. But, I don't think api.content.create will take care of translating them. So, I expect that we need to do it manually before passing the translated values into api.content.create.

Here's an example of how to do it manually: https://github.com/plone/plone.restapi/blob/d5b83a67b5a894b7985c67e6c2ae0c9eb1034fd6/src/plone/restapi/services/users/add.py#L40

@jnptk
Copy link
Contributor Author

jnptk commented Dec 4, 2023

@davisagli I did tested it with a different language and it is kind of working, "title" and "description" get the translation. But "id" does not. Also the breadcrumbs which I believe use the "title" don't work.

@ericof
Copy link
Member

ericof commented Dec 4, 2023

@jonaspiterek, take a look if it works as expected now.

@ericof
Copy link
Member

ericof commented Dec 4, 2023

Additional code added here to handle the plone/plone.api#524 issue

Copy link
Contributor Author

@jnptk jnptk left a comment

Choose a reason for hiding this comment

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

@ericof Works exactly as expected

@ericof ericof merged commit 5e5dbba into main Dec 4, 2023
5 checks passed
@ericof ericof deleted the issue-50-translate-authors branch December 4, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translate id and Title of "Authors" folderish
3 participants