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}"/>
   </map:transform>
   <!-- other map:transform elements -->
   <map:serialize type="html" />
  </map:match>

and the stylesheet:

<xsl:param name="lang"/>

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

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

-- 

        Dakkar - [EMAIL PROTECTED]
                 [EMAIL PROTECTED]
                 [EMAIL PROTECTED]
                 [EMAIL PROTECTED]
        <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. <http://xml.apache.org/cocoon/faqs.html>

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

Reply via email to