DNN multi-language support-Enabled multi language in DNN

Source: Internet
Author: User
Tags dnn

In general, if you need to support multiple languages, you need to install multiple language packs. This is required.

At the same time, use LanguageToken to switch between different languages.

However, in some cases, we need to switch the language automatically.

 

For example, the menu structure is as follows:

Home_EN

About US_EN

Contact US_EN

Home_CN

About US_CN

Contact US_CN

 

When you click Home_CN or Home_EN, You need to implement automatic language switching. To achieve this, you can go to the Default. aspx file.

Method: Page_Init

 Dim ps As PortalSettings = PortalController.GetCurrentPortalSettings()
Dim Language As String = "en-US"
If ps.ActiveTab.TabName.ToLower().EndsWith("cn") Then
Language = "zh-CN"
'app.Request.QueryString["language"] = "zh-CN";
'Localization.SetLanguage("zh-CN");
'System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo(Language);
Threading.Thread.CurrentThread.CurrentUICulture = New CultureInfo(Language)
Threading.Thread.CurrentThread.CurrentCulture = New CultureInfo(Language)

'System.Globalization.CultureInfo.CurrentCulture = new CultureInfo(Language);
'Localization.SetLanguage(Language)
Else
'Localization.SetLanguage("en-US");
'app.Request.QueryString["language"] = "en-US";

Threading.Thread.CurrentThread.CurrentUICulture = New CultureInfo(Language)
Threading.Thread.CurrentThread.CurrentCulture = New CultureInfo(Language)
'System.Globalization.CultureInfo.CurrentCulture = new CultureInfo(Language);
'Localization.SetLanguage(Language)
End If

 

Enjoy it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.