Reputation: 13972
I need to localize a TextBlock that contains these inlines.
<TextBlock Margin="0,10,0,0" TextAlignment="Center">
<Bold>NOTICE: </Bold> All the following operations require the Phone to be in <Bold>Mass Storage Mode</Bold>
</TextBlock>
Since it's not plain text, but XAML, is there a good way to localized it?
Upvotes: 1
Views: 59
Reputation: 2936
Use a Resource file (.resx). You can create multpile versions of them:
Resources.resx - default
Resouces.de-DE.resx - german
.. etc
WPF will pickup the correct one base on dispatcher thread culture, which is derived from windows culture settings. You can even set it up explicitly if you want the app to operate in different language than windows.
Here you have more details for localizing rich text
Upvotes: 2