From 8451c0b2dc9c9f3ff4a4eeef4c41ebac4c67df3d Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Wed, 28 Mar 2018 12:07:47 +0530 Subject: [PATCH] apps: Fix app names and short descriptions not being translated Signed-off-by: Joseph Nuthalapati Reviewed-by: James Valleroy --- plinth/menu.py | 9 ++++++--- plinth/utils.py | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plinth/menu.py b/plinth/menu.py index 3343caeb1..074f040d9 100644 --- a/plinth/menu.py +++ b/plinth/menu.py @@ -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) diff --git a/plinth/utils.py b/plinth/utils.py index ba4cb7994..d6d88e910 100644 --- a/plinth/utils.py +++ b/plinth/utils.py @@ -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():