But wouldn't
it look even better if, we also displayed an image of the flag appropriate for the
alternative locale? Say, when the link says Deutsch, we could display the German
flag. Let's try this.
Internationalization of Images
First of all, let us simply display an image of German flag next to the link. Find an
appropriate image (or simply take the one named flag.gif from the source code
package for this chapter) and put it into the assets folder, where we already have
our styles.css file. Place a regular
![]()
tag somewhere in the page template, but
the source for it will be provided by an expansion, like this:

${localeLabel}
Now we need to add some code to the page class in order to make the flag.gif
image available to the page template. Here is the code that will do the job:
@Inject
@Path("context:/assets/flag.gif")
private Asset flag;
public Asset getFlag()
{
return flag;
}
Chapter 7
[ 187 ]
This way you can obtain any kind of asset in your code??”image, stylesheet, text or
XML file??”anything at all, as long as it is located in an appropriate directory of your
application.
Pages:
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239