mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +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')
|
title = ugettext_noop('Low Memory')
|
||||||
data = {
|
data = {
|
||||||
'app_icon': 'fa-heartbeat',
|
'app_icon': 'fa-heartbeat',
|
||||||
'app_name': ugettext_noop('Diagnostics'),
|
'app_name': 'translate:' + ugettext_noop('Diagnostics'),
|
||||||
'percent_used': f'{memory_info["percent_used"]:.1f}',
|
'percent_used': f'{memory_info["percent_used"]:.1f}',
|
||||||
'memory_available': f'{memory_available:.1f}',
|
'memory_available': f'{memory_available:.1f}',
|
||||||
'memory_available_unit': 'translate:' + memory_available_unit,
|
'memory_available_unit': 'translate:' + memory_available_unit,
|
||||||
|
|||||||
@ -309,14 +309,14 @@ def warn_about_low_disk_space(request):
|
|||||||
title = ugettext_noop('Low disk space')
|
title = ugettext_noop('Low disk space')
|
||||||
data = {
|
data = {
|
||||||
'app_icon': 'fa-hdd-o',
|
'app_icon': 'fa-hdd-o',
|
||||||
'app_name': ugettext_noop('Storage'),
|
'app_name': 'translate:' + ugettext_noop('Storage'),
|
||||||
'percent_used': root_info['percent_used'],
|
'percent_used': root_info['percent_used'],
|
||||||
'free_space': format_bytes(root_info['free_bytes'])
|
'free_space': format_bytes(root_info['free_bytes'])
|
||||||
}
|
}
|
||||||
actions = [{
|
actions = [{
|
||||||
'type': 'link',
|
'type': 'link',
|
||||||
'class': 'primary',
|
'class': 'primary',
|
||||||
'text': 'Go to {app_name}',
|
'text': ugettext_noop('Go to {app_name}'),
|
||||||
'url': 'storage:index'
|
'url': 'storage:index'
|
||||||
}, {
|
}, {
|
||||||
'type': 'dismiss'
|
'type': 'dismiss'
|
||||||
@ -338,7 +338,11 @@ def report_failing_drive(id, is_failing):
|
|||||||
message = ugettext_noop(
|
message = ugettext_noop(
|
||||||
'Disk {id} is reporting that it is likely to fail in the near future. '
|
'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.')
|
'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',
|
note = Notification.update_or_create(id=notification_id, app_id='storage',
|
||||||
severity='error', title=title,
|
severity='error', title=title,
|
||||||
message=message, actions=[{
|
message=message, actions=[{
|
||||||
|
|||||||
@ -100,7 +100,7 @@ class UpgradesApp(app_module.App):
|
|||||||
|
|
||||||
data = {
|
data = {
|
||||||
'version': plinth.__version__,
|
'version': plinth.__version__,
|
||||||
'app_name': 'Update',
|
'app_name': 'translate:' + ugettext_noop('Updates'),
|
||||||
'app_icon': 'fa-refresh'
|
'app_icon': 'fa-refresh'
|
||||||
}
|
}
|
||||||
title = ugettext_noop('FreedomBox Updated')
|
title = ugettext_noop('FreedomBox Updated')
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
<div class="app-icon fa {{ note.data.app_icon }}"></div>
|
<div class="app-icon fa {{ note.data.app_icon }}"></div>
|
||||||
{% elif note.data.app_icon_filename %}
|
{% elif note.data.app_icon_filename %}
|
||||||
<img src="{% static 'theme/icons/' %}{{ note.data.app_icon_filename }}.svg"
|
<img src="{% static 'theme/icons/' %}{{ note.data.app_icon_filename }}.svg"
|
||||||
alt="{{ note.data.app_name }}"
|
alt="{{ note.data.app_name }}"
|
||||||
class="notification-icon" />
|
class="notification-icon" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user