【问题标题】:can I get the text direction from the culture code?我可以从文化代码中获取文本方向吗?
【发布时间】:2012-10-23 08:11:09
【问题描述】:

如果我有国家/语言组合的文化代码,是否可以从中找到文本方向。

例如,对于 en-US,我怎样才能从中得到文本方向是从左到右的?反过来从ar-EG,我怎么知道文本方向是从右到左?

【问题讨论】:

    标签: c# cultureinfo culture hebrew right-to-left


    【解决方案1】:

    这可以使用CultureInfoTextInfo.IsRightToLeft 属性轻松完成

    例子:

    CultureInfo.GetCultureInfo("ar-EG").TextInfo.IsRightToLeft; // Return True
    CultureInfo.GetCultureInfo("en-us").TextInfo.IsRightToLeft; // Return False
    CultureInfo.GetCultureInfo("he-il").TextInfo.IsRightToLeft; // Return True
    

    【讨论】:

      猜你喜欢
      • 2017-05-28
      • 1970-01-01
      • 1970-01-01
      • 2018-12-16
      • 2020-05-26
      • 1970-01-01
      • 1970-01-01
      • 2017-07-08
      • 2010-12-08
      相关资源
      最近更新 更多