I would ask if know some "standard" way how to persist messages, that are to be localized later. Note, that this includes also the message parameters. For example, I have message with code "msg1" and 1 parameter in resource bundle:
msg1 = Hello {0}
and I want to associate the message with an object, persist it. Than, later, different clients will ask the object with different language settings.
obj.setDisplayMsg(msgSource.getMessage("msg1", "World", locale))
I can imagine:
- to store message as top-level object with message code and parameters. I am afraid of performance - having separate object in separate table seems to me much worse than single varchar column in case of simple error messages without translation.
- to encode message code and its parameters in string representation and use some hibernate custom type mapping
- But, isn't it already solved (preferably in spring) so I don't have to do it again?
Thanks
Update: currently, we do some half-way - we are storing message as Serialized message object in single column, within the mapped table. I'm still to fully satisfied - viewing data directly in database is not possible.