如何将语言名称转换为语言标识符? [英] How do I convert Language Name to Language Identifier?

查看:186
本文介绍了如何将语言名称转换为语言标识符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是一件非常简单的事情,但对于我的生活,我没有办法做到这一点..



我想使用以下方法将键盘布局更改为新语言:

 

HKL WINAPI LoadKeyboardLayout(
_In_  LPCTSTR pwszKLID,
_In_  UINT    Flags
);

然而,pwszKLID使用语言标识符,其格式为"0x00000409"。例如,对于en-US。

我所拥有的是语言名称,格式为"en-US"。

是否有Windows API函数允许我从语言名称获取语言标识符?

 

GetSystemDefaultLangID()将返回一个LANGID(语言标识符) ,但我希望得到一个LANGID语言*其他*而不是系统默认值。我认为没有办法做到这一点。

有什么建议吗?

解决方案

您好,


感谢您在此发帖。


根据我的搜索,我找不到从语言名称获取语言标识符的Windows API函数。


据我所知,您可以使用GetKeyboardLayoutList 函数获取语言标识符。


您可以使用GetKeyboardLayoutList 函数来检索与系统中当前输入语言环境集相对应的输入语言环境标识符(以前称为键盘布局句柄)。该函数将标识符复制到指定的缓冲区。


最好的问候,


Hart



This seems like an incredibly simple thing to do, but for the life of me I don't see a way to do it..

I want to change the keyboard layout to a new language using:

HKL WINAPI LoadKeyboardLayout( _In_ LPCTSTR pwszKLID, _In_ UINT    Flags );

However, pwszKLID uses a Language Identifier, which is in the format of "0x00000409" for en-US for example.

What I have is an Language Name, in the format of "en-US".

Is there a Windows API function that allows me to get a Language Identifier from a Language Name?

GetSystemDefaultLangID() will return a LANGID (Language Identifier), but I want to get a LANGID for a language *other* than the system default. I see no method that does this.

Any suggestions?

解决方案

Hi,

Thank you for posting here.

Based on my search, I cannot find windows API function that get a language identifier from a language name.

As far as I know that you can get the language identifier by using GetKeyboardLayoutList function.

you can use the GetKeyboardLayoutList function to retrieve the input locale identifiers (formerly called keyboard layout handles) corresponding to the current set of input locales in the system. The function copies the identifiers to the specified buffer.

Best Regards,

Hart


这篇关于如何将语言名称转换为语言标识符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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