You could also look at the way Wicketopia does what you're talking about:

https://wicketopia.svn.sourceforge.net/svnroot/wicketopia/trunk/wicketopia/src/main/java/org/wicketopia/model/label/PropertyLabelModel.java

It's a metadata-driven approach.

On Thu, Dec 16, 2010 at 11:58 AM, James Carman
<[email protected]> wrote:
> You could use a class-qualified key
> (com.myco.domain.entity.Person.name=My Name).
>
> On Thu, Dec 16, 2010 at 11:55 AM, Matthias Keller
> <[email protected]> wrote:
>> Hi James
>>
>> Do you mean page or component scoped message properties files? Like
>> MyPage.properties?
>> Unfortunately I don't see that as a solution because this would produce
>> hundreds or properties files which would be a real nightmare to maintain
>> (our customer wants *very* frequent text changes which are way easier to do
>> if all translations are in one big file and also enables us to just send the
>> customer one file for translation instead of hundreds).
>> Or is there another way to specify a prefix for a given component?
>>
>> Thanks
>>
>> Matt
>>
>> On 2010-12-16 17:51, James Carman wrote:
>>>
>>> You can use page or component scoped messages.
>>>
>>> On Thu, Dec 16, 2010 at 11:48 AM, Matthias Keller
>>> <[email protected]>  wrote:
>>>>
>>>> Hi
>>>>
>>>> This is an issue I frequently run into and I haven't found a good
>>>> solution
>>>> yet:
>>>> I've got a Form using a CompoundPropertyModel and having lots of fields.
>>>> The easy way to do these fields is:
>>>> form.add(new RequiredTextField<String>("name"));
>>>>
>>>> The model object has a getter and setter for name, so all works well.
>>>> Unfortunately, when the user doesn't enter a valid value, the Required
>>>> error
>>>> message shows up saying something like "Field 'name' is required".
>>>> I could have a resource key "name" in my translations but this has the
>>>> limitation, that all "name" fields in my whole app are translated the
>>>> same
>>>> way. Maybe one name is a human name, the other one is a machine name
>>>> which
>>>> have different translations...
>>>> Is there an easy way to tackle this problem? For example have a prefix
>>>> prepended to the field name or something else? One thing I want to avoid
>>>> is
>>>> to set an explicit label model for every field and if possible I'm hoping
>>>> to
>>>> avoid having to create different TextField subclasses for all my pages
>>>> just
>>>> prepending that string....
>>>>
>>>> How do you do this for large applications?
>>>> Currently, we're reverting to
>>>> form.add(new RequiredTextField<String>("somepage.name", new
>>>> PropertyModel<String>(model, "name")));
>>>> which kinda defeats the whole CompoundPropertyModel stuff....
>>>>
>>>> Thanks a lot
>>>>
>>>> Matt
>>>>
>>>>
>>
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to