Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Garrett Fisher 341 posts 496 karma points
    Mar 12, 2010 @ 16:09
    Garrett Fisher
    0

    getting assigned language

    Hi,

    I'm trying to create an XSLT Macro to loop through all my separate Home Pages on a multilingual site.  Each home page has its own subdomain and therefore alt URL (eg. "http://en.localhost", "http://fr.localhost", etc.).  I was told I could do this in my language selector dropdown:

    <select id="select_language" name="select_language">
    <xsl:for-each select="$currentPage/ancestor::root/node [@nodeTypeAlias = 'CWS_Home']">
    <option value="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="data [alias = '@Language']"/></option>
    </xsl:for-each>

    </select>

    But this implies that I have a field called "Language" on my document type.  I do not.  Nor do I think I should have to add one.  Why can't this be dynamic?  I would think this would be a page built-in page property.  But:

    <xsl:value-of select="@Language'"/>

    Doesn't work either.  How do I get the language assigned to a particular page?  So that I can redirect the user to the chosen home page?

    Thanks,

    Garrett

  • dandrayne 1138 posts 2262 karma points
    Mar 12, 2010 @ 17:21
    dandrayne
    0

    Hi Garret

    As I explained previously, it is usually the case that the ISO country codes or culture name isn't necessarily what you want to show your users, but having said that there is bound to be a way to get the current culture - I'm just not aware of it!

    If you just want to keep this out of your document type, you could always add a dictionary item for the current language.

    Dan

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 12, 2010 @ 21:42
    Douglas Robar
    0

    As to "how to do it" without a special docType setting you will need an xslt extension. See this thread for more info: http://our.umbraco.org/forum/developers/xslt/4747-How-do-you-retrieve-the-Culture-Code-for-a-given-Node

    cheers,
    doug.

Please Sign in or register to post replies

Write your reply to:

Draft