WPF,资源文件无法正常工作 [英] WPF, resource files not working properly

查看:77
本文介绍了WPF,资源文件无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我的项目中的资源文件有问题,我无法理解资源文件的行为.
信息:
一个项目女巫有3个资源文件:"UIStrings.resx","UIStrings.de-DE.resx"和"UIStrings.en-US.resx",我正在使用它们来更改语言.
问题:
如果我在"UIStrings.de-DE.resx"或/和"UIStrings.en-US.resx"中添加新字符串,例如,新字符串名称"Button"的值为"Ok",则在de.resx中可以添加值为"Gut"的"Button",该语言完全不起作用,仍为英语,而且我不知道为什么会这样,就像我可以添加int一样;在这个项目上行不通,对这个问题有什么想法吗?

如果您需要任何信息,请询问,谢谢

问候,

解决方案

首先要了解的是: http://msdn.microsoft.com/en-us/library/system. threading.thread.currentculture.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system. threading.thread.currentuiculture.aspx [ ^ ].

确保考虑到所有这些;然后您将UI本地化;经过多次测试.

—SA


您是否编写了用于访问区域性设置然后加载适当的资源文件的任何逻辑?
如果不是,那是你的问题.
如果是,我会去那里,因为再次可能是您的问题.

不知道这与int i;


有什么关系,解决方案只是将自动生成的文件放入... resource = Language;


Hello,
I have a problem with the resource files in a project i have and i cant understand the resource files behavior.
Information:
a project witch have 3 resource files: "UIStrings.resx", "UIStrings.de-DE.resx" and "UIStrings.en-US.resx" and i am using these for changhing the language.
Problem:
if i add a new string to the "UIStrings.de-DE.resx" or/and "UIStrings.en-US.resx", for exemple new string Name "Button" with value "Ok" and in the de.resx i can add "Button" with value "Gut", the language isn''t working at all, it remains in english, and i dont know why this is happening, it''s like i can add int i; at the project wont work, any ideas about this problem?

if you need any information please ask, thanks

Regards,

解决方案

First thing to understand is this: http://msdn.microsoft.com/en-us/library/21a15yht%28v=VS.100%29.aspx[^].

Also, what makes an application selecting this or that satellite assembly? It won''t happen by itself. This is a current thread culture which you need to switch to the culture you need to use.

See:
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentculture.aspx[^],
http://msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture.aspx[^].

Make sure you take this all into account; and you will get your UI localized; tested many times.

—SA


Have you written any logic that accesses your culture settings and then loades the appropriate resource file?
If not that is your problem.
If yes, I would look there, because again that is likely your problem.

Not sure what this has to do with int i;


the sollution was simply putting in the auto-generated files ...resource = Language;


这篇关于WPF,资源文件无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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