简体   繁体   English

jQuery中“确认”对话框的本地化

[英]Localization of Confirm dialog box in jQuery

I'm using jquery dialog box to display Confirm & Cancel button as shown below: 我正在使用jquery对话框显示“确认并取消”按钮,如下所示:

  $("#delete_user").click(function(e) {
    $("#delete_user_dialog").dialog({
      buttons : {
        "Confirm" : function() {
          $(this).dialog("close");
          DeleteUser();
        },
        "Cancel" : function() {
          $(this).dialog("close");
        }
      }
    });
    $("#delete_user_dialog").dialog("open");

}); });

Is it possible to localize this text "Confirm" & "Cancel"?? 是否可以将此文本本地化“确认”和“取消”?

thanks! 谢谢!

Really it's just a matter of storing localized counterparts for each string: Localize Strings in Javascript . 确实,这只是为每个字符串存储本地化副本的问题: Javascript中的Localize Strings

And then detecting/having the user choose their language: JavaScript for detecting browser language preference 然后检测/让用户选择他们的语言: 用于检测浏览器语言偏好的JavaScript

When you create the dialog box, just choose the correct version of the string using the above. 创建对话框时,只需使用上面的命令选择正确的字符串版本。 You will probably want to let the user opt-in to whatever language they want as opposed to automatically detecting their language every time. 您可能希望让用户选择所需的任何语言,而不是每次自动检测其语言。 That way, multilingual users won't get upset. 这样,使用多种语言的用户就不会感到烦恼。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM