Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Localization logic

Return to previous page

  • 4/7/2015
  • 2895 Views

Comments

2895 Views

Localization logic

Last updated long time ago

Comments

Common

(Enter the content of this article below)

Advanced

 

Background

DotNetNuke supports a number of different localization capabilities including and Content localization.


In asp.net applications there are two different values that control localization, CurrentUICulture and CurrentCulture. These have two very different purposes

CurrentUICulture is used by the Resource Manager to look up culture-specific resources at run time - as static localization uses the resource manager this is the value that controls User Interface Localization .

CurrentCulture is the .NET representation of the default user locale of the system. This controls default number and date formatting and the like e.g. whether or not a number uses , or . as a group seperator (e.g. 1,99 or 1.99) as well as the associated currency symbol.

A shorthand to remember this would be as follows

(date, currency, double).tostring = CurrentCulture

resource.fr-CA.resx file = currentUICulture


CurrentUICulture

  • GetCultureCode function (used by Globals.NavigateURL) will attempt to read the culture from the current page, and if it cannot find it will extract it from the Thread.CurrentThread.CurrentUICulture.Name . This then controls what culture a page goes to i.e. if the page has no culture then it goes to the PortalSettings DefaultLanguage version of that page

  • When initialising a user, their profile.timezone is set via System.Threading.Thread.CurrentThread.CurrentCulture.ToString

CurrentCulture


  • when a page first loads in it's OnInit method it reads the locale of the page it sets the CurrentCulture. If the user is unauthenticated it sets the Thread.CurrentThread.CurrentCulture to this value to the same value as the System.Threading.Thread.CurrentThread.CurrentCulture.ToString

However, if the user is logged in, content localization has been enabled, and the user is in "edit" mode then Thread.CurrentThread.CurrentCulture is set based on the following rules:

  1. if a querystring value of "language" exists set Thread.CurrentThread.CurrentCulture to it
  2. if no "languge" querystring exists then if no portal exists set it to "en-us" otherwise set it to the default locale of the portal.

  • When NavigateURL is called, it detects whether it needs to append the language to the URL. To do so it follows the following rules

  1. it only adds the language is more than 1 locale is enabled
  2. if content localization is enabled it will add the language that the page culturecode is set to. If the page does not have a culturecode then it will add the language that was passed into the NavigateURL function
  3. If the EnableUrlLanguage setting is set then it will set the language to Thread.CurrentThread.CurrentCulture.Name otherwise it will set the language to the value passed into the NavigateURL function. This is an attempt to preserve the pre 5.5. behaviour (note: steps 2 and 3 are not mutually exclusive but perhaps should be - investigation is needed)


References

Contents
No sections defined
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out