翻译问题 - 默认显示错误的语言
我刚刚开始第一次编写多语言应用程序。我已经阅读了语言资源文件的概念,我想我明白了主要想法。我尝试实现它,并立即发现一个问题:
我已将默认语言字符串输入到resx文件中,然后添加了另一个资源文件(例如:UIStrings.en.resx)。由于我的公司不在英格兰/其他英语国家,因此我们的应用程序主要用我们的语言编写。因此,默认语言是我们的语言(斯洛文尼亚语)。
当我添加 .en.resx 文件并插入正确的翻译并运行程序时,它现在显示英语文本。我认为这是因为
CultureInfo.CurrentUICulture = "en-US"
虽然
CultureInfo.Currentculture = "sl-SI"
我认为这是因为我运行的是英语版本的Windows(尽管区域选项中的所有属性都正确设置为斯洛文尼亚语设置)。
如何使应用程序以用户语言而不是安装的 Windows 语言显示字符串?
I have just started writing a multilingual application for the very first time. I have read about the concept of language resource files and I think I get the main idea. I have tried to implement it, and instantly found an issue:
I have entered the default language strings to a resx file, and then added another resource file (for example: UIStrings.en.resx). Since my company is not based in England / other English speaking countries, our applications are primarily written in our language. Thus default language is our language (Slovenian).
When I add the .en.resx file and insert the correct translations and run the program it now displays English text. I figured that is because
CultureInfo.CurrentUICulture = "en-US"
while
CultureInfo.Currentculture = "sl-SI"
I figure this is because I am running English version of windows (though all the properties in Regional Options are set correctly to Slovenian settings).
How can I make the application display the strings in the users language, not the installed windows language?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现这篇博文可以回答我的问题。
如果其他人正在为此苦苦挣扎,请执行以下操作:
I have found out this blog post that answers my question.
If anyone else is struggling with this, here is what you do: