From c023b9416611a92e55a0a0abe70b28f7ed51ebbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Garci=CC=81a=20Hierro?= Date: Wed, 29 Jan 2020 21:58:01 +0000 Subject: [PATCH] [i18n] Applying localization to elements with non-empty titles This way links will display the correct tooltip when hovering them --- js/localization.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/localization.js b/js/localization.js index 3d309392..75e253e9 100644 --- a/js/localization.js +++ b/js/localization.js @@ -19,8 +19,12 @@ function localize() { $('[data-i18n]:not(.i18n-replaced)').each(function() { var element = $(this); - element.html(translate(element.data('i18n'))); + const translated = translate(element.data('i18n')); + element.html(translated); element.addClass('i18n-replaced'); + if (element.attr("title") !== "") { + element.attr("title", translated); + } }); $('[i18n_title]:not(.i18n_title-replaced)').each(function() { @@ -52,4 +56,4 @@ function localize() { }); return localized; -} \ No newline at end of file +}