Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#8543 closed (fixed)

can_delete and can_order labels are not internationalized

Reported by: versae Owned by: versae
Component: Forms Version: master
Severity: Keywords: string-freeze
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

In forms/formsets.py, lines 241, 243 and 245:

[...]
                form.fields[ORDERING_FIELD_NAME] = IntegerField(label='Order', initial=index+1, required=False)
            else:
                form.fields[ORDERING_FIELD_NAME] = IntegerField(label='Order', required=False)
        if self.can_delete:
            form.fields[DELETION_FIELD_NAME] = BooleanField(label='Delete', required=False)
[...]

I think this should be

[...]
                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_('Order'), initial=index+1, required=False)
            else:
                form.fields[ORDERING_FIELD_NAME] = IntegerField(label=_('Order'), required=False)
        if self.can_delete:
            form.fields[DELETION_FIELD_NAME] = BooleanField(label=_('Delete'), required=False)
[...]

I attach a patch file.

Attachments (2)

internationalized_order_and_delete_labels_for_formsets.diff (5.6 KB) - added by versae 6 years ago.
Patch file and regression test.
internationalized_order_and_delete_labels_for_formsets_r8554.diff (1.4 KB) - added by msaelices 6 years ago.
Patch without tests and using ugettext instead of ugettext_lazy

Download all attachments as: .zip

Change History (15)

comment:1 Changed 6 years ago by versae

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from versae@… to versae
  • Patch needs improvement unset
  • Status changed from new to assigned

I attach a patch file.

Changed 6 years ago by versae

Patch file and regression test.

comment:2 Changed 6 years ago by msaelices

You've missed upload the .mo file to patch. You can do this with this order (executed in django/conf dir):

 $ django-admin.py compilemessages

comment:3 Changed 6 years ago by msaelices

Also you missed putting that new msgid in other catalogs, with this command:

  $ django-admin.py makemessages -a

comment:4 Changed 6 years ago by mtredinnick

  • Keywords string-freeze added
  • milestone set to 1.0
  • Triage Stage changed from Unreviewed to Accepted

Woah, woah.. everybody slow down! This patch should only be adding the ugettext_lazy() call to the source. That is the internationalisation bug.

The localisation updates will be done by the respective translators. Code patches should never touch message catalogs (nor should MO files ever be put into a translation patch, since they are regenerated before commits). Putting a translation update into a code patch is mixing two separate things.

comment:5 Changed 6 years ago by msaelices

@mtredinnick, ok, you're right, but in this case, for the regression tests, you at least need put the spanish translation of "Order". The test case will fail in other case.

what do you think about this?

comment:6 Changed 6 years ago by mtredinnick

Leave the test out. We don't need a test for every translated string in Django.

comment:7 Changed 6 years ago by msaelices

Right :-)

comment:8 Changed 6 years ago by msaelices

  • Has patch set

comment:9 Changed 6 years ago by brosner

  • Patch needs improvement set

comment:9 Changed 6 years ago by brosner

  • Patch needs improvement set

Changed 6 years ago by msaelices

Patch without tests and using ugettext instead of ugettext_lazy

comment:11 Changed 6 years ago by jacob

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

(In [8562]) Fixed #8543: added translation markings to can_delete and can_order form labels. Thanks, msaelices.

comment:12 Changed 6 years ago by msaelices

@jacob, it's better to give thanks to Versae. He created the first patch :-)

comment:13 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

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.