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 authored and James Valleroy committed 2018-04-08 10:57:19 -04:00
1 parent 14442b1db2
commit 8451c0b2dc
2 files changed
+9 -6

No files matched your search

+6 -3
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)
+3 -3
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():