Internationalize names module.

This commit is contained in:
James Valleroy 2015-11-17 19:27:37 -05:00 committed by fonfon
parent e0bfd1401f
commit d476326212
3 changed files with 11 additions and 9 deletions

View File

@ -19,7 +19,7 @@
Plinth module to configure name services
"""
from gettext import gettext as _
from django.utils.translation import ugettext as _, ugettext_lazy
import logging
from plinth import cfg
@ -27,9 +27,9 @@ from plinth.signals import domain_added, domain_removed
SERVICES = [
('http', _('HTTP'), 80),
('https', _('HTTPS'), 443),
('ssh', _('SSH'), 22),
('http', ugettext_lazy('HTTP'), 80),
('https', ugettext_lazy('HTTPS'), 443),
('ssh', ugettext_lazy('SSH'), 22),
]
depends = ['plinth.modules.system']
@ -43,7 +43,8 @@ logger = logging.getLogger(__name__)
def init():
"""Initialize the names module."""
menu = cfg.main_menu.get('system:index')
menu.add_urlname(_('Name Services'), 'glyphicon-th', 'names:index', 19)
menu.add_urlname(ugettext_lazy('Name Services'), 'glyphicon-th',
'names:index', 19)
domain_added.connect(on_domain_added)
domain_removed.connect(on_domain_removed)

View File

@ -19,10 +19,11 @@
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% block content %}
<h2>Name Services</h2>
<h2>{{ title }}</h2>
<div class="row">
<div class="col-sm-5">
@ -47,9 +48,9 @@
{% for service in name_service.services_enabled %}
<td>
{% if service %}
<span class="label label-success">Enabled</span>
<span class="label label-success">{% trans "Enabled" %}</span>
{% else %}
<span class="label label-warning">Disabled<span>
<span class="label label-warning">{% trans "Disabled" %}</span>
{% endif %}
</td>
{% endfor %}

View File

@ -20,7 +20,7 @@ Plinth module for name services
"""
from django.template.response import TemplateResponse
from gettext import gettext as _
from django.utils.translation import ugettext as _
from . import SERVICES, get_domain_types, get_description
from . import get_domain, get_services_status