Commit efa2588d authored by Leo Iannacone's avatar Leo Iannacone

Locate some string with a local javascript

parent 458e2833
/**
* Translate some string
*
**/
/* Markdonw translations */
function locate_wmd() {
if ($("#wmd-button-bar").length == 0) {
// exit if there's no wmd bar
return;
}
help_button = $("#wmd-help-button a")[0];
help_button.href = "/markdown_help/";
help_button.title = "Aiuto su sintassi Markdown";
buttons = Array()
buttons["bold"] = ["Strong", "Grassetto"]
buttons["italic"] = ["Emphasis", "Corsivo"]
buttons["link"] = ["Hyperlink", "Collegamento"]
buttons["quote"] = ["Blockquote", "Citazione"]
buttons["code"] = ["Code Sample", "Codice sorgente"]
buttons["image"] = ["Image", "Immagine"]
buttons["olist"] = ["Numbered List", "Elenco numerato"]
buttons["ulist"] = ["Bulleted List", "Elenco puntato"]
buttons["heading"] = ["Heading", "Titolo"]
buttons["hr"] = ["Horizontal Rule", "Linea orizzontale"]
buttons["undo"] = ["Undo", "Annulla"]
buttons["redo"] = ["Redo", "Ripeti"]
for (key in buttons) {
id = "#wmd-" + key + "-button"
en = buttons[key][0]
it = buttons[key][1]
button = $(id)[0]
button.title = button.title.replace(en,it)
}
}
function translate_string(id, en, it) {
if ($(id).length < 1)
return;
element = $($(id)[0])
element.html(element.html().replace(en,it))
}
$(window).load(function () {
t = translate_string
// When no related question are found
$($("#ask-related-questions")[0]).bind('DOMSubtreeModified', function () {
t("#ask-related-questions div[align=center]",
"No questions like this have been found",
"Non &egrave; stata trovata alcuna domanda simile"
)
})
locate_wmd();
})
......@@ -68,6 +68,7 @@
{{ settings.CUSTOM_HEAD|or_preview:request|safe }}
{% endif %}
{% block forejs %}{% endblock %}
<script type="text/javascript" src="{% media "/media/js/l18n-it.js" %}"></script>
<link rel="search" type="application/opensearchdescription+xml" href="{% url opensearch %}" title="{{ settings.APP_SHORT_NAME }} Search" />
{% loadregistry head_content %}{% endloadregistry %}
</head>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment