[Opensource] i18n issues with errormessage not being displaye
d based on locale
Mike Traum
mtraum at cirnetwork.org
Mon Mar 31 16:10:51 PST 2003
True, but it's still pretty clean -
addError(getString("error.messagebundlekey")); instead of
addError("error.messagebundlekey");
Re: ErrorMessageBundleTag, at a glance, it seems to me that line 115 could
just be switched to this:
writer.println( myResponse.getString( oneError.getKey() ) );
Also, ErrorMessageBundleTag doesn't wrap the errors in <li></li>. I think
this sort of deviates from the design of struts 1.02 and would make it
difficult to use the along with the 'error' tag (they both use the same
header and footer messages).
Does that sound right?
mike
-----Original Message-----
From: Thompson, Kris [mailto:kris.thompson at seurat.com]
Sent: Monday, March 31, 2003 3:48 PM
To: opensource at jcorporate.com
Subject: RE: [Opensource] i18n issues with errormessage not being displayed
based on locale
Very interesting, you are getting the string from the resource bundle BEFORE
adding it to the errorCollection, while ErrorMessageBundle gets the string
from the bundle at the render time of the error.
I tend to like the latter because there is less code to write for the user.
More importantly, they user doesn't have to know anything, just how to call
addError method.
Kris Thompson
-----Original Message-----
From: Mike Traum [mailto:mtraum at cirnetwork.org]
Sent: Monday, March 31, 2003 10:49 AM
To: 'opensource at jcorporate.com'
Subject: RE: [Opensource] i18n issues with errormessage not being displayed
based on locale
I do this. I do the getString() before I do the addError(), so I'm not using
ErrorMessageBundle (just using <expresso:ErrorMessages />) and cannot verify
that it is functional.
Messages does have public static String getString(String schemaClass, Locale
l, String stringCode, Object[] args), where args are the replacement args.
But, if you're looking to display messages based on the current user's
locale, State.getString() or ControllerRespose.getString() is a better way
to go - it already knows what locale your user is in.
Our site is currently running in 3 languages, so if you have any more
questions feel free to ask...
mike
-----Original Message-----
From: Thompson, Kris [mailto:kris.thompson at seurat.com]
Sent: Friday, March 28, 2003 4:02 PM
To: opensource at jcorporate.com
Subject: [Opensource] i18n issues with errormessage not being displayed
based on locale
Is anyone able to have a multi locale site that displays error messages in
the locale of the user? I don't see how that would be possible.
I have been told that the Message class does not have a method like this
public static String getString(String schemaClass, Locale l, String
stringCode)
And that the ErrorMessageBundle.java did not pass in a locale at all to the
getMessage method.
I have made the changes and am ready to commit but I am surprised that this
bug (as I see it) exist, is there a work around that we know of?
Kris Thompson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.jcorporate.com/pipermail/opensource/attachments/20030331/d4bb3463/attachment-0002.htm
More information about the Opensource
mailing list