can I get the text direction from the culture code?
Asked Answered
F

1

6

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?

Forbidding answered 2/11, 2012 at 16:15 Comment(0)
P
7

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
Puce answered 14/11, 2012 at 10:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.