Localizing mojoPortal

Introduction


A mojoPortal based web site can be localized into any single language or culture.

mojoPortal also has partial support for multiple languages within a site using resource fallback as discussed below.

To truly support multiple languages, it is my observation and belief that you should make a separate site for each language you plan to support and you should have content authors and site administrators to support each language. If you want to cross link the language specific sites, you can easily do that in the heading section of the skin (layout.Master file) that you are using for your site. For example I would have my main site at www.somedomain.com and if I were going to also have a French site I would make it fr.somedomain.com.

Language/Culture Configuration in mojoPortal


The primary culture configuration is established in the Web.config file at the root of the site.

<globalization
            culture="auto:en-US"
            uiCulture="auto:en"
            requestEncoding="utf-8"
            responseEncoding="utf-8"
            fileEncoding="iso-8859-15" />

The globablization element is a standard ASP.NET feature, more information can be found here:

http://msdn2.microsoft.com/en-us/library/ms379546(VS.80).aspx

In the example above which comes from the standard mojoPortal Web.config file, "auto:en-US" means to try and use the Resources for the user's preferred language (as configured in the browser), but if the correct Resources cannot be found then fall back to the default language/culture for Resources which in this case is configured as en-US (English language, US region specific). You can specify any culture as the default. If you want to force a specific culture and not use Resource Fallback, you can simply remove the "auto:" from the setting and use en-US or some other language/culture.

Note: above I use the term "Resources" to mean primarily text that is used in standard labels and buttons in mojoPortal. Resources for mojoPortal are stored in the App_GlobalResouces folder. See Translating mojoPortal for more information about creating/editing Resource files. In mojoPortal, since the main developer is from the US and speaks English and since mojoPortal is under active development, the most complete Resource file is the one for English. If you use something other than en-US for the default culture, you should make sure there are no missing keys in the resource file for your default culture by comparing to th English resource file. If you update it with additional keys, please send me the update at joe dot audette [at] gmail dotcom.

Note: for more information on culture names like en-US, see this page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemGlobalizationCultureInfoClassTopic.asp

Current Languages


as of 2007-01-06, mojoPortal has at least partial translation for:

English
Czech
Dutch
German
Italian
Persian/Farsi
Portuguese - Brazil
Russian
Turkish
Spanish - Mexico

If you translate mojoPortal into another language, please send me the files so I can include them in the next release.

Resource Fallback in ASP.NET 2.0


To understand how Resource Fallback works, set your browser language preference to one of the above languages but not English, save your settings and refresh this page in the browser. For example, if I set my preferred language to Persian, the link labels at the top of the page and the Search button are now in Persian



Of course content in the content system is coming from the database and is still in the language it was authored in, this is why I say to truly support additional languages you sould make a separate site for each language with content authors and site administrators dedicated to producing and managing content for each language.

In ASP.NET, the CultureInfo property of the executing thread is what primarily determines how resources are selected and how other things like currency and dates are handled. The auto: in the globalization setting shown at the top of this page tells the runtime to set the executing thread's CultureInfo property to the culture preference passed in the request header by the browser. This happens regardless of whether a Resource file exists for the preferred culture so for example if I set my browser preferred language to Chinese - Singapore, even though there is no Resource file for that language currently in mojoPortal, the Calendar in the blog adapts using built in features of ASP.NET as shown below.


Most of us in the US are familiar with the Gregorian calendar, however there are many cultures that use different calendars than we do here in the US. The ASP.NET runtime tries to make this transparent to developers so that we don't have to think too much about supporting different calendar systems, however not all calendars are implemented fully or correctly in ASP.NET. For example, the Persian calendar is poorly implemented in ASP.NET 2.0 and was not implemented at all in ASP.NET 1.x.

Right To Left Layout


mojoPortal currently has 1 skin named RightToLeft1 that illustrates right to left layout for languages like Persian, that use right to left layout.

If you have questions or suggestions for improving localization support in mojoPortal or this documentation, please post in the Localization Issues forum.

Forcing Specific Cultures for Specific Sites in a Multi Site Installation

In Web.config:

<add key="UseCultureOverride" value="false" />

You would set this to true, then you would need to add a setting for each of your sites like:

<add key="site1culture" value="en-US" />
<add key="site2culture" value="nl-NL" />

setting the culture to be used to a valid culture string and naming the param according to your siteids.

 


Donate Money to support the mojoPortal Project.
Join the mojoPortal Group on Facebook
Join the mojoPortal Group on LinkedIn
View Joe Audette's profile on LinkedIn
View Joe Audette's profile on The Guild of Accessible Web Designers site
mojoPortal can run on GNU/Linux using Mono

ASP.NET Web Applications, Controls, Resources, Reviews
WorldOfASP.NET
view our resources 123aspx.com Directory
411ASP.NET
mojoPortal Wins the 2007 Open Source CMS Awards Best Non-PHP Open Source CMS
Share This Using Popular Bookmarking Services