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_failed" : "Installation failed",
|
||||
"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}'",
|
||||
|
||||
"license_undefined" : "undefined",
|
||||
|
@ -70,7 +70,7 @@
|
|||
|
||||
"dyndns_key_generating" : "DNS key is being generated, it may take a while...",
|
||||
"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_ip_update_failed" : "Unable to update IP address on DynDNS",
|
||||
"dyndns_ip_updated" : "IP address successfully updated on DynDNS",
|
||||
|
@ -80,8 +80,8 @@
|
|||
|
||||
"port_available" : "Port {port:d} is available",
|
||||
"port_unavailable" : "Port {port:d} is not available",
|
||||
"port_already_opened" : "Port {} is already opened for {:s} connections",
|
||||
"port_already_closed" : "Port {} is already closed for {:s} connections",
|
||||
"port_already_opened" : "Port {port:d} is already opened for {ip_version: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.",
|
||||
"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",
|
||||
|
@ -93,12 +93,12 @@
|
|||
"firewall_reloaded" : "Firewall successfully reloaded",
|
||||
|
||||
"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_not_terminated" : "Script execution hasn’t terminated: {path:s}",
|
||||
|
||||
"mountpoint_unknown" : "Unknown mountpoint",
|
||||
"unit_unknown" : "Unknown unit '{:s}'",
|
||||
"unit_unknown" : "Unknown unit '{unit:s}'",
|
||||
"monitor_period_invalid" : "Invalid time period",
|
||||
"monitor_stats_no_update" : "No monitoring statistics to update",
|
||||
"monitor_stats_file_not_found" : "Statistics file not found",
|
||||
|
@ -150,7 +150,7 @@
|
|||
"updating_apt_cache" : "Updating the lists of available packages...",
|
||||
"update_cache_failed" : "Unable to update APT cache",
|
||||
"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...",
|
||||
"packages_upgrade_failed" : "Unable to upgrade all packages",
|
||||
"system_upgraded" : "System successfully upgraded",
|
||||
|
@ -192,9 +192,9 @@
|
|||
"backup_deleted" : "Backup successfully deleted",
|
||||
|
||||
"field_invalid" : "Invalid field '{:s}'",
|
||||
"mail_domain_unknown" : "Unknown mail address domain '{:s}'",
|
||||
"mail_alias_remove_failed" : "Unable to remove mail alias '{:s}'",
|
||||
"mail_forward_remove_failed" : "Unable to remove mail forward '{:s}'",
|
||||
"mail_domain_unknown" : "Unknown mail address domain '{domain:s}'",
|
||||
"mail_alias_remove_failed" : "Unable to remove mail alias '{mail:s}'",
|
||||
"mail_forward_remove_failed" : "Unable to remove mail forward '{mail:s}'",
|
||||
"user_unknown" : "Unknown user",
|
||||
"system_username_exists" : "Username already exists in the system users",
|
||||
"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']
|
||||
except: error = "Server error"
|
||||
raise MoulinetteError(errno.EPERM,
|
||||
m18n.n('dyndns_registration_failed', error))
|
||||
m18n.n('dyndns_registration_failed', error=error))
|
||||
|
||||
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)
|
||||
else:
|
||||
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
|
||||
if not no_upnp and port not in firewall['uPnP'][p]:
|
||||
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)
|
||||
else:
|
||||
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
|
||||
if upnp and port in firewall['uPnP'][p]:
|
||||
firewall['uPnP'][p].remove(port)
|
||||
|
@ -335,7 +335,7 @@ def firewall_upnp(action='status', no_refresh=False):
|
|||
if action == 'status':
|
||||
no_refresh = True
|
||||
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
|
||||
if not no_refresh:
|
||||
|
|
|
@ -110,7 +110,7 @@ def hook_info(action, name):
|
|||
})
|
||||
|
||||
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 {
|
||||
'action': action,
|
||||
'name': name,
|
||||
|
|
|
@ -139,7 +139,7 @@ def monitor_disk(units=None, mountpoint=None, human_readable=False):
|
|||
for dname in devices_names:
|
||||
_set(dname, 'not-available')
|
||||
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:
|
||||
return result[result_dname]
|
||||
|
@ -237,7 +237,7 @@ def monitor_network(units=None, human_readable=False):
|
|||
'gateway': gateway,
|
||||
}
|
||||
else:
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', u))
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n('unit_unknown', unit=u))
|
||||
|
||||
if len(units) == 1:
|
||||
return result[units[0]]
|
||||
|
@ -287,7 +287,7 @@ def monitor_system(units=None, human_readable=False):
|
|||
elif u == 'infos':
|
||||
result[u] = json.loads(glances.getSystem())
|
||||
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:
|
||||
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
|
||||
if critical_upgrades:
|
||||
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:
|
||||
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']:
|
||||
raise MoulinetteError(errno.EINVAL,
|
||||
m18n.n('mail_domain_unknown',
|
||||
mail[mail.find('@')+1:]))
|
||||
domain=mail[mail.find('@')+1:]))
|
||||
|
||||
# Get random UID/GID
|
||||
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:
|
||||
raise MoulinetteError(errno.EINVAL,
|
||||
m18n.n('mail_domain_unknown',
|
||||
mail[mail.find('@')+1:]))
|
||||
domain=mail[mail.find('@')+1:]))
|
||||
del user['mail'][0]
|
||||
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:
|
||||
raise MoulinetteError(errno.EINVAL,
|
||||
m18n.n('mail_domain_unknown',
|
||||
mail[mail.find('@')+1:]))
|
||||
domain=mail[mail.find('@')+1:]))
|
||||
user['mail'].append(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)
|
||||
else:
|
||||
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']
|
||||
|
||||
if add_mailforward:
|
||||
|
@ -345,7 +345,7 @@ def user_update(auth, username, firstname=None, lastname=None, mail=None,
|
|||
user['maildrop'].remove(mail)
|
||||
else:
|
||||
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']
|
||||
|
||||
if mailbox_quota is not None:
|
||||
|
|
Loading…
Add table
Reference in a new issue