2

I follow this example: https://cwiki.apache.org/WICKET/everything-about-wicket-internationalization.html but I didnt found how to create localization message in java code.

My situation is:

try {

...

} catch (RuntimeException e) {
  // depends on language log message and show it in feedbackPanel
  error("");
}

I know I can add there some switch because I can get current locale but I dont think this is clear solution. I want to solve it througt Page.lanugage.properties where I have all localization messages

1 Answer 1

6

Wicket provides a getString() on Component that does proper localisation.

In your example:

try {

 ...

} catch (RuntimeException e) {
    // depends on language log message and show it in feedbackPanel
    error(getString("some.property.id"));
}

Where some.property.id gets loaded via Wickets property loader from a property file.

2
  • 2
    I think you mean error(getString("some.property.id")); right? Dec 13, 2012 at 12:53
  • this doesnt works in my app. My error: error("db.exception"); and then I add to *.properties row: db.exception="CHyba aaaaaaaaa" but all I see is: db.exception in my app
    – hudi
    Dec 13, 2012 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.