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:
Fioddor Superconcentrado 2020-10-09 11:35:57 +02:00 committed by Sunil Mohan Adapa
parent ff9d0ace31
commit 9cde408c86
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
4 changed files with 10 additions and 6 deletions

View File

@ -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,

View File

@ -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=[{

View File

@ -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')

View File

@ -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 %}