如何使用 i18next 本地化属性(对于 jQuery UI 工具提示,在我的情况下使用标题)

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

本文关键字:我的 情况下 标题 工具提示 UI 本地化 i18next 何使用 属性 jQuery 对于      更新时间:2023-09-26

我正在检查我们是否可以在我们的项目中使用 i18next。

我发现了jQuery UI工具提示的一个问题:jQuery UI从标题属性获取工具提示内容,i18next使用data-i18n属性本地化元素内容。

http://i18next.com/pages/doc_templates.html 有指向处理jQuery UI对话框/按钮的要点的链接,我们是否必须做类似的事情,或者还有其他选择?

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

=> 翻译 hello 并将其设置为标题

在这里阅读。

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

试试这个