mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
notifications: i18n: Mark app names and extra data for translation
Helps: 1938. Testing: - Yapf applied. - Flake8 without errors or warnings for changed files. - (Unit) tests run without errors. Signed-off-by: Fioddor Superconcentrado <fioddor@gmail.com> [sunil: Translate app_name with 'translate:' prefix] [sunil: Also mark additional data] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
ff9d0ace31
commit
9cde408c86
@ -223,7 +223,7 @@ def _warn_about_low_ram_space(request):
|
||||
title = ugettext_noop('Low Memory')
|
||||
data = {
|
||||
'app_icon': 'fa-heartbeat',
|
||||
'app_name': ugettext_noop('Diagnostics'),
|
||||
'app_name': 'translate:' + ugettext_noop('Diagnostics'),
|
||||
'percent_used': f'{memory_info["percent_used"]:.1f}',
|
||||
'memory_available': f'{memory_available:.1f}',
|
||||
'memory_available_unit': 'translate:' + memory_available_unit,
|
||||
|
||||
@ -309,14 +309,14 @@ def warn_about_low_disk_space(request):
|
||||
title = ugettext_noop('Low disk space')
|
||||
data = {
|
||||
'app_icon': 'fa-hdd-o',
|
||||
'app_name': ugettext_noop('Storage'),
|
||||
'app_name': 'translate:' + ugettext_noop('Storage'),
|
||||
'percent_used': root_info['percent_used'],
|
||||
'free_space': format_bytes(root_info['free_bytes'])
|
||||
}
|
||||
actions = [{
|
||||
'type': 'link',
|
||||
'class': 'primary',
|
||||
'text': 'Go to {app_name}',
|
||||
'text': ugettext_noop('Go to {app_name}'),
|
||||
'url': 'storage:index'
|
||||
}, {
|
||||
'type': 'dismiss'
|
||||
@ -338,7 +338,11 @@ def report_failing_drive(id, is_failing):
|
||||
message = ugettext_noop(
|
||||
'Disk {id} is reporting that it is likely to fail in the near future. '
|
||||
'Copy any data while you still can and replace the drive.')
|
||||
data = {'id': id}
|
||||
data = {
|
||||
'app_icon': 'fa-hdd-o',
|
||||
'app_name': 'translate:' + ugettext_noop('Storage'),
|
||||
'id': id
|
||||
}
|
||||
note = Notification.update_or_create(id=notification_id, app_id='storage',
|
||||
severity='error', title=title,
|
||||
message=message, actions=[{
|
||||
|
||||
@ -100,7 +100,7 @@ class UpgradesApp(app_module.App):
|
||||
|
||||
data = {
|
||||
'version': plinth.__version__,
|
||||
'app_name': 'Update',
|
||||
'app_name': 'translate:' + ugettext_noop('Updates'),
|
||||
'app_icon': 'fa-refresh'
|
||||
}
|
||||
title = ugettext_noop('FreedomBox Updated')
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
<div class="app-icon fa {{ note.data.app_icon }}"></div>
|
||||
{% elif note.data.app_icon_filename %}
|
||||
<img src="{% static 'theme/icons/' %}{{ note.data.app_icon_filename }}.svg"
|
||||
alt="{{ note.data.app_name }}"
|
||||
alt="{{ note.data.app_name }}"
|
||||
class="notification-icon" />
|
||||
{% endif %}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user