C#MVC中的jquery.i18n

C#MVC中的jquery.i18n,c#,jquery,model-view-controller,internationalization,C#,Jquery,Model View Controller,Internationalization,我在应用程序中使用jquery.i18n库进行翻译。问题是,除了从一个视图切换到另一个视图外,所有操作都按预期进行-区域设置丢失并设置为默认值。我还使用了jquery.history.js和url.min.js: var set_locale_to = function(locale) { if (locale) { $.i18n().locale = locale; } $('body').i18n(); }; jQuery(function(

我在应用程序中使用
jquery.i18n
库进行翻译。问题是,除了从一个视图切换到另一个视图外,所有操作都按预期进行-区域设置丢失并设置为默认值。我还使用了
jquery.history.js
url.min.js

var set_locale_to = function(locale) {
    if (locale) {
      $.i18n().locale = locale;
    }
    $('body').i18n();      
};

jQuery(function() {
  $.i18n().load( {
    'en': '../js/i18n/en.json',
    'ru': '../js/i18n/ru.json',
    'dk': '../js/i18n/dk.json'
  } ).done(function() {
      set_locale_to(url('?locale'));

      History.Adapter.bind(window, 'statechange', function(){
        set_locale_to(url('?locale'));
      });

      $('.switch-locale').on('click', 'a', function(e) {
        e.preventDefault();
        History.pushState(null, null, "?locale=" + $(this).data('locale'));
      });
  });

});

是否有我遗漏或做错的事情?我还尝试将
窗口设置为固定字符串,但这也不起作用

到目前为止,我使用
window.localStorage
解决了我的问题:

var set_locale_to = function(locale) {
  if (locale) {
      $.i18n().locale = locale;
    }
    $('body').i18n();
};

jQuery(function() {
  $.i18n().load( {
    'en': '../js/i18n/en.json',
    'ru': '../js/i18n/ru.json',
    'dk': '../js/i18n/dk.json'
  } ).done(function() {
    set_locale_to(url('?locale'));

    History.Adapter.bind(window, 'statechange', function(){
      set_locale_to(url('?locale'));
    });

    set_locale_to(localStorage.getItem("locale"));


    $('.switch-locale').on('click', 'a', function(e) {
      e.preventDefault();
      History.pushState(null, null, "?locale=" + $(this).data('locale'));
      localStorage.setItem("locale", $(this).data('locale'));
    });
  });
});
如果有其他解决方案,我愿意