Commit 093b4229 authored by Baptiste Jonglez's avatar Baptiste Jonglez

[fix] i18n of 'media' and 'type' in view

parent 0e0f7b87
...@@ -2,7 +2,7 @@ from django.template import Library, Variable ...@@ -2,7 +2,7 @@ from django.template import Library, Variable
from django.conf import settings from django.conf import settings
from django import template from django import template
import random import random
from nnmon.bt.models import COUNTRIES, STATUS from nnmon.bt.models import COUNTRIES, STATUS, TYPES, MEDIA
register = Library() register = Library()
...@@ -23,3 +23,13 @@ status_map=dict(STATUS) ...@@ -23,3 +23,13 @@ status_map=dict(STATUS)
@register.filter(name='status') @register.filter(name='status')
def status(code): def status(code):
return status_map[code] return status_map[code]
types_map=dict(TYPES)
@register.filter(name='types')
def types(code):
return types_map[code]
media_map=dict(MEDIA)
@register.filter(name='media')
def media(code):
return media_map[code]
...@@ -66,8 +66,8 @@ $(document).ready(function() { ...@@ -66,8 +66,8 @@ $(document).ready(function() {
</div> </div>
<dl>{%if v.resource_name%}<dt>{% trans "Affected resource" %}</dt><dd>{{v.resource_name}}</dd>{%endif%} <dl>{%if v.resource_name%}<dt>{% trans "Affected resource" %}</dt><dd>{{v.resource_name}}</dd>{%endif%}
{%if v.type%}<dt>{% trans "Type" %}</dt><dd>{{v.type}}</dd>{%endif%} {%if v.type%}<dt>{% trans "Type" %}</dt><dd>{{v.type|types}}</dd>{%endif%}
{%if v.media%}<dt>{% trans "Media" %}</dt><dd>{{v.media}}</dd>{%endif%} {%if v.media%}<dt>{% trans "Media" %}</dt><dd>{{v.media|media}}</dd>{%endif%}
{%if v.state%}<dt>{% trans "Status" %}</dt><dd>{{v.state|status}}</dd>{%endif%} {%if v.state%}<dt>{% trans "Status" %}</dt><dd>{{v.state|status}}</dd>{%endif%}
{%if v.temporary%}<dt>{% trans "Temporary restriction" %}</dt><dd>{{v.temporary}}</dd>{%endif%} {%if v.temporary%}<dt>{% trans "Temporary restriction" %}</dt><dd>{{v.temporary}}</dd>{%endif%}
{%if v.loophole%}<dt>{% trans "Another offer provided by the same operator removes this restriction" %}</dt><dd>{% trans "yes" %}</dd>{%endif%} {%if v.loophole%}<dt>{% trans "Another offer provided by the same operator removes this restriction" %}</dt><dd>{% trans "yes" %}</dd>{%endif%}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment