Make volume status detail translatable

On the Project->Compute->Volumes->Details panel, the "status"
label is currently untranslatable.  This change fixes that issue.

Change-Id: I82b3e67c7a58ce6f0a3f97848082d60be2f611d7
Partial-Bug: #1441366
This commit is contained in:
Lucas Palm 2015-07-16 16:36:51 -05:00
parent 590d1d544d
commit 82554a686d
2 changed files with 8 additions and 1 deletions

View File

@ -16,7 +16,7 @@
<dd>{{ volume.description }}</dd>
{% endif %}
<dt>{% trans "Status" %}</dt>
<dd>{{ volume.status|capfirst }}</dd>
<dd>{{ volume.status_label|capfirst }}</dd>
</dl>
</div>

View File

@ -52,6 +52,13 @@ class DetailView(tabs.TabView):
context["volume"] = volume
context["url"] = self.get_redirect_url()
context["actions"] = table.render_row_actions(volume)
status_label = [label for (value, label) in
project_tables.VolumesTableBase.STATUS_DISPLAY_CHOICES
if value.lower() == (volume.status or '').lower()]
if status_label:
volume.status_label = status_label[0]
else:
volume.status_label = volume.status
return context
@memoized.memoized_method