Merge pull request #476 from YunoHost/translate_service_descriptions

Translate service descriptions
This commit is contained in:
Bram 2018-05-21 03:26:02 +02:00 committed by GitHub
commit 646425e780
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View file

@ -335,6 +335,24 @@
"service_conf_up_to_date": "The configuration is already up-to-date for service '{service}'", "service_conf_up_to_date": "The configuration is already up-to-date for service '{service}'",
"service_conf_updated": "The configuration has been updated for service '{service}'", "service_conf_updated": "The configuration has been updated for service '{service}'",
"service_conf_would_be_updated": "The configuration would have been updated for service '{service}'", "service_conf_would_be_updated": "The configuration would have been updated for service '{service}'",
"service_description_avahi-daemon": "allows to reach your server using yunohost.local on your local network",
"service_description_dnsmasq": "handles domain name resolution (DNS)",
"service_description_dovecot": "allows e-mail client to access/fetch email (via IMAP and POP3)",
"service_description_fail2ban": "protects against bruteforce and other kind of attacks from the Internet",
"service_description_glances": "monitors system information on your server",
"service_description_metronome": "manage XMPP instant messaging accounts",
"service_description_mysql": "stores applications data (SQL database)",
"service_description_nginx": "serves or provides access to all the websites hosted on your server",
"service_description_nslcd": "handles YunoHost user shell connection",
"service_description_php5-fpm": "runs applications written in PHP with nginx",
"service_description_postfix": "used to send and receive emails",
"service_description_redis-server": "a specialized database used for rapid data access, task queue and communication between programs",
"service_description_rmilter": "checks various parameters in emails",
"service_description_rspamd": "filters spam, and other email-related features",
"service_description_slapd": "stores users, domains and related information",
"service_description_ssh": "allows you to connect remotely to your server via a terminal (SSH protocol)",
"service_description_yunohost-api": "manages interactions between the YunoHost web interface and the system",
"service_description_yunohost-firewall": "manages open and close connexion ports to services",
"service_disable_failed": "Unable to disable service '{service:s}'\n\nRecent service logs:{logs:s}", "service_disable_failed": "Unable to disable service '{service:s}'\n\nRecent service logs:{logs:s}",
"service_disabled": "The service '{service:s}' has been disabled", "service_disabled": "The service '{service:s}' has been disabled",
"service_enable_failed": "Unable to enable service '{service:s}'\n\nRecent service logs:{logs:s}", "service_enable_failed": "Unable to enable service '{service:s}'\n\nRecent service logs:{logs:s}",

View file

@ -227,6 +227,15 @@ def service_status(names=[]):
status = _get_service_information_from_systemd(name) status = _get_service_information_from_systemd(name)
translation_key = "service_description_%s" % name
description = m18n.n(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:
description = str(status.get("Description", ""))
result[name] = { result[name] = {
'status': str(status.get("SubState", "unknown")), 'status': str(status.get("SubState", "unknown")),
'loaded': "enabled" if str(status.get("LoadState", "unknown")) == "loaded" else str(status.get("LoadState", "unknown")), 'loaded': "enabled" if str(status.get("LoadState", "unknown")) == "loaded" else str(status.get("LoadState", "unknown")),
@ -235,7 +244,7 @@ def service_status(names=[]):
"timestamp": str(status.get("ActiveEnterTimestamp", "unknown")), "timestamp": str(status.get("ActiveEnterTimestamp", "unknown")),
"human": datetime.fromtimestamp(status.get("ActiveEnterTimestamp") / 1000000).strftime("%F %X"), "human": datetime.fromtimestamp(status.get("ActiveEnterTimestamp") / 1000000).strftime("%F %X"),
}, },
'description': str(status.get("Description", "")), 'description': description,
'service_file_path': str(status.get("FragmentPath", "unknown")), 'service_file_path': str(status.get("FragmentPath", "unknown")),
} }