mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Use named arguments with m18n.
This commit is contained in:
parent
468199c78f
commit
4cabb2f7f9
7 changed files with 24 additions and 24 deletions
|
@ -5,7 +5,7 @@
|
||||||
"installation_complete" : "Installation complete",
|
"installation_complete" : "Installation complete",
|
||||||
"installation_failed" : "Installation failed",
|
"installation_failed" : "Installation failed",
|
||||||
"unexpected_error" : "An unexpected error occured",
|
"unexpected_error" : "An unexpected error occured",
|
||||||
"action_invalid" : "Invalid action '{:s}'",
|
"action_invalid" : "Invalid action '{action:s}'",
|
||||||
"not_enough_disk_space" : "Not enough free disk space on '{path:s}'",
|
"not_enough_disk_space" : "Not enough free disk space on '{path:s}'",
|
||||||
|
|
||||||
"license_undefined" : "undefined",
|
"license_undefined" : "undefined",
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
"dyndns_key_generating" : "DNS key is being generated, it may take a while...",
|
"dyndns_key_generating" : "DNS key is being generated, it may take a while...",
|
||||||
"dyndns_unavailable" : "Unavailable DynDNS subdomain",
|
"dyndns_unavailable" : "Unavailable DynDNS subdomain",
|
||||||
"dyndns_registration_failed" : "Unable to register DynDNS domain: {:s}",
|
"dyndns_registration_failed" : "Unable to register DynDNS domain: {error:s}",
|
||||||
"dyndns_registered" : "DynDNS domain successfully registered",
|
"dyndns_registered" : "DynDNS domain successfully registered",
|
||||||
"dyndns_ip_update_failed" : "Unable to update IP address on DynDNS",
|
"dyndns_ip_update_failed" : "Unable to update IP address on DynDNS",
|
||||||
"dyndns_ip_updated" : "IP address successfully updated on DynDNS",
|
"dyndns_ip_updated" : "IP address successfully updated on DynDNS",
|
||||||
|
@ -80,8 +80,8 @@
|
||||||
|
|
||||||
"port_available" : "Port {port:d} is available",
|
"port_available" : "Port {port:d} is available",
|
||||||
"port_unavailable" : "Port {port:d} is not available",
|
"port_unavailable" : "Port {port:d} is not available",
|
||||||
"port_already_opened" : "Port {} is already opened for {:s} connections",
|
"port_already_opened" : "Port {port:d} is already opened for {ip_version:s} connections",
|
||||||
"port_already_closed" : "Port {} is already closed for {:s} connections",
|
"port_already_closed" : "Port {port:d} is already closed for {ip_version:s} connections",
|
||||||
"iptables_unavailable" : "You cannot play with iptables here. You are either in a container or your kernel does not support it.",
|
"iptables_unavailable" : "You cannot play with iptables here. You are either in a container or your kernel does not support it.",
|
||||||
"ip6tables_unavailable" : "You cannot play with ip6tables here. You are either in a container or your kernel does not support it.",
|
"ip6tables_unavailable" : "You cannot play with ip6tables here. You are either in a container or your kernel does not support it.",
|
||||||
"upnp_dev_not_found" : "No UPnP device found",
|
"upnp_dev_not_found" : "No UPnP device found",
|
||||||
|
@ -93,12 +93,12 @@
|
||||||
"firewall_reloaded" : "Firewall successfully reloaded",
|
"firewall_reloaded" : "Firewall successfully reloaded",
|
||||||
|
|
||||||
"hook_list_by_invalid" : "Invalid property to list hook by",
|
"hook_list_by_invalid" : "Invalid property to list hook by",
|
||||||
"hook_name_unknown" : "Unknown hook name '{:s}'",
|
"hook_name_unknown" : "Unknown hook name '{name:s}'",
|
||||||
"hook_exec_failed" : "Script execution failed: {path:s}",
|
"hook_exec_failed" : "Script execution failed: {path:s}",
|
||||||
"hook_exec_not_terminated" : "Script execution hasn’t terminated: {path:s}",
|
"hook_exec_not_terminated" : "Script execution hasn’t terminated: {path:s}",
|
||||||
|
|
||||||
"mountpoint_unknown" : "Unknown mountpoint",
|
"mountpoint_unknown" : "Unknown mountpoint",
|
||||||
"unit_unknown" : "Unknown unit '{:s}'",
|
"unit_unknown" : "Unknown unit '{unit:s}'",
|
||||||
"monitor_period_invalid" : "Invalid time period",
|
"monitor_period_invalid" : "Invalid time period",
|
||||||
"monitor_stats_no_update" : "No monitoring statistics to update",
|
"monitor_stats_no_update" : "No monitoring statistics to update",
|
||||||
"monitor_stats_file_not_found" : "Statistics file not found",
|
"monitor_stats_file_not_found" : "Statistics file not found",
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
"updating_apt_cache" : "Updating the lists of available packages...",
|
"updating_apt_cache" : "Updating the lists of available packages...",
|
||||||
"update_cache_failed" : "Unable to update APT cache",
|
"update_cache_failed" : "Unable to update APT cache",
|
||||||
"packages_no_upgrade" : "There is no package to upgrade",
|
"packages_no_upgrade" : "There is no package to upgrade",
|
||||||
"packages_upgrade_critical_later" : "Critical packages ({:s}) will be upgraded later",
|
"packages_upgrade_critical_later" : "Critical packages ({packages:s}) will be upgraded later",
|
||||||
"upgrading_packages" : "Upgrading packages...",
|
"upgrading_packages" : "Upgrading packages...",
|
||||||
"packages_upgrade_failed" : "Unable to upgrade all packages",
|
"packages_upgrade_failed" : "Unable to upgrade all packages",
|
||||||
"system_upgraded" : "System successfully upgraded",
|
"system_upgraded" : "System successfully upgraded",
|
||||||
|
@ -192,9 +192,9 @@
|
||||||
"backup_deleted" : "Backup successfully deleted",
|
"backup_deleted" : "Backup successfully deleted",
|
||||||
|
|
||||||
"field_invalid" : "Invalid field '{:s}'",
|
"field_invalid" : "Invalid field '{:s}'",
|
||||||
"mail_domain_unknown" : "Unknown mail address domain '{:s}'",
|
"mail_domain_unknown" : "Unknown mail address domain '{domain:s}'",
|
||||||
"mail_alias_remove_failed" : "Unable to remove mail alias '{:s}'",
|
"mail_alias_remove_failed" : "Unable to remove mail alias '{mail:s}'",
|
||||||
"mail_forward_remove_failed" : "Unable to remove mail forward '{:s}'",
|
"mail_forward_remove_failed" : "Unable to remove mail forward '{mail:s}'",
|
||||||
"user_unknown" : "Unknown user",
|
"user_unknown" : "Unknown user",
|
||||||
"system_username_exists" : "Username already exists in the system users",
|
"system_username_exists" : "Username already exists in the system users",
|
||||||
"user_creation_failed" : "Unable to create user",
|
"user_creation_failed" : "Unable to create user",
|
||||||
|
|
|
@ -107,7 +107,7 @@ def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None
|
||||||
try: error = json.loads(r.text)['error']
|
try: error = json.loads(r.text)['error']
|
||||||
except: error = "Server error"
|
except: error = "Server error"
|
||||||
raise MoulinetteError(errno.EPERM,
|
raise MoulinetteError(errno.EPERM,
|
||||||
m18n.n('dyndns_registration_failed', error))
|
m18n.n('dyndns_registration_failed', error=error))
|
||||||
|
|
||||||
logger.success(m18n.n('dyndns_registered'))
|
logger.success(m18n.n('dyndns_registered'))
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ def firewall_allow(protocol, port, ipv4_only=False, ipv6_only=False,
|
||||||
firewall[i][p].append(port)
|
firewall[i][p].append(port)
|
||||||
else:
|
else:
|
||||||
ipv = "IPv%s" % i[3]
|
ipv = "IPv%s" % i[3]
|
||||||
logger.warning(m18n.n('port_already_opened', port, ipv))
|
logger.warning(m18n.n('port_already_opened', port=port, ip_version=ipv))
|
||||||
# Add port forwarding with UPnP
|
# Add port forwarding with UPnP
|
||||||
if not no_upnp and port not in firewall['uPnP'][p]:
|
if not no_upnp and port not in firewall['uPnP'][p]:
|
||||||
firewall['uPnP'][p].append(port)
|
firewall['uPnP'][p].append(port)
|
||||||
|
@ -140,7 +140,7 @@ def firewall_disallow(protocol, port, ipv4_only=False, ipv6_only=False,
|
||||||
firewall[i][p].remove(port)
|
firewall[i][p].remove(port)
|
||||||
else:
|
else:
|
||||||
ipv = "IPv%s" % i[3]
|
ipv = "IPv%s" % i[3]
|
||||||
logger.warning(m18n.n('port_already_closed', port, ipv))
|
logger.warning(m18n.n('port_already_closed', port=port, ip_version=ipv))
|
||||||
# Remove port forwarding with UPnP
|
# Remove port forwarding with UPnP
|
||||||
if upnp and port in firewall['uPnP'][p]:
|
if upnp and port in firewall['uPnP'][p]:
|
||||||
firewall['uPnP'][p].remove(port)
|
firewall['uPnP'][p].remove(port)
|
||||||
|
@ -335,7 +335,7 @@ def firewall_upnp(action='status', no_refresh=False):
|
||||||
if action == 'status':
|
if action == 'status':
|
||||||
no_refresh = True
|
no_refresh = True
|
||||||
else:
|
else:
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n('action_invalid', action))
|
raise MoulinetteError(errno.EINVAL, m18n.n('action_invalid', action=action))
|
||||||
|
|
||||||
# Refresh port mapping using UPnP
|
# Refresh port mapping using UPnP
|
||||||
if not no_refresh:
|
if not no_refresh:
|
||||||
|
|
|
@ -110,7 +110,7 @@ def hook_info(action, name):
|
||||||
})
|
})
|
||||||
|
|
||||||
if not hooks:
|
if not hooks:
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n('hook_name_unknown', name))
|
raise MoulinetteError(errno.EINVAL, m18n.n('hook_name_unknown', name=name))
|
||||||
return {
|
return {
|
||||||
'action': action,
|
'action': action,
|
||||||
'name': name,
|
'name': name,
|
||||||
|
|
|
@ -139,7 +139,7 @@ def monitor_disk(units=None, mountpoint=None, human_readable=False):
|
||||||
for dname in devices_names:
|
for dname in devices_names:
|
||||||
_set(dname, 'not-available')
|
_set(dname, 'not-available')
|
||||||
else:
|
else:
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', u))
|
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', unit=u))
|
||||||
|
|
||||||
if result_dname is not None:
|
if result_dname is not None:
|
||||||
return result[result_dname]
|
return result[result_dname]
|
||||||
|
@ -237,7 +237,7 @@ def monitor_network(units=None, human_readable=False):
|
||||||
'gateway': gateway,
|
'gateway': gateway,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', u))
|
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', unit=u))
|
||||||
|
|
||||||
if len(units) == 1:
|
if len(units) == 1:
|
||||||
return result[units[0]]
|
return result[units[0]]
|
||||||
|
@ -287,7 +287,7 @@ def monitor_system(units=None, human_readable=False):
|
||||||
elif u == 'infos':
|
elif u == 'infos':
|
||||||
result[u] = json.loads(glances.getSystem())
|
result[u] = json.loads(glances.getSystem())
|
||||||
else:
|
else:
|
||||||
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', u))
|
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', unit=u))
|
||||||
|
|
||||||
if len(units) == 1 and type(result[units[0]]) is not str:
|
if len(units) == 1 and type(result[units[0]]) is not str:
|
||||||
return result[units[0]]
|
return result[units[0]]
|
||||||
|
|
|
@ -380,7 +380,7 @@ def tools_upgrade(auth, ignore_apps=False, ignore_packages=False):
|
||||||
# ... and set a hourly cron up to upgrade critical packages
|
# ... and set a hourly cron up to upgrade critical packages
|
||||||
if critical_upgrades:
|
if critical_upgrades:
|
||||||
logger.info(m18n.n('packages_upgrade_critical_later',
|
logger.info(m18n.n('packages_upgrade_critical_later',
|
||||||
', '.join(critical_upgrades)))
|
packages=', '.join(critical_upgrades)))
|
||||||
with open('/etc/cron.d/yunohost-upgrade', 'w+') as f:
|
with open('/etc/cron.d/yunohost-upgrade', 'w+') as f:
|
||||||
f.write('00 * * * * root PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin apt-get install %s -y && rm -f /etc/cron.d/yunohost-upgrade\n' % ' '.join(critical_upgrades))
|
f.write('00 * * * * root PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin apt-get install %s -y && rm -f /etc/cron.d/yunohost-upgrade\n' % ' '.join(critical_upgrades))
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ def user_create(auth, username, firstname, lastname, mail, password,
|
||||||
if mail[mail.find('@')+1:] not in domain_list(auth)['domains']:
|
if mail[mail.find('@')+1:] not in domain_list(auth)['domains']:
|
||||||
raise MoulinetteError(errno.EINVAL,
|
raise MoulinetteError(errno.EINVAL,
|
||||||
m18n.n('mail_domain_unknown',
|
m18n.n('mail_domain_unknown',
|
||||||
mail[mail.find('@')+1:]))
|
domain=mail[mail.find('@')+1:]))
|
||||||
|
|
||||||
# Get random UID/GID
|
# Get random UID/GID
|
||||||
uid_check = gid_check = 0
|
uid_check = gid_check = 0
|
||||||
|
@ -301,7 +301,7 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None,
|
||||||
if mail[mail.find('@')+1:] not in domains:
|
if mail[mail.find('@')+1:] not in domains:
|
||||||
raise MoulinetteError(errno.EINVAL,
|
raise MoulinetteError(errno.EINVAL,
|
||||||
m18n.n('mail_domain_unknown',
|
m18n.n('mail_domain_unknown',
|
||||||
mail[mail.find('@')+1:]))
|
domain=mail[mail.find('@')+1:]))
|
||||||
del user['mail'][0]
|
del user['mail'][0]
|
||||||
new_attr_dict['mail'] = [mail] + user['mail']
|
new_attr_dict['mail'] = [mail] + user['mail']
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None,
|
||||||
if mail[mail.find('@')+1:] not in domains:
|
if mail[mail.find('@')+1:] not in domains:
|
||||||
raise MoulinetteError(errno.EINVAL,
|
raise MoulinetteError(errno.EINVAL,
|
||||||
m18n.n('mail_domain_unknown',
|
m18n.n('mail_domain_unknown',
|
||||||
mail[mail.find('@')+1:]))
|
domain=mail[mail.find('@')+1:]))
|
||||||
user['mail'].append(mail)
|
user['mail'].append(mail)
|
||||||
new_attr_dict['mail'] = user['mail']
|
new_attr_dict['mail'] = user['mail']
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None,
|
||||||
user['mail'].remove(mail)
|
user['mail'].remove(mail)
|
||||||
else:
|
else:
|
||||||
raise MoulinetteError(errno.EINVAL,
|
raise MoulinetteError(errno.EINVAL,
|
||||||
m18n.n('mail_alias_remove_failed', mail))
|
m18n.n('mail_alias_remove_failed', mail=mail))
|
||||||
new_attr_dict['mail'] = user['mail']
|
new_attr_dict['mail'] = user['mail']
|
||||||
|
|
||||||
if add_mailforward:
|
if add_mailforward:
|
||||||
|
@ -345,7 +345,7 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None,
|
||||||
user['maildrop'].remove(mail)
|
user['maildrop'].remove(mail)
|
||||||
else:
|
else:
|
||||||
raise MoulinetteError(errno.EINVAL,
|
raise MoulinetteError(errno.EINVAL,
|
||||||
m18n.n('mail_forward_remove_failed', mail))
|
m18n.n('mail_forward_remove_failed', mail=mail))
|
||||||
new_attr_dict['maildrop'] = user['maildrop']
|
new_attr_dict['maildrop'] = user['maildrop']
|
||||||
|
|
||||||
if mailbox_quota is not None:
|
if mailbox_quota is not None:
|
||||||
|
|
Loading…
Add table
Reference in a new issue