RE: [xsl] Simple (external XML) internationalization with XSLT?

Subject: RE: [xsl] Simple (external XML) internationalization with XSLT?
From: "Nathan Young \(natyoung\)" <natyoung@xxxxxxxxx>
Date: Wed, 5 Oct 2005 10:14:47 -0700
Andrew:

We have two approaches currently in use.  One is quite similar to the one used
by the cocoon project, with the exception that the translation itself is done
by an XSLT rather than by a java SAX filter (which sounds like what you'll end
up doing?).

The other is much like the one people are talking about in this thread, where
the XSL pulls in localized values at runtime.  We initially used this second
approach because at that time the first solution didn't support a couple of
key processing features:
 - what I've been calling the "mini templates" problem (in the cocoon doc, the
section referred to by the heading "Translation with param substitution")
 - what I've been calling the "repeating values" problem where locales not
only have different values for items but actually different numbers of those
items (this one isn't referred to from the cocoon docs).

We are moving away from this since it needs to be coded into each XSL that
needs to use it. Instead we're building onto our first solution so that it
supports the cases we needed it to and can be used in a wider range of
situations.

Probably this won't work for you, but on the off chance it will you might look
at the XUL localization which has a dtd for each locale that defines custom
entities for translated terms:

http://www.mozilla.org/projects/l10n/xul-l10n.html

-------------->Nathan



> -----Original Message-----
> From: knocte [mailto:knocte@xxxxxxxxx]
> Sent: Tuesday, October 04, 2005 1:58 PM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] Simple (external XML) internationalization
> with XSLT?
>
> Robert Koberg escribis:
> > knocte wrote:
> >
> >>
> >> Interesting but, cannot this be done without so much
> writting in each
> >> i18n call? Can't it be simplified? Isn't there other method?
> >>
> >> Cannot I write something like this?:
> >>
> >> <i18n:text key="1" />
> >>
> >> And transform it automatically to:
> >>
> >> <xsl:value-of
> >>
> select="document('en-US.xml')//i18n:language/i18n:hash-list/i1
8n:string[@key='1']"
> >>
> >> />
> >
> > Hi,
> >
> > Do you want the localized text to be resolved at transform time? In
> > other words, are you transforming out to something like JSP
> and that
> > should resolve it at runtime?
> >
> > Or if your transformation happens at runtime you couold look at how
> > cocoon handles this:
> >
> >
> http://cocoon.apache.org/2.1/userdocs/transformers/i18n-transf
ormer.html
> >
> > best,
> > -Rob
>
> Yes, the internationalization transformation should be made
> at runtime.
> I am looking at the specs you sent me and seem very very interesting,
> just the thing I was looking for. Unfortunately, I can't use a Java
> implementation so I think I am going to do it myself.
> However, I won't
> need anything more than some XSLT routines.
>
>     Thanks very much.
>
>        Andrew
>
> --

Current Thread