mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
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:
parent
14442b1db2
commit
8451c0b2dc
@ -17,9 +17,12 @@
|
|||||||
|
|
||||||
from django.urls import reverse, reverse_lazy
|
from django.urls import reverse, reverse_lazy
|
||||||
|
|
||||||
|
from plinth.utils import format_lazy
|
||||||
|
|
||||||
|
|
||||||
class Menu(object):
|
class Menu(object):
|
||||||
"""One menu item."""
|
"""One menu item."""
|
||||||
|
|
||||||
def __init__(self, label="", icon="", url="#", order=50):
|
def __init__(self, label="", icon="", url="#", order=50):
|
||||||
"""label is the text that is displayed on the menu.
|
"""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 menu items in sorted order according to current locale."""
|
||||||
return sorted(self.items, key=lambda x: (x.order, x.label))
|
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,
|
def add_urlname(self, name, icon, urlname, short_description="", order=50,
|
||||||
url_kwargs=None):
|
url_args=None, url_kwargs=None):
|
||||||
"""Add a named URL to the menu (via add_item).
|
"""Add a named URL to the menu (via add_item).
|
||||||
|
|
||||||
url_args and url_kwargs will be passed on to Django reverse().
|
url_args and url_kwargs will be passed on to Django reverse().
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if short_description:
|
if short_description:
|
||||||
label = '{0} ({1})'.format(short_description, name)
|
label = format_lazy('{0} ({1})', short_description, name)
|
||||||
else:
|
else:
|
||||||
label = name
|
label = name
|
||||||
url = reverse_lazy(urlname, args=url_args, kwargs=url_kwargs)
|
url = reverse_lazy(urlname, args=url_args, kwargs=url_kwargs)
|
||||||
|
|||||||
@ -25,10 +25,8 @@ import random
|
|||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from django.utils.functional import lazy
|
|
||||||
|
|
||||||
import ruamel.yaml
|
import ruamel.yaml
|
||||||
from plinth.modules import names
|
from django.utils.functional import lazy
|
||||||
|
|
||||||
|
|
||||||
def import_from_gi(library, version):
|
def import_from_gi(library, version):
|
||||||
@ -75,6 +73,8 @@ def is_user_admin(request, cached=False):
|
|||||||
|
|
||||||
def get_domain_names():
|
def get_domain_names():
|
||||||
"""Return the domain name(s)"""
|
"""Return the domain name(s)"""
|
||||||
|
from plinth.modules import names
|
||||||
|
|
||||||
domain_names = []
|
domain_names = []
|
||||||
|
|
||||||
for domain_type, domains in names.domains.items():
|
for domain_type, domains in names.domains.items():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user