views:

49

answers:

1

Hallo, a Wicket i18n question: I have a javaScript file, that holds strings I want to localize. Ideally I want to localize the whole file. Something like

  • my.js
  • my_de.js
  • my_fr.js
  • ...

where wicket automatically chooses the right js file, as it does with property files.

Any one knows how to do that?

+4  A: 

Pass the locale to the resource reference:

class MyPage extends WebPage implements IHeaderContributor {
    public void renderHead(IHeaderResponse response) {
        response.renderJavascriptReference(new ResourceReference(
        MyPage.class, "my.js", getLocale(), getStyle()));
    }
}
igor.vaynberg
I came up with a solution that used PackageResource, but yours is even shorter. Thanks a lot.
nebenmir