Made default values in templates translatable.

Fixes bug 1138183

Change-Id: I4a5d1f89e94b547bb0850020cb3fd4c03ec30179
This commit is contained in:
Lin Hua Cheng 2013-03-21 15:46:35 -07:00
parent 704c5a52f3
commit 7b2082a2e4
7 changed files with 34 additions and 30 deletions

View File

@ -5,7 +5,7 @@
<div class="info detail">
<dl>
<dt>{% trans "Name" %}</dt>
<dd>{{ router.name|default:"None" }}</dd>
<dd>{{ router.name|default:_("None") }}</dd>
<dt>{% trans "ID" %}</dt>
<dd>{{ router.id }}</dd>
<dt>{% trans "Project ID" %}</dt>

View File

@ -7,19 +7,19 @@
<hr class="header_rule">
<dl>
<dt>{% trans "Name" %}</dt>
<dd>{{ image.name|default:"None" }}</dd>
<dd>{{ image.name|default:_("None") }}</dd>
<dt>{% trans "ID" %}</dt>
<dd>{{ image.id|default:"None" }}</dd>
<dd>{{ image.id|default:_("None") }}</dd>
<dt>{% trans "Status" %}</dt>
<dd>{{ image.status|default:"Unknown"|title }}</dd>
<dd>{{ image.status|default:_("Unknown")|title }}</dd>
<dt>{% trans "Public" %}</dt>
<dd>{{ image.is_public }}</dd>
<dt>{% trans "Checksum" %}</dt>
<dd>{{ image.checksum }}</dd>
<dt>{% trans "Created" %}</dt>
<dd>{{ image.created_at|default:"Unknown" }}</dd>
<dd>{{ image.created_at|default:_("Unknown") }}</dd>
<dt>{% trans "Updated" %}</dt>
<dd>{{ image.updated_app|default:"Never updated" }}</dd>
<dd>{{ image.updated_app|default:_("Never updated") }}</dd>
</dl>
</div>
@ -30,9 +30,9 @@
<dt>{% trans "Size" %}</dt>
<dd>{{ image.size|filesizeformat }}</dd>
<dt>{% trans "Container Format" %}</dt>
<dd>{{ image.container_format|default:"None"|upper }}</dd>
<dd>{{ image.container_format|default:_("None")|upper }}</dd>
<dt>{% trans "Disk Format" %}</dt>
<dd>{{ image.disk_format|default:"None"|upper }}</dd>
<dd>{{ image.disk_format|default:_("None")|upper }}</dd>
</dl>
</div>

View File

@ -73,14 +73,18 @@
<hr class="header_rule">
<dl>
<dt>{% trans "Key Name" %}</dt>
<dd>{{ instance.key_name|default:"<em>None</em>" }}</dd>
{% with default_key_name="<em>"|add:_("None")|add:"</em>" %}
<dd>{{ instance.key_name|default:default_key_name }}</dd>
{% endwith %}
{% url horizon:project:images_and_snapshots:images:detail instance.image.id as image_url %}
<dt>{% trans "Image Name" %}</dt>
<dd><a href="{{ image_url }}">{{ instance.image_name }}</a></dd>
{% with default_item_value="<em>"|add:_("N/A")|add:"</em>" %}
{% for key, value in instance.metadata.items %}
<dt>{{ key|force_escape }}</dt>
<dd>{{ value|force_escape|default:"<em>N/A</em>" }}</dd>
<dd>{{ value|force_escape|default:default_item_value }}</dd>
{% endfor%}
{% endwith %}
</dl>
</div>

View File

@ -5,22 +5,22 @@
<div class="info detail">
<dl>
<dt>{% trans "Name" %}</dt>
<dd>{{ network.name|default:"None" }}</dd>
<dd>{{ network.name|default:_("None") }}</dd>
<dt>{% trans "ID" %}</dt>
<dd>{{ network.id|default:"None" }}</dd>
<dd>{{ network.id|default:_("None") }}</dd>
<dt>{% trans "Project ID" %}</dt>
<dd>{{ network.tenant_id|default:"-" }}</dd>
<dt>{% trans "Status" %}</dt>
<dd>{{ network.status|default:"Unknown" }}</dd>
<dd>{{ network.status|default:_("Unknown") }}</dd>
<dt>{% trans "Admin State" %}</dt>
<dd>{{ network.admin_state|default:"Unknown" }}</dd>
<dd>{{ network.admin_state|default:_("Unknown") }}</dd>
<dt>{% trans "Shared" %}</dt>
<dd>{{ network.shared|yesno|capfirst }}</dd>
<dt>{% trans "External Network" %}</dt>
<dd>{{ network.router__external|yesno|capfirst }}</dd>
{% if network.provider__network_type %}
<dt>{% trans "Provider Network" %}</dt>
<dd>{% trans "Network Type" %}: {{ network.provider__network_type|default:"Unknown" }}</dd>
<dd>{% trans "Network Type" %}: {{ network.provider__network_type|default:_("Unknown") }}</dd>
<dd>{% trans "Physical Network" %}: {{ network.provider__physical_network|default:"-" }}</dd>
<dd>{% trans "Segmentation ID" %}: {{ network.provider__segmentation_id|default:"-" }}</dd>
{% endif %}

View File

@ -7,12 +7,12 @@
<hr class="header_rule">
<dl>
<dt>{% trans "Name" %}</dt>
<dd>{{ port.name|default:"None" }}</dd>
<dd>{{ port.name|default:_("None") }}</dd>
<dt>{% trans "ID" %}</dt>
<dd>{{ port.id|default:"None" }}</dd>
<dd>{{ port.id|default:_("None") }}</dd>
{% url horizon:project:networks:detail port.network_id as network_url %}
<dt>{% trans "Network ID" %}</dt>
<dd><a href="{{ network_url }}">{{ port.network_id|default:"None" }}</a></dd>
<dd><a href="{{ network_url }}">{{ port.network_id|default:_("None") }}</a></dd>
<dt>{% trans "Project ID" %}</dt>
<dd>{{ port.tenant_id|default:"-" }}</dd>
<dt>{% trans "Fixed IP" %}</dt>
@ -27,14 +27,14 @@
{% endif %}
</dd>
<dt>{% trans "Mac Address" %}</dt>
<dd>{{ port.mac_address|default:"None" }}</dd>
<dd>{{ port.mac_address|default:_("None") }}</dd>
<dt>{% trans "Status" %}</dt>
<dd>{{ port.status|default:"None" }}</dd>
<dd>{{ port.status|default:_("None") }}</dd>
<dt>{% trans "Admin State" %}</dt>
<dd>{{ port.admin_state|default:"None" }}</dd>
<dd>{{ port.admin_state|default:_("None") }}</dd>
<dt>{% trans "Attached Device" %}</dt>
{% if port.device_id|length > 1 or port.device_owner %}
<dd><b>{% trans "Device Owner" %}</b>: {{ port.device_owner|default:"None" }}</dd>
<dd><b>{% trans "Device Owner" %}</b>: {{ port.device_owner|default:_("None") }}</dd>
<dd><b>{% trans "Device ID" %}</b>: {{ port.device_id|default:"-" }}</dd>
{% else %}
<dd>No attached device</dd>

View File

@ -7,16 +7,16 @@
<hr class="header_rule">
<dl>
<dt>{% trans "Name" %}</dt>
<dd>{{ subnet.name|default:"None" }}</dd>
<dd>{{ subnet.name|default:_("None") }}</dd>
<dt>{% trans "ID" %}</dt>
<dd>{{ subnet.id|default:"None" }}</dd>
<dd>{{ subnet.id|default:_("None") }}</dd>
{% url horizon:project:networks:detail subnet.network_id as network_url %}
<dt>{% trans "Network ID" %}</dt>
<dd><a href="{{ network_url }}">{{ subnet.network_id|default:"None" }}</a></dd>
<dd><a href="{{ network_url }}">{{ subnet.network_id|default:_("None") }}</a></dd>
<dt>{% trans "IP version" %}</dt>
<dd>{{ subnet.ipver_str|default:"-" }}</dd>
<dt>{% trans "CIDR" %}</dt>
<dd>{{ subnet.cidr|default:"None" }}</dd>
<dd>{{ subnet.cidr|default:_("None") }}</dd>
<dt>{% trans "IP allocation pool" %}</dt>
<dd>
{% for pool in subnet.allocation_pools %}

View File

@ -1,15 +1,15 @@
{% load i18n sizeformat parse_date %}
<h3>{% trans "Router Overview" %}: {{router.name|default:"None" }}</h3>
<h3>{% trans "Router Overview" %}: {{router.name|default:_("None") }}</h3>
<div class="info detail">
<dl>
<dt>{% trans "Name" %}</dt>
<dd>{{ router.name|default:"None" }}</dd>
<dd>{{ router.name|default:_("None") }}</dd>
<dt>{% trans "ID" %}</dt>
<dd>{{ router.id|default:"None" }}</dd>
<dd>{{ router.id|default:_("None") }}</dd>
<dt>{% trans "Status" %}</dt>
<dd>{{ router.status|default:"Unknown" }}</dd>
<dd>{{ router.status|default:_("Unknown") }}</dd>
{% if router.external_gateway_info %}
<dt>{% trans "External Gateway Information" %}</dt>
<dd>{% trans "Connected External Network" %}: