I haven't been using JSTL for i18n yet, just struts taglibs so I found
the below very interesting when considering a move...  I found this on
the web: http://www.junlu.com/msg/30187.html  

The link suggests if you have a preferred approach, you can change the
jstl resources configured to be used so they match what you expect.
There's a code snippet in the link but I haven't tried it.  I would
guess you would configure the appropriate resources to use in a base
action or filter as mentioned in the link so that your front-end code
would never see it.  Please write back what you find, I'm very
interested in if you are able to change the i18n so it works as I'm
accustomed to.

Thanks!...djsuarez

-----Original Message-----
From: Angie Lin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 24, 2005 7:34 PM
To: user@struts.apache.org
Subject: [OT] i18n: fmt:message versus bean:message

This is off-topic, but in my Struts application, I've used all 
<fmt:message> tags instead of <bean:messsage> tags and I'm encountering 
issues with my l10n.

My questions:
1.  Is it correct that JSTL fmt:message will NOT follow the parent 
chain of resources at an individual property level?
2.  And is there anyway to force a parent chain?


(read on if for my test case)


I know that ResourceBundle establishes a parent chain by successively 
removing variant, country and language.  Struts does the same thing 
though it doesn't actually use ResourceBundle - it has 
PropertyMessageResources.

I know that JSTL doesn't follow the same lookup path.  It instead only 
looks for specific locales (ServletRequest.getLocales() listed in order 
of preference) with a possible fallback locale (if configured in 
web.xml).

However, I'm noticing that the fallback locale only appears to be used 
if the specific locale cannot be located at all.

Here is my situation:

   ApplicationResources.properties:
    greeting=Hello there!
    goodbye=See ya!

   ApplicationResources_en.properties:
    greeting=Hello!
    goodbye=Bye!

   ApplicationResources_es.properties:
    greeting=Hola!

Note that goodbye is missing from the spanish.

EXAMPLE A:
   Assume my browser preferred locale is 'es'.  And I have a 
fallbackLocale in web.xml set to 'en'.

   <bean:message key="greeting"/>
   <bean:message key="goodbye"/>
   <fmt:message key="greeting"/>
   <fmt:message key="goodbye">

   gives me

   Hola!
   See ya!
   Hola!
   ???goodbye???

The fallback is not even used.


EXAMPLE B:
  Assume my browser preferred locale is 'fr'.  And I have a 
fallbackLocale in web.xml set to 'en'

   <bean:message key="greeting"/>
   <bean:message key="goodbye"/>
   <fmt:message key="greeting"/>
   <fmt:message key="goodbye">

  gives me:

   Hello there!
   See ya!
   Hello!
   Bye!

The struts tags used the parent chain to fall back to 
ApplicationResources.properties.
But JSTL used the fallback of ApplicationResources_en.properties.


Thanks,
Angie









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

Reply via email to