cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Natural Languages [was Re: external entities]
Date Thu, 18 May 2000 12:08:04 GMT
Mike Engelhart wrote:
> 
> Mike Engelhart wrote:
> 
> > I get the data out of the ResourceBundle by calling getString() on the
> > correct resourceBundle which returns say "Zus&auml;tzliche Details". Do you
> > think that has something to do with it?
> 
> on 5/17/00 5:28 PM, Paul Russell at paul@luminas.co.uk wrote:
> 
> > Ahh. Yeah, that won't work - the &auml; gets converted to unicode
> > during the parsing phase, however if you use getString from within
> > an XSP, the text will never be parsed. Two options - you could
> > either write a chunk of code that takes the above and turns it into
> > unicode by looking up the character code in a hash, or you could
> > put the actual character into the resourcebundle itself (using
> > some strange key combination or other). Either should work.
> Crap... this isn't going right.  I can't put them into my XSP's directly or
> else i'm going to have to put a bunch of non-data information like text
> labels into my XML documents and I completely lose separation of
> presentation/data which is why I'm using Cocoon in the first place.
> 
> any other ideas - anyone :-) I'm going to try posting to dev to see if
> anyone else has any ideas. thanks

Question: is it _necessary_ to use Java ResourceBundles?

I mean, the use of xml files as resource bundles could simplify your
job...

<resources>
 <resource xml:lang=".." name="..." value="..."/>
 ...
</resources>

then we could create some xsp taglib that does

<xsp:page>
 <i18n:resources href="..."/>
 <document>
  <title><i18n:resource name="title"/></title>
 </document>
 ...
</xsp:page>

which could generate some java code like

 String lang = request.getLocale().getLanguage();
 ...
 if (lang == "en")
   out("Hello World!");
 else if (lang == "it")
   out("Ciao a tutti!");
 else if (lang == "fr")
   out("Salut tout le monde!);

having parsed and interpreted the resources file at compilation time.

Not a trivial taglib, but I think it's impossible even today.

Ricardo, am I right?

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message