2016-11-18 49 views
0

在我的asp .net mvc4应用程序中,我需要实现以支持“英文”和“阿拉伯文”。在Global.asac.cs中,我设定了这样的文化。 “ar”在这里被硬编码为显示目的。我正在使用cookie来选择语言。Localize @ Html.EditorFor

protected void Application_PreRequestHandlerExecute() 
     { 
      Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("ar"); 
      Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("ar"); 
     } 

对于阿拉伯语每个HTML控件一样编辑网页,不显示阿拉伯字母时,用户打字。我如何通过语言更改来解决这个问题。

+0

[检查此链接](http://geekswithblogs.net/shaunxu/archive/2010/05/06/localization -in-asp.net-MVC-ndash的-3天查-1-day.aspx)。这可能有帮助。 – Nitin

回答

0

可以捕捉到keydown事件,并用这样的替换字符:

$('textarea').on('keydown', function(e){ 

    console.log(e.keyCode); 
    if(e.keyCode == 90){ 
     e.preventDefault(); 
     $(this).append('y').focus(); 
    } 
    if(e.keyCode == 89){ 
     e.preventDefault(); 
     $(this).append('z').focus(); 
    } 

});​