Create titles without concatenation
Several panels use the template filter "add" to concatenate data and translatable text, for example title=_("Volume Details: ")|add:volume.name|default:_("Volume Details:") These need to be updated to use string formatting. This is needed because it's not clear when looking at the translations if any text follows the translatable segment. Dict based substitution has been used to further clarify the messages for translators. Change-Id: I54d07233d2003904468ef317c352126eb6bf5f70 Closes-bug: #1394573
This commit is contained in:
parent
569228ae99
commit
de20d7271a
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Volume Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Volume Details: ")|add:volume.name|default:_("Volume Details:") %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -28,6 +28,14 @@ from openstack_dashboard.dashboards.project.volumes.volumes \
|
||||
class DetailView(volumes_views.DetailView):
|
||||
template_name = "admin/volumes/volumes/detail.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DetailView, self).get_context_data(**kwargs)
|
||||
volume = context["volume"]
|
||||
context["page_title"] = _("Volume Details: "
|
||||
"%(volume_name)s") % {'volume_name':
|
||||
volume.name}
|
||||
return context
|
||||
|
||||
def get_redirect_url(self):
|
||||
return reverse('horizon:admin:volumes:index')
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans 'Group Management' %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Group Management: ")|add:group.name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -114,7 +114,11 @@ class ManageMembersView(GroupManageMixin, tables.DataTableView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ManageMembersView, self).get_context_data(**kwargs)
|
||||
context['group'] = self._get_group()
|
||||
group = self._get_group()
|
||||
context['group'] = group
|
||||
context['page_title'] = _("Group Management: "
|
||||
"%(group_name)s") % {'group_name':
|
||||
group.name}
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
|
@ -61,7 +61,11 @@ class DetailView(tables.DataTableView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DetailView, self).get_context_data(**kwargs)
|
||||
context["security_group"] = self._get_data()
|
||||
security_group = self._get_data()
|
||||
context["security_group"] = security_group
|
||||
context["page_title"] = _("Manage Security Group Rules: "
|
||||
"%(security_group)s") % {'security_group':
|
||||
security_group.name}
|
||||
return context
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Manage Security Group Rules" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Manage Security Group Rules: ")|add:security_group.name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Backup Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Backup Details: ")|add:backup.name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -103,4 +103,8 @@ class DetailView(horizon_views.APIView):
|
||||
instance = None
|
||||
context['backup'] = backup
|
||||
context['instance'] = instance
|
||||
context['page_title'] = _("Backup Details: "
|
||||
"%(backup_name)s") % {'backup_name':
|
||||
backup.name}
|
||||
|
||||
return context
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Instance Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Instance Details: ")|add:instance.name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -101,6 +101,9 @@ class DetailView(horizon_tabs.TabbedTableView):
|
||||
context["instance"] = instance
|
||||
context["url"] = self.get_redirect_url()
|
||||
context["actions"] = table.render_row_actions(instance)
|
||||
context["page_title"] = _("Instance Details: "
|
||||
"%(instance_name)s") % {'instance_name':
|
||||
instance.name}
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Edit Firewall" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Edit Firewall ")|add:name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Edit Policy" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Edit Policy ")|add:name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Edit Rule" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Edit Rule ")|add:name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -126,8 +126,12 @@ class UpdateRuleView(forms.ModalFormView):
|
||||
context = super(UpdateRuleView, self).get_context_data(**kwargs)
|
||||
context['rule_id'] = self.kwargs['rule_id']
|
||||
obj = self._get_object()
|
||||
context['page_title'] = _("Edit Rule")
|
||||
if obj:
|
||||
context['name'] = obj.name
|
||||
context['page_title'] = _("Edit Rule "
|
||||
"%(rule_name)s") % {'rule_name':
|
||||
obj.name}
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
@ -161,8 +165,10 @@ class UpdatePolicyView(forms.ModalFormView):
|
||||
context = super(UpdatePolicyView, self).get_context_data(**kwargs)
|
||||
context["policy_id"] = self.kwargs['policy_id']
|
||||
obj = self._get_object()
|
||||
context['page_title'] = _("Edit Policy")
|
||||
if obj:
|
||||
context['name'] = obj.name
|
||||
context['page_title'] = _("Edit Policy %s") % obj.name
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
@ -193,8 +199,10 @@ class UpdateFirewallView(forms.ModalFormView):
|
||||
context = super(UpdateFirewallView, self).get_context_data(**kwargs)
|
||||
context["firewall_id"] = self.kwargs['firewall_id']
|
||||
obj = self._get_object()
|
||||
context['page_title'] = _("Edit Firewall")
|
||||
if obj:
|
||||
context['name'] = obj.name
|
||||
context['page_title'] = _("Edit Firewall %s") % obj.name
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
|
@ -91,6 +91,9 @@ class DetailView(tabs.TabView):
|
||||
context["image"] = image
|
||||
context["url"] = self.get_redirect_url()
|
||||
context["actions"] = table.render_row_actions(image)
|
||||
context["page_title"] = _("Image Details: "
|
||||
"%(image_name)s") % {'image_name':
|
||||
image.name}
|
||||
return context
|
||||
|
||||
@staticmethod
|
||||
|
@ -4,7 +4,7 @@
|
||||
{% block title %}{% trans "Image Details"%}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Image Details: ")|add:image.name|default:_("Image Details:") %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Instance Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Instance Details: ")|add:instance.name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -258,6 +258,9 @@ class DetailView(tabs.TabView):
|
||||
table = project_tables.InstancesTable(self.request)
|
||||
context["url"] = reverse(self.redirect_url)
|
||||
context["actions"] = table.render_row_actions(instance)
|
||||
context["page_title"] = _("Instance Details: "
|
||||
"%(instance_name)s") % {'instance_name':
|
||||
instance.name}
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Network Detail"%}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Network Detail: ")|add:network.name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -142,6 +142,9 @@ class DetailView(tables.MultiTableView):
|
||||
table = project_tables.NetworksTable(self.request)
|
||||
context["url"] = self.get_redirect_url()
|
||||
context["actions"] = table.render_row_actions(network)
|
||||
context["page_title"] = _("Network Detail: "
|
||||
"%(network_name)s") % {'network_name':
|
||||
network.name}
|
||||
return context
|
||||
|
||||
@staticmethod
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Stack Detail" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Stack Detail: ")|add:stack.stack_name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Resource Detail" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Resource Detail: ")|add:resource.resource_name %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -204,6 +204,9 @@ class DetailView(tabs.TabView):
|
||||
context["stack"] = stack
|
||||
context["url"] = self.get_redirect_url()
|
||||
context["actions"] = table.render_row_actions(stack)
|
||||
context["page_title"] = _("Stack Detail: "
|
||||
"%(stack_name)s") % {'stack_name':
|
||||
stack.stack_name}
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
@ -246,8 +249,10 @@ class ResourceView(tabs.TabView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(ResourceView, self).get_context_data(**kwargs)
|
||||
context["resource"] = self.get_data(self.request, **kwargs)
|
||||
resource = self.get_data(self.request, **kwargs)
|
||||
context["resource"] = resource
|
||||
context["metadata"] = self.get_metadata(self.request, **kwargs)
|
||||
context["page_title"] = _("Resource Detail: %s") % resource
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
|
@ -53,6 +53,9 @@ class BackupDetailView(tabs.TabView):
|
||||
context["backup"] = backup
|
||||
context["url"] = self.get_redirect_url()
|
||||
context["actions"] = table.render_row_actions(backup)
|
||||
context["page_title"] = _("Volume Backup Details: "
|
||||
"%(backup_name)s") % {'backup_name':
|
||||
backup.name}
|
||||
|
||||
return context
|
||||
|
||||
|
@ -69,6 +69,9 @@ class DetailView(tabs.TabView):
|
||||
context["snapshot"] = snapshot
|
||||
context["url"] = self.get_redirect_url()
|
||||
context["actions"] = table.render_row_actions(snapshot)
|
||||
context["page_title"] = _("Volume Snapshot Details: "
|
||||
"%(snapshot_name)s") % {'snapshot_name':
|
||||
snapshot.name}
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Volume Backup Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Volume Backup Details: ")|add:backup.name|default:_("Volume Backup Details:") %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Volume Snapshot Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Volume Snapshot Details: ")|add:snapshot.name|default:_("Volume Snapshot Details:") %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block title %}{% trans "Volume Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Volume Details: ")|add:volume.name|default:_("Volume Details:") %}
|
||||
{% include "horizon/common/_page_header.html" with title=page_title %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
|
@ -50,6 +50,10 @@ class DetailView(tabs.TabView):
|
||||
context["volume"] = volume
|
||||
context["url"] = self.get_redirect_url()
|
||||
context["actions"] = table.render_row_actions(volume)
|
||||
context["page_title"] = _("Volume Details: "
|
||||
"%(volume_name)s") % {'volume_name':
|
||||
volume.name}
|
||||
|
||||
return context
|
||||
|
||||
@memoized.memoized_method
|
||||
|
Loading…
Reference in New Issue
Block a user