GNU gettext 忽略设置的区域设置
我正在尝试在 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 instancechar *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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,在 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.