[i18n] Applying localization to elements with non-empty titles

This way links will display the correct tooltip when hovering them
pull/911/head
Alberto García Hierro 5 years ago
parent 7f130d95c4
commit c023b94166

@ -19,8 +19,12 @@ function localize() {
$('[data-i18n]:not(.i18n-replaced)').each(function() { $('[data-i18n]:not(.i18n-replaced)').each(function() {
var element = $(this); var element = $(this);
element.html(translate(element.data('i18n'))); const translated = translate(element.data('i18n'));
element.html(translated);
element.addClass('i18n-replaced'); element.addClass('i18n-replaced');
if (element.attr("title") !== "") {
element.attr("title", translated);
}
}); });
$('[i18n_title]:not(.i18n_title-replaced)').each(function() { $('[i18n_title]:not(.i18n_title-replaced)').each(function() {
@ -52,4 +56,4 @@ function localize() {
}); });
return localized; return localized;
} }

Loading…
Cancel
Save