1
votes

We have a vaadin application and custom gwt widget included as external jar. Widget has its own translations (polish and english). The problem is, when running custom widget in external app, it does translate properly, but when it is inside a vaadin application, regardless the application (and even browser) locale - it is only in english, all the time.

Question is, how gwt custom widgets obtain information about language to use and is there any option to override this (force widget language/locale)?

1
Can you provide link to this widget? Is it public? Have you tried setLocale method on a component?kukis
Unfortunately, I can't publish this widget. I tried to setLocale method on vaadin component surrounding this widget, but it didn't help. Problem is that, where vaadin locale is server side method, it can change the data sent to client. GWT widgets we're talking about is like a full gwt application put inside a vaadin component. When published as stand-alone web-site, it takes translations from locale (default or GET param). When in vaadin widget, it does no care at all about browser locale, request language tag or GET parameter.Invader

1 Answers

0
votes

One of the problem was locale name mismatch. Where vaadin application was able to be translated ony for language-tag locale. e.g. "pl" (polish),gwt widget needed locale with country code e.g. "pl_PL" (polish, Poland).

The actual solution was to force gwt to search for locale in meta tag only and create this tag

<meta name="gwt:property" content="locale=x_X" />

on server side, respecting application language and before any gwt javascripts are attached. Unfortunately, this leads to refreshing page after language change, but I guess it cannot be done any other way due to gwt internationalization methods.