mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix cases where we want to test if translation exists for a key
This commit is contained in:
parent
2ab330a0e2
commit
4131ddb070
2 changed files with 5 additions and 9 deletions
|
@ -449,9 +449,8 @@ class Diagnoser():
|
|||
@staticmethod
|
||||
def get_description(id_):
|
||||
key = "diagnosis_description_" + id_
|
||||
descr = m18n.n(key)
|
||||
# If no description available, fallback to id
|
||||
return descr if descr != key else id_
|
||||
return m18n.n(key) if m18n.key_exists(key) else id_
|
||||
|
||||
@staticmethod
|
||||
def i18n(report, force_remove_html_tags=False):
|
||||
|
|
|
@ -352,14 +352,11 @@ def _get_and_format_service_status(service, infos):
|
|||
|
||||
# If no description was there, try to get it from the .json locales
|
||||
if not description:
|
||||
translation_key = "service_description_%s" % service
|
||||
description = m18n.n(translation_key)
|
||||
|
||||
# If descrption is still equal to the translation key,
|
||||
# that mean that we don't have a translation for this string
|
||||
# that's the only way to test for that for now
|
||||
# if we don't have it, uses the one provided by systemd
|
||||
if description == translation_key:
|
||||
translation_key = "service_description_%s" % service
|
||||
if m18n.key_exists(translation_key):
|
||||
description = m18n.key_exists(translation_key)
|
||||
else:
|
||||
description = str(raw_status.get("Description", ""))
|
||||
|
||||
output = {
|
||||
|
|
Loading…
Add table
Reference in a new issue