Jesse van Bekkum
Jesse van Bekkum

Reputation: 1526

GWT Locale does work in address bar, does not work in meta

I have a gwt portlet with (for now) localization in English (default) and Dutch.

If I put ?locale=nl& in the address bar, I get nice Dutch texts. However, if I put <meta name="gwt:property" content="locale=nl" > in the head of my html file, without any reference to locale in the address bar, I get the English texts. When I look into the rendered html source, I can see the <meta> tag. According to the documentation it should give Dutch texts.

Does anybody have a suggestion about where I should look to fix this?

Upvotes: 0

Views: 349

Answers (3)

JuanFran Adame
JuanFran Adame

Reputation: 39

Remember to include your meta tag in the head but BEFORE the js script containing you GWT module code is called.

Upvotes: 0

Jesse van Bekkum
Jesse van Bekkum

Reputation: 1526

I found it, I put my meta tag at the end of my part, so it was after the tag. I assumed the head was loaded completely before anything was done. Stupid me.

Upvotes: 0

dimchez
dimchez

Reputation: 2004

You could set fallback property value for locale in your module's .gwt.xml which will be used as default

<set-property-fallback name="locale" value="nl" />

Then if you need to change localization (e.g. to English) set correct locale URL parameter when loading portlet.

Also remember to set these properties in you module's .gwt.xml

<extend-property name="locale" values="nl" />
<extend-property name="locale" values="en" />

Upvotes: 1

Related Questions