Windows中的语言环境列表 [英] List of locales in Windows

查看:214
本文介绍了Windows中的语言环境列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在* nix系统上,您可以执行locale -a以获得可用语言环境的列表.

Windows中的等效命令(或操作)是什么?

我在Internet上看到过列表,但是其中大多数只是区域设置标签,而不是实际的区域设置名称.另外,并非所有系统都保证可以全部安装,对吗?

请注意,我在这里对语言环境"的定义是语言环境字符串",即C的setlocale()的第二个参数,这将导致返回非NULL值.

编程答案也很好,我只是蛮力猜测Windows语言环境名称而已.

解决方案

最初,我找不到C/Win32 API来获取信息. (请参阅稍后的编辑.)但是,它看起来像.NET类 System.Globalization.CultureInfo 可以提供您所需的信息.特别是,请参见CultureInfo.GetCultures().该页面似乎有您所寻找内容的完整示例. /p>

如果您喜欢C/Win32 API,请参见此示例显示了如何转换LCID(您将从EnumSystemLocales())转换为setlocale()可以使用的字符串.

On *nix systems you can do locale -a to get a list of available locales.

What is the equivalent command (or action) in Windows?

I've seen lists on the Internet, but most of them are of just locale labels and not actual locale names. Plus, not all systems are guaranteed to have all of them installed, right?

Note that my definition of "locale" here is "locale string", i.e. a second parameter to C's setlocale() which will result in a non-NULL return value.

Programmatic answers are also fine, I'm just tired of brute force guessing Windows locale names.

解决方案

Initially, I couldn't find a C/Win32 API to get the information. (See later edit.) However, it looks like the .NET class System.Globalization.CultureInfo could provide the information you need. In particular, see CultureInfo.GetCultures(). This page seems to have a complete example of what you are looking for.

EDIT: If you prefer a C/Win32 API, see EnumSystemLocales() function.

EDIT 2: This example shows how to convert an LCID (which you get from EnumSystemLocales()) into a string useable by setlocale().

这篇关于Windows中的语言环境列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆