Using a CSS File for site localization

前端 未结 3 1936
灰色年华
灰色年华 2021-02-09 02:42

I\'m creating a website with ASP.net MVC 2.0 which uses two different languages (English and Persian). I want to have two different layouts for these languages, English has a le

3条回答
  •  感情败类
    2021-02-09 02:44

    This is the code you can use to get the Locale at the client side. Once you have the locale defined, you can dynamically include a stylesheet in the header.

    if ( navigator ) {
        if ( navigator.language ) {
            return navigator.language;
        }
        else if ( navigator.browserLanguage ) {
            return navigator.browserLanguage;
        }
        else if ( navigator.systemLanguage ) {
            return navigator.systemLanguage;
        }
        else if ( navigator.userLanguage ) {
            return navigator.userLanguage;
        }
    }
    

提交回复
热议问题