Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#12385 closed (fixed)

Fields type descriptions aren't translatable after r11833

Reported by: ramiro Owned by: kmtracey
Component: Internationalization Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Noted this after updating a translation, found all the previosuly translated description for builtin model fields commented out like this

#~ msgid "Boolean (Either True, False or None)"
#~ msgstr "Booleano (Verdadero, Falso o Nulo)"

at the end of django.po.

This is because xgettext can't examine Python docstrings in search of marked-for-translation strings.

At some point during #7977 life, using a class attribute had been considered but the docstring approach was chosen in the end.

Attachments (1)

12385-class-attribute-for-i18n.diff (19.6 KB) - added by ramiro 4 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 follow-up: Changed 4 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Oh darn. I missed that those strings had been translated. The docstring approach looked much more natural to me. Taking another look at the alternative descriptor approach, I don't think the patch for it preserves the ability for makemessages to find the strings either? But I guess it could be done that way, whereas for docstrings there's no hope?

comment:2 in reply to: ↑ 1 ; follow-up: Changed 4 years ago by ramiro

  • Has patch set

Replying to kmtracey:

Taking another look at the alternative descriptor approach, I don't think the patch for it preserves the ability for makemessages to find the strings either?

Correct. it still wasn't completely right from the point of view of correctly supporting i18n.

But I guess it could be done that way

I've implemented that in the attached patch.

whereas for docstrings there's no hope?

AFAIK, no.

comment:3 in reply to: ↑ 2 ; follow-up: Changed 4 years ago by kmtracey

Replying to ramiro:

Replying to kmtracey:

Taking another look at the alternative descriptor approach, I don't think the patch for it preserves the ability for makemessages to find the strings either?

Correct. it still wasn't completely right from the point of view of correctly supporting i18n.

But I guess it could be done that way

I've implemented that in the attached patch.

I think maybe you uploaded the wrong patch? What's attached is the same as the original descriptor patch on the other ticket.

Changed 4 years ago by ramiro

comment:4 in reply to: ↑ 3 Changed 4 years ago by ramiro

Replying to kmtracey:

I think maybe you uploaded the wrong patch? What's attached is the same as the original descriptor patch on the other ticket.

Yes, sorry. I even managed to repeat the error once more. 12385-class-attribute-for-i18n.diff is the correct patch.

comment:5 Changed 4 years ago by kmtracey

  • Owner changed from nobody to kmtracey
  • Triage Stage changed from Unreviewed to Accepted

comment:6 Changed 4 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from new to closed

(In [11878]) Fixed #12385: Made built-in field type descriptions in admindocs translatable again. Many thanks to Ramiro for the problem report and patch.

comment:7 Changed 4 years ago by kmtracey

(In [11879]) [1.1.X] Fixed #12385: Made built-in field type descriptions in admindocs translatable again. Many thanks to Ramiro for the problem report and patch.

r11878 from trunk.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.