I like pretty much of the localization model in asp.mvc. You have the resx-fallback mechanism and with some html-helper methods you can easily reference your resources in your views.
ie: <%: Html.Resource("ApplicationTitle") %>
I want to know if there is something similar in WPF. If you can use something like this on xaml:
<TextBlock Text="{Binding Source=Resources.ApplicationTitle}" />
Also how to tell your application which resource file to use (default, en, en-us).
Edit:
I found how to reference resources properties directly on XAML. You can have a Language.resx file on your soluti开发者_如何学Goon and reference it on App.xaml:
<SolutionName:Language x:Key="LocalizedStrings" />
Then just use something like this on XAML:
<TextBlock Text="{Binding Path=ApplicationTitle, Source={StaticResource LocalizedStrings}}" />
The only problem now is how to decide which resource to use: Language.resx or Language.en.resx
You could easily do something like this writing a custom:
- attached property,
- behavior or
- markup extension
精彩评论