The messageKey() method is an internal utility, and the values it returns
are just used to cache messages uniquely -- given that they are not
publicly visible, it doesn't seem to be worth any extra processor time to
make them "user-pretty".

If you're having to manually set the key to include this, your
HashMapMessageResources implementation probably isn't locale-dependent.

Craig


On 29 Jul 2002, David M. Karr wrote:

> Date: 29 Jul 2002 10:45:19 -0700
> From: David M. Karr <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: MessageResources.messageKey("", "foo") returns ".foo"?
>
> I don't know if this is a bug or not.  Even if it is, it might be awkward to
> change the behavior that I'm seeing.
>
> The method "MessageResources.messageKey(Locale locale, String key)" returns a
> message key with the locale key concatenated with the key, with a "." between.
>
> If the locale string is the empty string, the returned message key begins with
> ".".  For instance, calling 'messageKey(".", "foo")' returns ".foo".  Is this
> really intended?  I would think it would be more natural to not have the
> leading period if the locale string was empty.
>
> I noticed this while building unit tests for the Struts-EL "errors" tag, as I
> wrote a "HashMapMessageResources" class (with a "getMessage()" method
> essentially identical to "PropertyMessageResources"), so I can easily store
> test resources in memory, as opposed to using an external file.  I had an error
> tag of "error.misc", but in order to get this to work, I had to store a key of
> ".error.misc" in my MessageResources.
>
> --
> ===================================================================
> David M. Karr          ; Java/J2EE/XML/Unix/C++
> [EMAIL PROTECTED]
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to