Make the alert type in horizon.alert translatable

Instead of just capitalizing the class name, I do a lookup in a
dictionary of human-readable (and translatable) names for the
different alert types. This also lets me use "Notice" in place of
"info", which sounds better at least to my ears.

Change-Id: I985c25a7228aee9cf1cbce222cec4bca0db05d35
Closes-bug: #1224347
This commit is contained in:
Radomir Dopieralski 2013-11-06 15:07:58 +01:00
parent b8ff4804e1
commit 9dc2da30bd
2 changed files with 8 additions and 2 deletions

View File

@ -7,7 +7,13 @@ horizon.alert = function (type, message, extra_tags) {
var template = horizon.templates.compiled_templates["#alert_message_template"],
params = {
"type": type,
"type_capitalized": horizon.utils.capitalize(type),
"type_display": {
'danger': gettext("Danger"),
'warning': gettext("Warning"),
'info': gettext("Notice"),
'success': gettext("Success"),
'error': gettext("Error")
}[type],
"message": message,
"safe": safe
};

View File

@ -8,7 +8,7 @@
<div class="alert alert-block fade in alert-[[type]]">
<a class="close" data-dismiss="alert" href="#">&times;</a>
<p>
<strong>[[type_capitalized]]: </strong>
<strong>[[type_display]]: </strong>
[[#safe]]
[[[message]]]
[[/safe]]