BatchAction pluralization never counts the items

Bug #1390167 reported by Doug Fish
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Confirmed
Low
Unassigned

Bug Description

Looking more closely at BatchAction it seems that it never really counts the number of items are the passed in. Instead it will choose a translations based on either the number 1 (if no items are passed in), or the number 6 (because that's the number of letters in 'plural').

For some languages, like Russian, and I think Polish, there should be different translations used for describing 2 or 6 items.

We should make sure that when there is a known number of items we use that in the BatchAction lookups. We probably shouldn't have _any_ references to singular and plural in the code once this is done.

I'm looking at
horizon/tables/actions.py
def _get_action_name(self, items=None, past=False):

and the calls to it like
self.verbose_name_plural = kwargs.get(
'verbose_name_plural',
lambda: self._get_action_name('plural'))

and especially the call in update
 self.verbose_name_plural = self._get_action_name('plural')

Tags: i18n
Revision history for this message
Gary W. Smith (gary-w-smith) wrote :

+1 good catch.

Changed in horizon:
status: New → Confirmed
importance: Undecided → Low
Changed in horizon:
assignee: nobody → Brian Fischer (brian-fischer)
Changed in horizon:
assignee: Brian Fischer (brian-fischer) → nobody
Revision history for this message
Sam Betts (sambetts) wrote :

The case your talking about is in the __init__ and update of BatchAction, these function are never passed any items so has no way to get the plural version of the verbose name other than to fake it by passing some fake data into the items parameter of that function. However when it has that data e.g. in the handle function it is passed real information:

self._get_action_name(action_not_allowed).lower()
self._get_action_name(action_failure).lower()
self._get_action_name(action_success, past=True)

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.