Reputation: 73
A while back I have created some pages in UWP with several RichTextBlock controls. Problem is now I have to localize those RickTextBlock controls, and each have specific formatting tags (Paragraph, Bold, Underline, Span, etc...).
Unlike other controls I can't seem to find a way to use the x:Uid tag inside the RichTextBlock xaml to access my Resources.resw files.
Has anyone been able to localize these controls? I am also looking for strategies on how to translate sentences which have just some of the words in bold or underline... in other words, how do you do translation and still maintain the formatting?
Upvotes: 0
Views: 411
Reputation: 8591
You could use <Run/>
tag to show the text in the specific format tags instead of putting text string in the format tags directly. Then, you could use x:Uid
to do localization for the text.
For example:
<RichTextBlock TextIndent="12" >
<Paragraph TextIndent="24">
<Run x:Uid="first" Text="First paragraph."></Run>
</Paragraph>
<Paragraph>
<Run x:Uid="second" Text="Second paragraph."></Run>
</Paragraph>
<Paragraph>
<Run x:Uid="third" Text="Third paragraph."></Run>
<Bold>
<Run x:Uid="blodtext" Text="With an inline."></Run>
</Bold>
</Paragraph>
</RichTextBlock>
Upvotes: 2