views:

255

answers:

2

I'm using the gwt visualization library to display motion charts in a gwt app. However, the language shown in the chart is random (different language every time it loads).

This: http://code.google.com/apis/visualization/documentation/using_overview.html#localization says I can set it, but only through the load method. But the GWT load method does not allow me to set anything other than the version and Packages.

As far as I can tell, there is no way of explicitly setting the language using the GWT API.

Any ideas?

+1  A: 

You can set the locale of a GWT application in many ways: Locales in GWT. My guess would be that the Visualization API uses that value to set its own locale value.

You should be able to do a quick test of this by appending locale=fr (change to your desired locale) to the address:

http://www.example.com/MyGwtApp.html?locale=fr

This will force that locale to be used by GWT.


Update: the AjaxLoader does support setting the language via the AjaxLoader.AjaxLoaderOptions:

AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
options.setLanguage("fr");
AjaxLoader.loadApi("visualization", "1", null, options);

I'm not sure you can use null for the callback parameter, but you get the general idea.

Igor Klimer
Thanks for the reply. The first will hopefully be useful in future, but looking through AjaxLoaderOptions suggests that the language isn't linked to GWT's locale thing.I spotted the second as well, and thought that would be it, but for some reason it does absolutely nothing for me!I'm thinking it might be a bug. Let me know if you have tried it and got it to work reliably. Cheers.
krishnaz
Unfortunately, this is based only on the docs. But it seems you are right - recently someone reported a bug report about this: http://code.google.com/p/gwt-google-apis/issues/detail?id=341 You should vote for that bug (and maybe provide some extra info in the comments there, like a code snippet) - you'll get notifications when it's resolved then too.
Igor Klimer
A: 

I've discovered that this is a bug, which I've submitted here:

http://code.google.com/p/gwt-google-apis/issues/detail?id=358

krishnaz