UWP RichTextBlock localization

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?


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>

链接地址: http://www.djcxy.com/p/67382.html

上一篇: 在Selenium 2中截取测试截图的最佳方式是?

下一篇: UWP RichTextBlock本地化