Hello localizers,
I've developed a solution for dynamic module localization that's easy to implement. It should work on any installation of DNN, although I've tested it only on dnn v. 4.03.
It involves dropping two files into your App_Code folder and making one call in default.aspx.vb. There is no recompilation of the core involved, no changes to the database. The asp.net engine will compile the added files on the fly.
The way it works:
You supply several localized versions of your text module on the page you're creating and write the title of the module and page in a specific way as described below. The modules are hidden if the user language doesn't match the custom-localized title in the module.
Details:
(This text is taken from one of the included files)
----------------------------------------------------
To localize your portal, just make a few changes to your module settings,
then call "LocalizePage(Page, PortalSettings, Title)" in Page_Load() of Default.aspx.vb.
Remember to include "Imports Bitpals" at the top of Default.aspx.vb.
Also drop this file and Tools.vb into your App_Code folder.
Pages are made language-aware by writing the title in this format:
-------------------------------------------
en:title-in-english;de:title-in-german ...
-------------------------------------------
"en", "de", etc. are the standard ISO language identifiers.
The code in this class picks out the title according to the currently selected
user language of the page.
Pages also have a name, which is used in the page menu (the tab name).
Write the page name in the same way to localize the menu as well.
If your page has a language-independent title, just omit any language identifiers.
To localize the contents of the page, this code will hide any module
whose title is not explicitly localized to the current user language.
If your module title has no language prefix, the module will still be visible.
If your module title includes a language prefix, but none of the languages
in the title matches the current user language, the module will be hidden.
If a language in your module title matches the user language, the module is visible.
-------------------------------------------------------
P.S. I'm just starting out with DNN, so please bear with me if there's something I've overlooked. As I implement this on my site (and get it live) I'll most likely come across these issues and find a way to work around. I've altered the page title slightly if it is served from localhost. This helps me tell the pages apart as I'm running both local and online versions at the same time. You can comment out the offending line in the GetPageTitle() function.
You can download the source code here:
http://www.bitpals.com/download/bitpals_dnn_localization.zip
I'm interested in hearing what you make of it!
Timm
www.bitpals.com (STILL under construction - sigh)