Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to localize javascript files in wicket

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?

like image 793
nebenmir Avatar asked Oct 20 '10 08:10

nebenmir


1 Answers

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()));
    }
}
like image 114
igor.vaynberg Avatar answered Oct 08 '22 14:10

igor.vaynberg