Simon Pink wrote:
Hi there,
Nutshell version:
The problem is that I cannot seem to get access to the session from within
my MessageResources, so I cannot call my 'myWebSession.getLanguageId()'
method.
Explanation:
I need a MessageResources handler too solve two issues: 1) Pulling messages
from a DB table, and 2) Pulling messages that match a users 'languageId'
which is retrieved from the DB and set into the session when they logon.
Issue number 2 is the tricky one...
The languageId is an Integer and maps to a language table (e.g.: 1 =
English, 2 = Chinese). We do not use the notion of locales for legacy
reasons. In effect, in the MessageResources.getMessage(Locale locale, String
key) method, I need to call something like:
Message message = messageFactory.getMessage(new Integer(key),
myWebSession.getLanguageId());
Of course it is my class so I can create a method to pass in the session,
but I have make sure the html:errors etc can use my MessageResources class.
Hopefully someone out there will point out that this is a simple problem,
and that I am missing something obvious...
It may be a silly question, but why don't you just set up the session
locale based on your legacy languageId? Then all the standard i18n
infrastructure will just work without any trickery.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]