Saturday, February 12, 2005
by Nik Kalyani
Saturday, February 12, 2005 9:26:26 AM (Pacific Standard Time, UTC-08:00)

As I prepare new releases of my modules for DNN 2.x, I am trying to add as many features as possible that will make the transition to DNN 3.x easy. One of these is localization. DNN 3.x uses non-compiled .resx files to store localized resource strings. The files are stored in sub-directories of the control to which they apply.

This is all quite good because it allows different modules to be installed with their supporting resx files. However, after careful consideration, I decided I am not going to follow this route for any Speerio products. There are two reasons for this:

1) The resx format is too verbose for my needs and does not offer any significant advantage to a standard XML file other than the ability to store binary resources.

2) The location of files is difficult to manage. I think grouping of files by locale is more logical than grouping based on the control the file belongs to.

So, I have created the Speerio.Web.Globalization class which I can use interchangably in DNN 2.x and DNN 3.x. The file format is very simple:


 
 

The file is named {AppName}.locale.xml  (example: FileManager.en-US.xml)

All files go into ~/Controls/Speerio/Globalization/{locale}

Example: ~/Controls/Speerio/Globalization/en-US/FileManager.en-US.xml

Now, when I am ready to have a Spanish version of my modules, I have to copy the contents of the en-US folder into es-US, rename the files to include the correct locale, zip up the folder and email it to the translator. With a handy batch file and using the cool command line WinZip add-on, I can do this in about a minute. When the translated files arrive, I unzip them back into the folder and I am done.

I am assigning each Speerio control a "Locale" property. Once set, this will ensure that the correct language file is read and cached (by a class that inherits from DictionaryBase and caches based on a filedependency on the xml file). The property also

I am not sure my way is better. From a performance standpoint, there is no difference since after first request strings are read from cache. But I do think my way is easier to manager and more intuitive. Besides it gets me localization in DNN 2.x and DNN 3.x.

 

Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, i, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview
RSS feed
Search and Links
Bling

View Nik Kalyani's profile on LinkedIn

Contact me: nik*kalyani.com (replace "*")

TechBubble
www.flickr.com
This is a Flickr badge showing public photos from techbubble. Make your own badge here.
Statistics
Total Posts: 204
This Year: 22
This Month: 0
This Week: 0
Comments: 231
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008
Nik Kalyani
Sign In
All Content © 2008, Nik Kalyani