Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    Feb 11, 2011 @ 16:11
    Anthony Candaele
    0

    implementing language selector

    Hi,

    I have implemented the language provider as provided by Tim Geysels:

    http://www.nibble.be/?p=32

    The xslt-code for this language selector looks like this:

    <xsl:template match="/">

    <form>
            <select name="langselection" onchange="loadPage(this.form.elements[0])" target="_parent._top">
                <option selected="selected">– Please select –</option>  
              <xsl:for-each select="$currentPage/ancestor::root/*">            
                  <option value="{umbraco.library:NiceUrl(@id)}">
                      <xsl:value-of select="language"/>
                    </option>
                </xsl:for-each>
            </select>
        </form>

    </xsl:template>

    The problem though with this code is that it gives me the link id for the url and not the 'alternative link'.

    This is a problem for pages from a different language node, but with the same page name.

    For instance consider this site structure

    - en
    .. software

    - nl
    .. software

    The language selector will give me www.mysite.com/software.aspx no mather if I choose the English or Dutch language option.

    Therefore I need to customize the language selection code, so that the value for the language option is preceeded with hostname for the selected language, like www.mysite.com/en/software.aspx or www.mysite.com/nl/software.aspx

    Does anyone has experience with this?

    Thanks for your help,

    Anthony Candaele
    Belgium

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 11, 2011 @ 19:57
    Jan Skovgaard
    0

    Hi Anthony

    are you using a content-picker for the alternative link? In that case I guess it's simply a matter of passing the id from the alternative link to the NiceUrl and you should be good to go, right?

    Or am I missing something here?

    /Jan

  • Christer Josefsson 55 posts 93 karma points
    Feb 13, 2011 @ 12:28
    Christer Josefsson
    0

    Have you set the the config property (hidetoplevelnodes?) that hides rop lever nodes to false

Please Sign in or register to post replies

Write your reply to:

Draft