Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can I get the text direction from the culture code?

If I have the culture code for a country/language combination, is it possible to from this, find the text direction.

For example for en-US how can I get from this that the text direction is left to right? And in turn from ar-EG, how do I know the text direction is right to left?

like image 937
amateur Avatar asked Nov 02 '12 16:11

amateur


1 Answers

This can easily be done using the TextInfo.IsRightToLeft property of CultureInfo

Example:

CultureInfo.GetCultureInfo("ar-EG").TextInfo.IsRightToLeft; // Return True
CultureInfo.GetCultureInfo("en-us").TextInfo.IsRightToLeft; // Return False
CultureInfo.GetCultureInfo("he-il").TextInfo.IsRightToLeft; // Return True
like image 107
Blachshma Avatar answered Nov 07 '22 01:11

Blachshma