开发者

WPF and Localization

开发者 https://www.devze.com 2023-01-22 07:39 出处:网络
I\'ve a quite obvious problem. Here\'s the situation: - my WPF application is primarily written in German

I've a quite obvious problem. Here's the situation: - my WPF application is primarily written in German - I've to use resx-files (standar开发者_开发技巧d way in the company) - the fallback-language must be English. - the german resources are the base for all translations (including English)

I've tried many combinations with "[assembly: NeutralResourcesLanguage("en", UltimateResourceFallbackLocation.Satellite)]" and setting in the csproj file, but unfortunately, I couldn't find one that works fine.

Thx in advance for your help! Fred


If the English resources will always have fallback values, I'd recommend embedding that language into the main assembly itself. This way you can use:

[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.MainAssembly)]

For this to work, remove the change you did to the csproj. Also note that the language you set must not be neutral, in spite of the attribute name (i.e. use en-US instead of en)

This way, satellite assemblies will only be generated for languages other than English.

You can read more here: http://compositeextensions.codeplex.com/Thread/View.aspx?ThreadId=52910

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号