Translators cannot control more than two plural forms in message string of BatchAction

Bug #1253174 reported by Akihiro Motoki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Yves-Gwenael Bourhis

Bug Description

Reported in comment #2 of bug 1252082.

In some languages the number of plural forms is more than two,
but horizon only supports one type of plural form and translators cannot
control more than two plural forms.

The following description is quoted from bug 1252082.
I am not sure it works.
----
In general plural form problem can be handled with ungettext_lazy.
https://docs.djangoproject.com/en/dev/topics/i18n/translation/#lazy-translations-and-plural
I think we need to change all classes inherited BatchAction and DeleteAction. I haven't tested below.

IMO it is better to be fixed separately.

The following is an example of DeleteNetwork: (https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/project/networks/tables.py#L42)

 class DeleteNetwork(CheckNetworkEditable, tables.DeleteAction):
      data_type = ungettext_lazy("Network", "Networks", "_count")

and change horizon/tables/action.py

    data_type = self.data_type % {'_count': <num_of_items>}

Changed in horizon:
status: New → Confirmed
Changed in horizon:
assignee: nobody → Verónica Musso (veronica-a-musso)
Revision history for this message
Akihiro Motoki (amotoki) wrote :

According to Django documentation, ungettext_lazy() only works in Django 1.6 or later.
We still supports Django 1.4 and 1.5, so we need to do this carefully.

description: updated
Revision history for this message
Verónica Musso (veronica-a-musso) wrote :

Yes, you are right, I will submit a patch soon, considering this. Thanks!

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/86068

Changed in horizon:
status: Confirmed → In Progress
David Lyle (david-lyle)
Changed in horizon:
importance: Undecided → Medium
milestone: none → juno-2
Changed in horizon:
milestone: juno-2 → juno-3
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-3 → juno-rc1
David Lyle (david-lyle)
Changed in horizon:
milestone: juno-rc1 → kilo-1
Revision history for this message
Akihiro Motoki (amotoki) wrote :

The problem has been fixed in https://review.openstack.org/#/c/91338/, so I marked this bug as Fix Committed.
The remaining issues on plural forms will covered by bug 1307476.

Changed in horizon:
status: In Progress → Fix Committed
milestone: kilo-1 → juno-rc1
assignee: Verónica Musso (veronica-a-musso) → Yves-Gwenael Bourhis (yves-gwenael-bourhis)
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-rc1 → 2014.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by David Lyle (<email address hidden>) on branch: master
Review: https://review.openstack.org/86068
Reason: This review is > 4 weeks without comment, and failed Jenkins the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.