Can I get text direction from culture code?

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

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

+5
source share
1 answer

This is easy to do with the TextInfo.IsRightToLeft property TextInfo.IsRightToLeft in 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 
+6
source

Source: https://habr.com/ru/post/1443690/


All Articles