mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix stupid encoding issue when fetching service description
This commit is contained in:
parent
8454f2ec12
commit
6ec0e7b6af
1 changed files with 10 additions and 6 deletions
|
@ -346,16 +346,20 @@ def _get_and_format_service_status(service, infos):
|
||||||
'configuration': "unknown",
|
'configuration': "unknown",
|
||||||
}
|
}
|
||||||
|
|
||||||
translation_key = "service_description_%s" % service
|
# Try to get description directly from services.yml
|
||||||
description = infos.get("description")
|
description = infos.get("description")
|
||||||
|
|
||||||
|
# If no description was there, try to get it from the .json locales
|
||||||
if not description:
|
if not description:
|
||||||
|
translation_key = "service_description_%s" % service
|
||||||
description = m18n.n(translation_key)
|
description = m18n.n(translation_key)
|
||||||
|
|
||||||
# that mean that we don't have a translation for this string
|
# If descrption is still equal to the translation key,
|
||||||
# that's the only way to test for that for now
|
# that mean that we don't have a translation for this string
|
||||||
# if we don't have it, uses the one provided by systemd
|
# that's the only way to test for that for now
|
||||||
if description.decode('utf-8') == translation_key:
|
# if we don't have it, uses the one provided by systemd
|
||||||
description = str(raw_status.get("Description", ""))
|
if description.decode('utf-8') == translation_key:
|
||||||
|
description = str(raw_status.get("Description", ""))
|
||||||
|
|
||||||
output = {
|
output = {
|
||||||
'status': str(raw_status.get("SubState", "unknown")),
|
'status': str(raw_status.get("SubState", "unknown")),
|
||||||
|
|
Loading…
Add table
Reference in a new issue