mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
setup: Translate errors when installing/updating/repairing apps
- Currently, we are taking a error string and formatting it before it can be looked up for translation. This causes the lookups to always fail. - Don't format the error messages and send them as is. Let the Operation.translate_message and Notification take care of translation. Formatting will be them after translation. Set the formatting keys as they need so that exception string is inserted into the message Tests: - Set language to Spanish. Through code changes raise an exception in bepasty.privileged.setup(). Try to install bepasty app. Setup will fail and error message will shown. The error message will be localized and formatted with the patch. This is true in the app error message and in the notification. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
9459ef4be4
commit
e9adc5ce68
@ -75,14 +75,11 @@ def _run_setup_on_app(app, current_version, repair: bool = False):
|
||||
except Exception as exception:
|
||||
exception_to_update = exception
|
||||
if not current_version:
|
||||
message = gettext_noop('Error installing app: {error}').format(
|
||||
error=exception)
|
||||
message = gettext_noop('Error installing app: {exception}')
|
||||
elif repair:
|
||||
message = gettext_noop('Error repairing app: {error}').format(
|
||||
error=exception)
|
||||
message = gettext_noop('Error repairing app: {exception}')
|
||||
else:
|
||||
message = gettext_noop('Error updating app: {error}').format(
|
||||
error=exception)
|
||||
message = gettext_noop('Error updating app: {exception}')
|
||||
else:
|
||||
if not current_version:
|
||||
message = gettext_noop('App installed.')
|
||||
@ -320,8 +317,8 @@ def _get_apps_for_regular_setup():
|
||||
1. essential apps that are not up-to-date
|
||||
2. non-essential app that are installed and need updates
|
||||
"""
|
||||
if (app.info.is_essential and app.get_setup_state()
|
||||
!= app_module.App.SetupState.UP_TO_DATE):
|
||||
if (app.info.is_essential and
|
||||
app.get_setup_state() != app_module.App.SetupState.UP_TO_DATE):
|
||||
return True
|
||||
|
||||
if app.get_setup_state() == app_module.App.SetupState.NEEDS_UPDATE:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user