GWT i18n and images
gwt, image, internationalization
Solution
Should be as simple as with all other source types (https://developers.google.com/web-toolkit/doc/latest/DevGuideClientBundle#I18N). In simple words, if you use something like this for text labels:
- Messages.properties
- Messages_fr.properties
- Messages_de.properties
, then try the same technique with images:
- logo.jpg
- logo_fr.jpg
- logo_de.jpg
The proper file should have been chosen depending on current locale.
So, considering the example from https://developers.google.com/web-toolkit/doc/latest/DevGuideUiBinder#Using_an_external_resource use:
<g:Image resource='{res.logo}'/>
and then have a class
/**
* Resources used by the entire application.
*/
public interface Resources extends ClientBundle {
@Source("Logo.jpg")
ImageResource logo();
...
Problem
Is there some way to easily internationalize images (using g:Image and ImageResource) in GWT? From what I can see, it is possible to internationalize the src attribute of a img element, using: ``` <img src="http://www.images.com/englishVersionOfImage.png" alt=""> <ui:attribute name="src" description="Image to be internationalized"/> </img> ``` and by changing the src value in the appropriate LocalizableResource_xxxx.properties file. However, this technique does not seem to be applicable to `<g:Image resource="{resources.MyImageResource}"/>` elements.