Is it possible to have GWT ImageResource with locale specific url, without having to replicate the underlying images?
I read the url of an image influences SEO, one ought to pick good meaningful key words for improved ranking. So I would ideally like to have the locale specific keywords in the image url, that is the image name coming from a i18n Constants class.
Could it be as simple as calling myImageResource.setUrl? If so, does it matter when to call it?
Or is there an annotation to set the url?
Below is some code context.
public interface MyImageBundle extends ClientBundle
{
public static final MyImageBundle INSTANCE = GWT.create(MyImageBundle.class);
public static final String IMAGE_PATH = "image/";
@Source(IMAGE_PATH + "foo1.png")
ImageResource foo1();
@Source(IMAGE_PATH + "foo2.png")
ImageResource foo2();
}
In the browser, I would like the url's to look something like that:
- French:
- foo1: mydomain.com/myFrenchPath/myFrenchKeywordFoo1.png
- foo2: mydomain.com/myFrenchPath/myFrenchKeywordFoo2.png
- English:
- foo1: mydomain.com/myEnglishPath/myEnglishKeywordFoo1.png
- foo2: mydomain.com/myEnglishPath/myEnglishKeywordFoo2.png
- ...
Images foo1 & foo2 are the same in all locales, I just want the url to be locale specific.
I would ideally like the path and keywords forming the url to come from a Constants, something like:
public interface MyConstants extends com.google.gwt.i18n.client.Constants
{
String path();
String keywordFoo1();
String keywordFoo2();
}
MyConstants myConstant = (MyConstants) GWT.create(MyConstants.class);
Would the following work? Would it be the right way to go about it?
Image foo1Image = new Image(MyImageBundle.INSTANCE.foo1());
foo1Image.setUrl(myConstant.path() + "/" + myConstant.keywordFoo1() + ".png");
Or is there an annotation to set the url in MyImageBundle?