GNU gettext 忽略设置的区域设置

发布于 2025-01-10 09:35:07 字数 405 浏览 2 评论 0原文

我正在尝试在 MS Windows 上运行的 C++ 程序中使用 GNU gettext。我设法将区域设置设置为例如 char *locale = setlocale(LC_ALL, "French_France.1252");

我检查返回的字符串,以便我知道它已完成。

然后我将环境设置为

textdomain("Test");
bindtextdomain("Test", "C:\\develop\\test\\executablesdebug\\Language\\");

然后我进行实验性翻译,例如

char *test = gettext("Hello world");

翻译后的字符串获取瑞典语翻译(操作系统设置),而不是我想要法国弦。

I'm trying to use GNU gettext in a C++ program running on MS Windows. I manage to set the locale as for instance
char *locale = setlocale(LC_ALL, "French_France.1252");

I check the returned string so I know it took.

Then I set the environment as

textdomain("Test");
bindtextdomain("Test", "C:\\develop\\test\\executablesdebug\\Language\\");

Then I do an experimental translation, like

char *test = gettext("Hello world");

And the translated string gets the Swedish translation (the operating system setting) and not the French string I wanted.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆沫 2025-01-17 09:35:07

据我所知,在 Windows 中,您还必须使用 SetThreadLocale(您必须映射到区域设置 ID,请查看 此网页)。

最后,考虑到在 Windows 中每个线程都有自己的语言环境;使用翻译为所有线程设置它。

As far as I can remember in Windows you also have to set the thread locale using SetThreadLocale (you will have to map to the locale ID, take a look at this webpage).

Finally, take into consideration that in Windows each thread has its own locale; set it for all threads using translations.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文