apps: Fix app names and short descriptions not being translated

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati 2018-03-28 12:07:47 +05:30 committed by James Valleroy
parent 14442b1db2
commit 8451c0b2dc
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 9 additions and 6 deletions

View File

@ -17,9 +17,12 @@
from django.urls import reverse, reverse_lazy
from plinth.utils import format_lazy
class Menu(object):
"""One menu item."""
def __init__(self, label="", icon="", url="#", order=50):
"""label is the text that is displayed on the menu.
@ -60,15 +63,15 @@ class Menu(object):
"""Return menu items in sorted order according to current locale."""
return sorted(self.items, key=lambda x: (x.order, x.label))
def add_urlname(self, name, icon, urlname, short_description="", order=50, url_args=None,
url_kwargs=None):
def add_urlname(self, name, icon, urlname, short_description="", order=50,
url_args=None, url_kwargs=None):
"""Add a named URL to the menu (via add_item).
url_args and url_kwargs will be passed on to Django reverse().
"""
if short_description:
label = '{0} ({1})'.format(short_description, name)
label = format_lazy('{0} ({1})', short_description, name)
else:
label = name
url = reverse_lazy(urlname, args=url_args, kwargs=url_kwargs)

View File

@ -25,10 +25,8 @@ import random
import re
import string
from django.utils.functional import lazy
import ruamel.yaml
from plinth.modules import names
from django.utils.functional import lazy
def import_from_gi(library, version):
@ -75,6 +73,8 @@ def is_user_admin(request, cached=False):
def get_domain_names():
"""Return the domain name(s)"""
from plinth.modules import names
domain_names = []
for domain_type, domains in names.domains.items():