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
    Sep 22, 2011 @ 19:03
    Garrett Fisher
    0

    RelateNode / NiceUrl Problems - Multilingual Sites

    Hi,

    I have a bilingual site with a language switcher dropdown and recently discovered that it is not working properly. The way I created the Spanish site was as a copy of the English site, *chose to relate all copied items to the original*, and then am using domains ("en.gtpsites.com" and "es.gtpsites.com") and Dictionary items.

    In general, or at least in part, the toggle works -- one way -- I can always toggle from Spanish to English and remain on the current page; however when I go the other way, it doesn't work, and I have figured out that this is because BOTH:

    umbraco.library:NiceUrl($currentPage/@id)

    and

    umbraco.library:NiceUrl($relatedNode/relations/relation/node/@id)

    Are returning a different value to the front end depending on which language is selected!  The way my dropdown works, or intends to work, is to take the domain name of the root node (eg. "en.gtpsites.com") and then append the URL of the current page onto it. When I am es.gtpsites.com, the value of returns as just the last part of the URL (for English), eg., "/about.aspx", but then on en.gtpsites.com, I get the full path!  Eg., "http://en.gtpsites.com/about.aspx," which obviously doesn't work in an append.  I will paste my code below.  What is wrong with this?!  Help!

    <select onchange="window.location=this.options[this.selectedIndex].value;">
          
          <xsl:if test="$relatedNode/relations[relation]">
              <xsl:attribute name="onchange">
                  <xsl:text>window.location='</xsl:text>
                    <xsl:value-of select="umbraco.library:NiceUrl($relatedNode/relations/relation/node/@id)" />
              <xsl:text>';</xsl:text>
                </xsl:attribute>
          </xsl:if>
        
          <xsl:for-each select="$currentPage/ancestor-or-self::root/node">
              <option value="{umbraco.library:NiceUrl(@id)}">
                  <xsl:if test="data[@alias = 'language'] = $currentLanguage">
                      <xsl:attribute name="selected">selected</xsl:attribute>
                    </xsl:if>
                   <xsl:value-of select="data[@alias = 'language']"/>
                 </option>
          </xsl:for-each>
          
        </select>

    Do the relations only go OIne way or something?  Any help would be greatly, greatly appreciated.

    Thanks.

    Garrett

     

Please Sign in or register to post replies

Write your reply to:

Draft