Updated openstack/openstack
Project: openstack/horizon  863ba1afdad4f4d91eb1e5440f675e0c30eca363

Allow translators to translate BatchActions

Currently BatchAction proposes only an action_present and action_past verb
to be concatenated with a data_type_singular or data_type_plural string.

The issue is that many languages need to conjugate the verb with the
plural/singular subject, and some translations where terribly awfull and
impossible to do.
Indeed, some languages have up to 5 plural forms depending on the number of
items.

This patch introduces the fact that action_present is a method instead of an
attribute, which in conjonction with https://review.openstack.org/57701 allows
better translation to be performed.

This patch also adds contextual mrkers to STATUS_DISPLAY_CHOICES,
TASK_DISPLAY_CHOICES and POWER_DISPLAY_CHOICES because it was impossible to
translate the stand-alone words out of context for a translator (i.e. the word
"active" will be translated differently if the active object is feminine or
masculine, since feminine and masculine depends also on the language, it is
mission impossible for the translator to translate "active" if he does not know
"what" is "active").

It is important to use unicode strings with contextual markers because of the
following django bug:
https://code.djangoproject.com/ticket/22565
The django community was very quick and responsive and fixed the bug very fast:
https://code.djangoproject.com/changeset/142c27218a0bb07bb197faab7b1d8eb3a084f5b9
and back-ported their fix in the 1.6 and 1.7 django branches:
https://code.djangoproject.com/changeset/61fd00d4fd65f44d0a05be4c7e95124e4102ec27
https://code.djangoproject.com/changeset/034866204b39f797c73997b03cd90443aa03aa91
but since in horizon we support back to django 1.4, we will have to live with
it by providing unicode strings until we drop support of old django versions.

We can't introduce contextual markers and ungettext (pluralization) verywhere
at once because Translators would totally loose their previous work. So we have
to progressively introduce contextual markers and pluralization, when a string
is changed, or for new strings. It is also the reason why this patch changes
only the strings of the instance view actions.

Since we can't use contextual markers and pluralization for all the code at
once, this patch partially:

partial-bug: 1307476

Change-Id: I4cef42dc4a12f55cf750d9a18083254c6a96e716