Knowledge is power. We love to share it.

News related to Mono products, services and latest developments in our community.

imarusic

ASP.NET localization settings in MonoX

09/14/2011Categories: MonoX
This tutorial is intended for MonoX administrators. It describes the localization settings and gives the details on how to use the interactive localization infrastructure that does not require recompilation of the project.

We will divide this tutorial in the following sections:

1. Localization.
2. Managing localization settings with accent on the database resource manager(DBResourceManager).
2.1. Translation of MonoX resources.
2.2. Interactive localization using the DBResourceManager.
2.3. Using MonoX administration to manage portal resources.


1. Localization

Multiple localization scenarios are fully supported in MonoX due to its flexible architecture. It is very easy to localize portal contents, as well as all administration and support utilities. A single portal instance can support unlimited number of localized sites, where each site has the same structure, but different (localized) content.

2. Managing localization settings

MonoX can be fully localized using two very different approaches. First one is standard: it involves translating MonoX resource (.resx) files using any of the publicly available resource editors. It is still better suited for scenarios in which you plan to build multiple sites on top of MonoX platform, as resources can be shared between projects. This approach is described in section 2.1.
Additionally, when you need a quick and interactive way to localize content for a single project, MonoX provides an alternative localization infrastructure that allows you to modify any of the MonoX localization resources and translate them to your language instantly. This approach is described in section 2.2.

2.1 Translation of MonoX resources

Note: Before you start translating the resources we advise you to copy the whole localization solution to your custom location: from "MonoX/Samples/Solution/LocalizationSolution" to "YourCustomFolder/LocalizationSolution" (out of the MonoX CMS folder structure). New versions of the MonoX CMS that you may upgrade to in the future will overwrite the localization solution folder with the new MonoX resources, and that is why we advise you to copy the whole localization solution to your custom, protected location. When you do so please open "YourCustomFolder/LocalizationSolution/LocalizationSolution.sln" in the Visual Studio. You can open RESX files and translate the resources as usual - they contain simple name-value pairs of strings.

After you have translated the resources you need to build the project and navigate to the localization project's "bin" folder. Copy all files and subfolders (e.g. "en-US", "hr-HR", "tr-TR", "cs-CZ") to the MonoX bin folder and overwrite all of the MonoX original localization folders. Restart the IIS application pool and refresh the portal page to get new translated resources.

2.2 Interactive localization using the DBResourceManager

MonoX includes support for completely interactive localization that does not require recompilation of the project, as all resources are stored in the database. This gives users more power and flexibility, since it would be impossible to localize all resources at run time (both built-in and custom ones) using the approach described in the previous section. Note that the previous approach still may be better if you need to share the resources between multiple projects.
It is possible to export values from database to resx files and vice versa, both for a single page/control or for a whole portal at once. To start using this approach you will have to change the default ResourceProviderModel setting in the web.config file and set it to DBResourceManager. This will enable the Portal localization management utility (found under "Other tasks" on the main administrative screen), that does the real job for all portal pages and controls.

2.3. Using MonoX administration to manage portal resources

In the following part od this tutorial I will show you how to change the existing portal resources or translate it to another language. The first step is to log in with an admin account. Username and password are the same: admin/admin.

Navigate to the portal adminstration area:



Lets assume you want to change just the existing resources for the current language. To do so, click on the portal localization option:



... and you will get the following screen:



This pane allows administrators to localize each and every localizable resource in the portal. From the drop down list you can choose one of the resources groups that you want to modify. On the left side you can select any of the localization items, change their values and save the changes to the database. Note that MonoX uses several translation engines to suggest a correct translation for each text.

The second scenario would include adding a new language to your portal. Open the language manager and add a desired language.






You can now navigate to the portal localization area, change the language to the one you just added and start changing the resources.




Note that it is possible to have only one default language. Pages in all other languages will have URLs of the form /language/LocaleName/PageName.aspx. The "language" part of this URL is configurable and can be changed - of course, you don't have to create a physical folder structure of this type for the localization tasks, as MonoX URL rewriting engine will take care of everything. The format of the localized URL is not fixed, and can be controlled by developing a custom localization handler - this task requires implementing the ILocalizationHandler interface.

You can always switch the active language using the language dropdown in the administrative toolbar on top of each page. It is important to understand the types of content that is held in resource files, as opposed to content that is also language-dependant, but localized using other tools. For example, a localized version of the site will initially have all administrative interfaces translated to the appropriate language. However, text in HTML editor Web parts will  initially hold default (English) versions, and you will be able to change it using the familiar HTML editing interface. Each localized site will hold its own version of the content. The same hold for the navigation links, as each localized site can have totally independent navigation hierarchy - you can create it in the Page management administration section. Blogs, groups, and other social networking  resources are also language-aware, so you are expected to open a separate blog (or multiple blogs) for each localization instance of the site.
Rated 3.00, 4 vote(s). 
in4man
By in4man
Hi! Could you help me? I tried localized version by replacing DBResourceManager and something went wrong. Now I have empty DataBase with localized string. Could something help, or I Must reinstall MonoX?
imarusic
Hi, can you please post it to our support forum with more details regarding the problem?

Regards
DavidZurillo
Is 2.1 still working ? I followed this and modified "My groups" to "My clubs" but am not seeing any change ?

I also notice the latest version of MonoX has no en-US folder, but does have a monox.resources.dll in the root bin folder.
imarusic
Hi,

yes, 2.1 is still working, can you please post your questions to our support forum and our support team will get back to you.

Regards.
is it possible to keep the same content in whatever language it is (and URLs) but let user switch UI (menus etc.) language on the fly? Have in mind a site containing multilingual articles, where users want to switch UI language for navigating in it
imarusic
Hi, can you please post it to our support and we will handle it there.
What happens with discussion forums? Does each localized version have their own?
In that case how can I exclude some pages from the autolocalization so that they use the English forums for example?
imarusic
Hi,

Can you please post it to our support forum( http://www.mono-software.com/support/mono/ ) and provide us with more details regarding you request.

Regards.