DOWNLOAD DEMO
Current Version: 2.4.0.4 2014-07-18
Need a hand? Join the community.

Localizing mojoPortal

Rate this Content 13 Votes

Introduction

A mojoPortal content management system based website can be localized into any single language or culture.

mojoPortal CMS 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 in the MSDN documentation for the CultureInfo Class.

Important: Note that we recommend that you do NOT modify the globalization element in Web.config (except perhaps for fileEncoding), the reason is that if you set the default to a language other than English and the resource files for that language are not fully translated and have missing keys it can cause null reference exceptions to occur. We have a better way to force a specific language documented in the article Forcing a Specific Language. By using the recommended approach you can force a specific language but if there are missing keys it will fall back to English for the missing keys. English is the only language that we guarantee to not have any missing keys.

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 the 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 the National Language Support API Reference.

Current Languages

as of February 2012, mojoPortal has at least partial translation for:

Language (Locale) Culture Name
Arabic ar
Catalan ca
Chinese (China) zh-CN
Chinese (Traditional) zh-CHT
Croatian hr
Czech cs
Danish da
Dutch nl
English en
Faroese fo
French fr
French (Canada) fr-CA
German de
Greek el
Hebrew he
Hungarian hu
Italian it
Japanese jp
Nowegian no
Persian fa
Polish pl
Portuguese pt
Portuguese (Brazil) pt-BR
Russian ru
Russian (Russia) ru-RU
Slovak sk
Slovenian sl
Spanish es
Spanish (Mexico) es-MX
Swedish sv
Tamil ta
Turkish tr
Vietnamese vi

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

Right to left layout is supported in mojoPortal and can be implemented in skins designed for mojoPortal.  Asad Samarian, the Manager of our Persian Language Community site maintains several skins designed for right to left. For more information see Right To Left Layout in the skinning documentation.

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