cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakkar <>
Subject Re: Internationalization
Date Wed, 31 Oct 2001 07:04:41 GMT
On 20011030190147, Adam A R wrote:
> I want to make my application internationalized. i.e. Be able to present
> Strings in different languages depending on the useragent.
What I'll do is:
- for static text: use the 'xml:lang' attribute in elements to mark
  them as belonging to a particular language
(- alternatively, you could make different XML files, of course, but
   since I write all my contents, I like to have everything together)
- set up a XSLT to filter out all element whose language is not the
  one I want (passed as a parameter) (note: I use "no xml:lang" to mean
  "any language")
- find a way to pass the 'Accept-Language' (?) HTTP request field to
  the stylesheet (you should use this field, and not the user agent, btw)

- for dynamic content (SQL/forms/whatever): Cocoon 2 i18n is to be
  used with care (it's too much like "gettext"), but it can resolve
  some problems.

OK, I have no good idea about making something like this work under cocoon1...

Right now I'm using X-Web, a small static HTML generation tool, but
I'm going to move to Cocoon 2 (just to show off ;-) ).

My sitemap looks like:
  <map:match type="regexp" pattern="thenautilus/([^.]+)\\.(..)\\.html">
   <map:generate src="thenautilus/{1}.xml"/>
   <map:transform src="thenautilus/xsl/langfilter.xsl">
    <map:parameter name="lang" value="{2}"/>
   <!-- other map:transform elements -->
   <map:serialize type="html" />

and the stylesheet:

<xsl:param name="lang"/>

<xsl:template match="/html">
 <html xml:lang="{$lang}">

<xsl:template match="@*|node()">
  <xsl:when test="lang($lang) or not(ancestor-or-self::*[@xml:lang])">
    <xsl:apply-templates select="@*|node()"/>


	Dakkar -

	<Mobilis in mobile>

It is your concern when your neighbor's wall is on fire.
		-- Quintus Horatius Flaccus (Horace)

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message