Skip to content

Features: HTML Formatting

Rudy Huyn edited this page May 11, 2020 · 3 revisions

By default, resw files do not support text emphasis, which makes it more difficult to localize strings using the font style (bold, italic, underline, strike, etc.).

ReswPlus tries to solve this problem, allowing you to use HTML tags to format your strings and apply the style you want to a full string or only a part of it. This feature was created with performance in mind, to ensure that your user interface remains fluid and highly responsive, using instead of or XAML controls.

Supported tags

Emphasis Tags Options
Bold b, strong weight:
- thin, 100
- extralight, 200
- light, 300
- semilight, 350
- normal, 400
- medium, 500
- semibold, 600
- bold, 700
- extrabold, 800
- black, 900
- extrablack, 950
Italic i, em, cite, dfn
Underline u
Strike s, strike, del
Font font color:
- RGB
- ARGB
- Color names
face:
- font family name
Console text tt
Superscript text sup
Subscript text sub
Line break br
Hyperlink a href

Example

Resw:

Key Value Comment
PleaseInstallNetFramework Please <b>Install <i>.Net Framework 4.6</i></b> first.
UseDesktopBridge Use <strike>Centennial</strike> Desktop Bridge to convert your app

Usage:

<TextBlock reswplus:TextBlock.HtmlText="{x:Bind strings:Resources.PleaseInstallNetFramework}" />
<TextBlock reswplus:TextBlock.HtmlText="{x:Bind strings:Resources.UseDesktopBridge}" />

Result:

image

You can also combine all the other ReswPlus features with HTML tags, like string formatting, parameters, etc...

Resw:

Key Value Comment
HelloUsername Hello <b>{0}</b>, have a good {1}? #Format[String username, WEEKDAY]
SendDocumentToUser Send <i>{0}</i> to <b>{1}</b>. #Format[String filename, String username]

Usage:

<TextBlock reswplus:TextBlock.HtmlText="{x:Bind strings:Resources.SendDocumentToUser(DocumentNameTextBox.Text, UsernameTextBox.Text), Mode=OneWay}" />
<TextBlock reswplus:TextBlock.HtmlText="{x:Bind strings:Resources.HelloUsername(UsernameTextBox.Text)}" />

Result:

image