mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
i18n for messages
This commit is contained in:
parent
1b84d9a65f
commit
ec9deec9d4
2 changed files with 22 additions and 19 deletions
|
@ -482,6 +482,15 @@
|
||||||
"system_upgraded": "The system has been upgraded",
|
"system_upgraded": "The system has been upgraded",
|
||||||
"system_username_exists": "Username already exists in the system users",
|
"system_username_exists": "Username already exists in the system users",
|
||||||
"this_action_broke_dpkg": "This action broke dpkg/apt (the system package managers)... You can try to solve this issue by connecting through SSH and running `sudo dpkg --configure -a`.",
|
"this_action_broke_dpkg": "This action broke dpkg/apt (the system package managers)... You can try to solve this issue by connecting through SSH and running `sudo dpkg --configure -a`.",
|
||||||
|
"tools_upgrade_at_least_one": "Please specify --apps OR --system",
|
||||||
|
"tools_upgrade_cant_both": "Cannot upgrade both system and apps at the same time",
|
||||||
|
"tools_upgrade_cant_hold_critical_packages": "Unable to hold critical packages ...",
|
||||||
|
"tools_upgrade_cant_unhold_critical_packages": "Unable to unhold critical packages ...",
|
||||||
|
"tools_upgrade_regular_packages": "Now upgrading 'regular' (non-yunohost-related) packages ...",
|
||||||
|
"tools_upgrade_regular_packages_failed": "Unable to upgrade packages: {packages_list}",
|
||||||
|
"tools_upgrade_special_packages": "Now upgrading 'special' (yunohost-related) packages ...",
|
||||||
|
"tools_upgrade_special_packages_explanation": "This action will end but the actual special upgrade will continue in background. Please don't start any other action on your server in the next ~10 minutes (depending on your hardware speed). Once it's done, you may have to re-log on the webadmin.",
|
||||||
|
"tools_upgrade_special_packages_completed": "YunoHost package upgrade completed !\nPress [Enter] to get the command line back",
|
||||||
"unbackup_app": "App '{app:s}' will not be saved",
|
"unbackup_app": "App '{app:s}' will not be saved",
|
||||||
"unexpected_error": "An unexpected error occured: {error}",
|
"unexpected_error": "An unexpected error occured: {error}",
|
||||||
"unit_unknown": "Unknown unit '{unit:s}'",
|
"unit_unknown": "Unknown unit '{unit:s}'",
|
||||||
|
|
|
@ -595,12 +595,10 @@ def tools_upgrade(operation_logger, auth, apps=None, system=False):
|
||||||
raise YunohostError("dpkg_is_broken")
|
raise YunohostError("dpkg_is_broken")
|
||||||
|
|
||||||
if system is not False and apps is not None:
|
if system is not False and apps is not None:
|
||||||
# TODO : i18n
|
raise YunohostError("tools_upgrade_cant_both")
|
||||||
raise YunohostError("Cannot upgrade both system and apps at the same time")
|
|
||||||
|
|
||||||
if system is False and apps is None:
|
if system is False and apps is None:
|
||||||
# TODO : i18n
|
raise YunohostError("tools_upgrade_at_least_one")
|
||||||
raise YunohostError("Please specify --apps OR --system")
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Apps
|
# Apps
|
||||||
|
@ -650,17 +648,17 @@ def tools_upgrade(operation_logger, auth, apps=None, system=False):
|
||||||
#
|
#
|
||||||
if noncritical_packages_upgradable:
|
if noncritical_packages_upgradable:
|
||||||
|
|
||||||
# TODO : i18n
|
logger.info(m18n.n("tools_upgrade_regular_packages"))
|
||||||
logger.info("Upgrading 'regular' (non-yunohost-related) packages ...")
|
|
||||||
|
|
||||||
# TODO : factorize this in utils/packages.py ?
|
# TODO : factorize this in utils/packages.py ?
|
||||||
# Mark all critical packages as held
|
# Mark all critical packages as held
|
||||||
for package in critical_packages:
|
for package in critical_packages:
|
||||||
check_output("apt-mark hold %s" % package)
|
check_output("apt-mark hold %s" % package)
|
||||||
|
|
||||||
# Doublecheck with apt-mark showhold that packages are indeed held ...
|
# Doublecheck with apt-mark showhold that packages are indeed held ...
|
||||||
held_packages = check_output("apt-mark showhold").split("\n")
|
held_packages = check_output("apt-mark showhold").split("\n")
|
||||||
if any(p not in held_packages for p in critical_packages):
|
if any(p not in held_packages for p in critical_packages):
|
||||||
logger.warning('Unable to hold critical packages ...')
|
logger.warning(m18n.n("tools_upgrade_cant_hold_critical_packages"))
|
||||||
operation_logger.error(m18n.n('packages_upgrade_failed'))
|
operation_logger.error(m18n.n('packages_upgrade_failed'))
|
||||||
raise YunohostError(m18n.n('packages_upgrade_failed'))
|
raise YunohostError(m18n.n('packages_upgrade_failed'))
|
||||||
|
|
||||||
|
@ -672,7 +670,8 @@ def tools_upgrade(operation_logger, auth, apps=None, system=False):
|
||||||
)
|
)
|
||||||
returncode = call_async_output(dist_upgrade, callbacks, shell=True)
|
returncode = call_async_output(dist_upgrade, callbacks, shell=True)
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
logger.warning('unable to upgrade packages: %s' % ', '.join(noncritical_packages_upgradable))
|
logger.warning('tools_upgrade_regular_packages_failed',
|
||||||
|
packages_list=', '.join(noncritical_packages_upgradable))
|
||||||
operation_logger.error(m18n.n('packages_upgrade_failed'))
|
operation_logger.error(m18n.n('packages_upgrade_failed'))
|
||||||
raise YunohostError(m18n.n('packages_upgrade_failed'))
|
raise YunohostError(m18n.n('packages_upgrade_failed'))
|
||||||
|
|
||||||
|
@ -681,8 +680,7 @@ def tools_upgrade(operation_logger, auth, apps=None, system=False):
|
||||||
#
|
#
|
||||||
if critical_packages_upgradable:
|
if critical_packages_upgradable:
|
||||||
|
|
||||||
# TODO : i18n
|
logger.info(m18n.n("tools_upgrade_special_packages"))
|
||||||
logger.info("Upgrading 'special' (yunohost-related) packages ...")
|
|
||||||
|
|
||||||
# TODO : factorize this in utils/packages.py ?
|
# TODO : factorize this in utils/packages.py ?
|
||||||
# Mark all critical packages as unheld
|
# Mark all critical packages as unheld
|
||||||
|
@ -690,9 +688,9 @@ def tools_upgrade(operation_logger, auth, apps=None, system=False):
|
||||||
check_output("apt-mark unhold %s" % package)
|
check_output("apt-mark unhold %s" % package)
|
||||||
|
|
||||||
# Doublecheck with apt-mark showhold that packages are indeed unheld ...
|
# Doublecheck with apt-mark showhold that packages are indeed unheld ...
|
||||||
unheld_packages = check_output("apt-mark showhold").split("\n")
|
held_packages = check_output("apt-mark showhold").split("\n")
|
||||||
if any(p in unheld_packages for p in critical_packages):
|
if any(p in held_packages for p in critical_packages):
|
||||||
logger.warning('Unable to unhold critical packages ...')
|
logger.warning(m18n.n("tools_upgrade_cant_unhold_critical_packages"))
|
||||||
operation_logger.error(m18n.n('packages_upgrade_failed'))
|
operation_logger.error(m18n.n('packages_upgrade_failed'))
|
||||||
raise YunohostError(m18n.n('packages_upgrade_failed'))
|
raise YunohostError(m18n.n('packages_upgrade_failed'))
|
||||||
|
|
||||||
|
@ -713,22 +711,18 @@ def tools_upgrade(operation_logger, auth, apps=None, system=False):
|
||||||
update_log_metadata = "sed -i \"s/ended_at: .*$/ended_at: $(date -u +'%Y-%m-%d %H:%M:%S.%N')/\" {}"
|
update_log_metadata = "sed -i \"s/ended_at: .*$/ended_at: $(date -u +'%Y-%m-%d %H:%M:%S.%N')/\" {}"
|
||||||
update_log_metadata = update_log_metadata.format(operation_logger.md_path)
|
update_log_metadata = update_log_metadata.format(operation_logger.md_path)
|
||||||
|
|
||||||
# TODO : i18n
|
upgrade_completed = "\n"+m18n.n("tools_upgrade_special_packages_completed")
|
||||||
upgrade_completed = "\nYunoHost package upgrade completed !\nPress [Enter] to get the command line back"
|
|
||||||
command = "({} && {} && {}; {}; echo '{}') &".format(wait_until_end_of_yunohost_command,
|
command = "({} && {} && {}; {}; echo '{}') &".format(wait_until_end_of_yunohost_command,
|
||||||
command,
|
command,
|
||||||
mark_success,
|
mark_success,
|
||||||
update_log_metadata,
|
update_log_metadata,
|
||||||
upgrade_completed)
|
upgrade_completed)
|
||||||
|
|
||||||
|
logger.warning(m18n.n("tools_upgrade_special_packages_explanation"))
|
||||||
logger.debug("Running command :\n{}".format(command))
|
logger.debug("Running command :\n{}".format(command))
|
||||||
os.system(command)
|
os.system(command)
|
||||||
return
|
return
|
||||||
|
|
||||||
# FIXME / open question : what about "permanently" mark yunohost
|
|
||||||
# as "hold" to avoid accidental deletion of it...
|
|
||||||
# (so, only unhold it during the upgrade)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.success(m18n.n('system_upgraded'))
|
logger.success(m18n.n('system_upgraded'))
|
||||||
operation_logger.success()
|
operation_logger.success()
|
||||||
|
|
Loading…
Add table
Reference in a new issue