How to use i18next to localize attribute (for jQuery UI tooltip using title in my case)

1.9k Views Asked by At

I'm checking if we could use i18next with our project.

I found out one issue with jQuery UI tooltips : jQuery UI gets tooltip content from title attribute and i18next localizes element content with data-i18n attribute.

http://i18next.com/pages/doc_templates.html has links to gists handling jQuery UI dialog/button, do we have to do something similar or is there some other option?

2

There are 2 best solutions below

2
On

<a href="#" ng-i18next="[title]hello">This is a link.</a>

=> translates hello and sets it as the title

Read here.

0
On
$("SelectedElement").attr("data-i18n", "[title]YOUR_KEY").i18n();

try this