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

POC – Fixed #1688 -- Output translatable labels when displaying permissions #1

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thibaudcolas
Copy link
Owner

@thibaudcolas thibaudcolas commented Oct 14, 2022

@thibaudcolas thibaudcolas force-pushed the ticket_1688 branch 2 times, most recently from f90e95e to b17492d Compare June 2, 2023 19:55
@thibaudcolas thibaudcolas changed the title Fixed #1688 -- Output translatable labels when displaying permissions POC – Fixed #1688 -- Output translatable labels when displaying permissions Jun 2, 2023
return "%s | %s" % (self.content_type, self.name)
names = { "content_type": self.content_type }

if "Can add" in self.name:

Choose a reason for hiding this comment

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

Would startswith be a more accurate check?

Suggested change
if "Can add" in self.name:
if self.name.startswith("Can add "):

Copy link
Owner Author

Choose a reason for hiding this comment

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

Definitely. And the fallback after those conditionals should probably be return "%s | %s" % (self.content_type, _(self.name)), so custom permissions are translate-able (would additionally require people to hard-code a copy of their permission names somewhere in their code for makemessages to pick up).

Choose a reason for hiding this comment

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

Ah cool 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants