Thursday, August 07, 2008

Globalization

I have been reading through Globalization and wanted to post a quick summary on how to show your applications in many languages. The way it works is as follows You set your UI forms to localizable and change the culture in the form properties (ex. ar-EG) {for Arabic Egypt} and start playing around with the interface, change the position of the labels, change their text to display in arabic, etc... this interface will be stored associated with the culture that you selected (ar-EG).

.Net actually offers great features specially for arabic language or for Right to Left languages in general. .Net offers two new properties at the form level, if you change these properties, all the controls in the form will be affected.





The first property as per the screen shot above is called RightToLeft, when you set this property to Yes, all controls will be displaying text from Right to Left.

The other property is RightToLeftLayOut, when you set this property to True all the controls in the form will change their positions automatically to appear in the correct arabic way.

What you need to do next is, decide which culture you want to use by calling the following function to set the culture for your UI before the form is displayed.

System.Threading.Thread.CurrentUICulture = new System.Globalization.CultureInfo ("ar-EG")

note the above CurrentUICulture not CurrentCulture

the above line will instruct your application to show all the screens in arabic (ar-EG) in the same way you designed them when the culture was set to arabic (ar-EG) during design time.





Simple?

No comments: