mkn
mkn

Reputation: 13141

HTML Tags in GWT internationalization

I'm using the internationalization of GWT to manage the different languages of my application. I have a text where some words are in bold. Therefore I did the same thing as described here.

@DefaultMessage("Welcome back, {startBold,<b>}{0}{endBold,</b>}")
String testMessage(String name);

However, when I run the application, I get "Welcome back, < b>Peter< /b>" (the HTML is written out and not interpreted. I intentionally put a space between < b so that this text editor does not interpret the html tag).

Does anyone know how to solve this issue? Many thanks in advance!

P.S. Code fragment which gets the language string:

Label label = new Label(); 
label.addStyleName("intro-Text");
label.setText(new HTML(trans.testMessage(name)).getHTML());

Upvotes: 0

Views: 336

Answers (1)

z00bs
z00bs

Reputation: 7498

Instead of using a Label use the HTML widget.

HTML text = new HTML();
text.addStyleName("intro-Text");
text.setHTML(trans.testMessage(name));

Hope that helps.

Upvotes: 2

Related Questions