Use the StringResourceModel with properties bundle, it is very powerful
because you can add dynamic data coming from the model. I've done some
things like this, assuming infoModel.dateFormat() returns a formated date  :

new Label("tableTitle", new StringResourceModel("table.title", this, new
Model<InfoModel>(infoModel)));

and in the properties english bundle :

table.title=This table was built on $dateFormat

And then you create a bundle for each locale you need.

Now for something more tricky, you could solve your problem like this.
Create the properties bundle :

gender.female = Female
gender.male = Male
active.yes = Yes
active.no = No

and in your code :

new StringResourceModel("gender_${gender}", this, getModel())));
new StringResourceModel("active_${active}", this, getModel())));

and in your model you simply return the key based on your condition, and it
will work magically.

Reply via email to