Detecting RTL Cultures

When you develop Arabic\English applications you are bound to change you may change the Forms direction to rtl, programmatically at runtime or (1) according to user settings or (2) according to the detected OS culture.  According to user settings is straightforward but what about change it according to the detected OS.

As the application loads the .NET framework inherits loads the system UI into the CurrentUICulture, you are then free to override the CurrentUICulture , if you need to display in another UI culture.

The TextInfo.IsRightToLeft property indicates the direction of each culture. This is a simple code snippet to detect the culture direction.

private static bool IsRightToLeftCulture()
return System.Globalization.CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft;


Then you can use this function to know if the culture is right-to-left, and load the appropriate resources and set the appropriate RightToLeft styles.

I hope this helps.

Comments (0)

Skip to main content