开发者

Detect if any right-to-left language is installed

What is the easie开发者_如何学编程st way to detect whether any right-to-left language is installed on the host Windows OS?

(I need this in order to know if LTR marks will be displayed as squares, or work properly on the host OS)


Probably unmanaged API like IsValidLanguageGroup, IsValidLocaleName (or IsValidLocale) or IsValidCodePage is what you are looking for

For example the code

if (IsValidLanguageGroup (LGRPID_ARABIC, LGRPID_INSTALLED) ||
    IsValidLanguageGroup (LGRPID_TURKIC, LGRPID_INSTALLED) || 
    IsValidLanguageGroup (LGRPID_HEBREW, LGRPID_INSTALLED)) {
    // RTL is supported 
}

can be used to test whether you have at least one from two most known right-to-left (RTL) languages installed on the windows computer. I don't know the corresponding .NET API, but probably CultureInfo.GetCultures could be used in your case.

UPDATED: I included Thai language group in the list of language groups for testing, but I am not sure, that any of this languages you really need. Typically you application supports only selected languages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜