WP7 上的亚文化本地化未得到重视
我正在尝试本地化我的 wp7 应用程序,我需要为 de-DE
和 de-AT
使用不同的字符串,因为这两种文化之间存在一些语言差异,即使基本设置相同。
我执行了以下操作来实现此目的:
- 为默认英语文本创建了一个
AppResources.resx
文件 - 为德语文本创建了一个
AppResources.de-DE.resx
文件 - 创建了一个 < 奥地利亚文化的德语文本,
- code>AppResources.de-AT.resx 文件,用于项目属性中程序集信息...中 我将英语设置为中性语言
- 我关闭了解决方案,打开了
project.csproj
文件并将
更改为以下内容:;de-AT;de-DE - 我添加了一个新类
LocalizedStrings
,将其注册在App.xaml 中的 Application.Resources 并相应地更改了输出字符串。
模拟器和手机均设置为奥地利语言环境,System.Globalization.CultureInfo.CurrentCulture.ToString();
返回de-AT,但无论定义的文本如何使用 AppResources.de-DE.resx
中的内容,而不是文件中为奥地利文化定义的内容。
知道我如何解决这个问题吗?
I am trying to localize my wp7 application and I need to have different strings for de-DE
and de-AT
because there are some language differences between those two cultures even though the basic settings are the same.
I did the following to achieve this:
- Created an
AppResources.resx
file for the default English text - Created an
AppResources.de-DE.resx
file for the German text - Created an
AppResources.de-AT.resx
file for the German text for Austrian sub culture - in the Assembly Information... in the project properties I set English as my Neutral Language
- I closed the solution, opened up my
project.csproj
file and changed the<SupportedCultures/>
to the following:<SupportedCultures>de-AT;de-DE</SupportedCultures>
- I added a new Class
LocalizedStrings
, registered it in Application.Resources in App.xaml and changed the output string accordingly.
Both the Emulator as the handset are set to Austrian Locale, System.Globalization.CultureInfo.CurrentCulture.ToString();
returns de-AT, but regardless of that the texts defined in AppResources.de-DE.resx
are used and not the ones defined in the file for the Austrian culture.
Any idea how I might solve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该检查 CultureInfo.CurrentUICulture,而不是当今文化!
这是控制为界面加载哪些资源的属性!
CurrentUICulture 的值应与手机/模拟器中选择的值相匹配设置 ->地区+语言 ->显示语言。
理想情况下,您始终可以通过在 Thread.CurrentUICulture。
You should check the CultureInfo.CurrentUICulture, not the CurrentCulture!
That is the property that controls what resources get loaded for interface!
The value of CurrentUICulture should match the one selected in the phone/emulator Settings -> Region+Language -> Display Language.
Ideally, you can always override the system imposed CurrentUICulture by setting a different CultureInfo on Thread.CurrentUICulture.