Hi, Tribaud.

 

In your case you can override Permission admin to show translated names of 
permissions and for widgets you can override modelchoiceiterator

The name of permission you can translate like model.verbose_name + gettext( 
‘can’) + gettext(view/change/delete) and it should be translated.

With custom translation is a little bit  more work, but it also works. 

I am not sure, that if override of __str__ helps, but it also possible.

 

 

By the way - My solution DJANGO-TOF 2.version solves you ask without any 
changes in code.

I‘ve presented it on last Django con 2022

We works with permissions and also custom permissions already long time in 
Multilanguage Project and I don’t see any problem with that.

 

 

Mit freundlichen Grüßen,

DI Mag. Maxim Danilov

 

+43(681)207 447 76

 <mailto:ma...@wpsoft.at> ma...@wpsoft.at

 

From: django-developers@googlegroups.com 
[mailto:django-developers@googlegroups.com] On Behalf Of Thibaud Colas
Sent: Saturday, September 24, 2022 9:25 AM
To: Django developers (Contributions to Django itself) 
<django-developers@googlegroups.com>
Subject: Permissions don't get translated in admin interface

 

👋 there have been a lot of discussions and tickets opened on permissions 
translations in the past. I’m not sure what the etiquette here is, hence why 
I’m starting a new conversation.

 

I would like to see #1688 Permissions don't get translated in admin interface 
<https://code.djangoproject.com/ticket/1688>  reconsidered, as to me it seems 
like a clear bug, which affects a lot of users. Though not many people might be 
managing permissions regularly, when you do, it’s very jarring that the text is 
in the wrong language.

 

I’m not sure what Django’s stance is on supporting non-english users generally, 
but based on our diversity statement I feel like "100% of the admin UI 
translated" is an important goal – and looking at Transifex 
<https://explore.transifex.com/django/django/> , there are a lot of people 
putting in a lot of effort to get it there. If this is a wontfix because the 
store-label-in-DB approach is effectively impossible to make work, then I think 
this would be worth clearing documenting on the Localizing Django 
<https://docs.djangoproject.com/en/4.1/internals/contributing/localizing/>  
page so translators know what to expect. Ideally also mention elsewhere in a 
place visible to end users.

 

---

 

>From a technical perspective, this is far from my area of expertise but as I 
>understand there are clear solutions – one that’s "quick and dirty" would be 
>to hard-code a list of gettext_lazy calls with the same labels as stored in 
>the DB for the purpose of collecting the labels for PO files, and then we 
>could use {% translate %} over the DB-provided values anyway. No change to the 
>DB needed. I count 8 Django-provided models in my demo site (might be missing 
>others), each has 4 Django-provided permissions, so that’s 32 strings to 
>hard-code. Feels doable!

 

 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com 
<mailto:django-developers+unsubscr...@googlegroups.com> .
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/8e14c59f-3331-401a-85a1-cbf27d49fe65n%40googlegroups.com
 
<https://groups.google.com/d/msgid/django-developers/8e14c59f-3331-401a-85a1-cbf27d49fe65n%40googlegroups.com?utm_medium=email&utm_source=footer>
 .

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/000001d8d064%24f9d25dd0%24ed771970%24%40wpsoft.at.

Reply via email to