如何使用 C++ API 获取操作系统语言? [英] How to get OS language using C++ API?

查看:45
本文介绍了如何使用 C++ API 获取操作系统语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个根据操作系统语言显示对话框的应用程序.如何使用 C++ 或 Windows API (Windows 2008/Vista/7) 获取操作系统语言?

I am in the process of developing a application which displays dialogs depending on the OS language. How I can get the OS language using C++ or Windows APIs (Windows 2008/Vista/7)?

推荐答案

在 Windows 中有几个函数可以做到这一点,具体取决于您想要的信息格式.在 Windows Vista 之前,语言信息被编码为 LCID(Locale Id),包括语言,以及一些关于排序和格式的信息.

There are several functions to do this in Windows, depending on what format you want the information in. Prior to Windows Vista, the language information was encoded into a LCID (Locale Id) which includes language, as well as some information about sorting and formatting.

对于 Windows Vista 和 Windows 7,设计了一个更灵活的系统,称为区域设置名称.GetSystemDefaultLocaleName

For Windows Vista and Windows 7, a more flexible system called Locale Names was devised. GetSystemDefaultLocaleName

如果您想在 Win2k 和 WinXP 上工作,请使用此选项.GetSystemDefaultLCID

Use this if you want to work on Win2k and WinXP. GetSystemDefaultLCID

这篇关于如何使用 C++ API 获取操作系统语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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