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:
- if a querystring value of "language" exists set Thread.CurrentThread.CurrentCulture to it
- 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
- it only adds the language is more than 1 locale is enabled
- 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
- 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