Our Forum has Moved

This site is our old forum and is only here for achive until we get proper 301 redirects setup to make Google happy.

Please use our new community site - Our Umbraco - which contains an improved forum, documentation wiki, package repository and a member locator.

Go to Our Umbraco now

Learn everything about Umbraco
How to check for current culture / language Options
RBerntsen
Posted: Monday, June 22, 2009 11:27:58 AM

Rank: Enthusiast

Joined: 11/24/2008
Posts: 37
Location: Odense, Denmark
Hi people.

What's the best (and right) way for checking the current language/culture in XSLT? Working on a site with three languages and I need to format dates according to the language in my XSLT. Right now I'm checking for the value in a dictionary item, which isn't a very pretty way to do it. -But it works.

Any ideas?

//Berntsen
chris
Posted: Thursday, June 25, 2009 3:29:47 PM

Rank: Aficionado

Joined: 4/12/2007
Posts: 112
Location: Amsterdam
How is the structure of your multilanguage site? Like 3 root-directories with each directory as a language? If so you could use a check in the XSLT for the parent node like:
Code:

<xsl:variable name="languageID">
    <xsl:choose>
        <xsl:when test="$currentPage/ancestor-or-self::node/@id = '2708'">
            2927
        </xsl:when>
        <xsl:when test="$currentPage/ancestor-or-self::node/@id = '2709'">
            2967
        </xsl:when>
        <xsl:otherwise>
            1250
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>


greetings,
Chris

The forum has moved

This forum is no longer in use, so you can't reply to this message - please go to Our Umbraco

Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.