Tuesday, June 30, 2009

Localization of RDLC Reports into an Arabic Locale


The metadata of an RDLC report is defined using XML. This property makes it easier for changing the definition of an RDLC report at runtime. Currently, many developers are facing a problem in localizing RDLC reports into different languages. The most common approach used is to build a different report for each language. In this article, we will present an easy to use approach to localize reports in different locales. And, since Arabic language (same as Hebrew) uses the Right-To-Left direction property, my example will be based on the Arabic Locale to provide the most comprehensive example. I will use Windows Reporting in this example. I will be using .NET 2.0 and Visual Studio 2005.

The Linguist

The linguist is the class that will replace the words in the report with the words from the correct locale. The words and their language replacements will be placed in an XML file. Each XML file represents a language. (We could have used the Resources method of .NET which is actually equivalent to this method, because the resource files are after all XML files; but, this is also another solution to look at.)

You need to place the text that you want to replace in the report in the LocID property of the RDLC label, textbox, or any other object. Then, a loop will pass by all the objects, replacing the work or phrase in LocID property with the correct word or phrase, and setting it to the Text or Value property of the object.

See full detail: http://www.codeproject.com/KB/locale/RDLCReportsLocalization.aspx

No comments: