Copied to clipboard

Flag this post as spam?

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


  • George Mocanu 28 posts 48 karma points
    Jun 30, 2010 @ 14:51
    George Mocanu
    0

    Language selector

     

    Please i need some help with Xslt.

    Floder structure for a multi lingual site something like this :

    root

    -RO

                    -Products

    -EN

                    -Products

    -DE

                    -Products

     

    I use this language selector :

     <ul class="language">

    <xsl:for-each select="$currentPage/ancestor::root/node">

    <LI>
    <a href="{umbraco.library:NiceUrl(@id)}">
    <xsl:value-of select="./data[@alias='language']"/>
    </a>
    </LI>
    </xsl:for-each>
    </ul>

     

    The problem it is that I want to toogle between languages  but without going throw home folder.

     

     

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 30, 2010 @ 15:09
    Dirk De Grave
    0

    So, you want to able to jump to a product page from one language to another? Hmm, sure it can be done using relations and there's a couple of ways to achieve that:

    - if you have an exact same structure (eg. you've copied the structure of a language site to another), then you could use the 'Relate copied items to original' checkbox in the copy dialog -> this creates a relation between parent and child - not sure if this is bidirectional), and for each page in a specific language, you could get the related page using the relation api available in the umbraco core

    - if the site structure of the different languages differ, you could add an extra property on a page and and choose the page in the other language(s) that it relates to.

    Anyhow, I've yet to see a site that has such requirements, I don't think people who browse a site in one language want to switch to the same page in another (foreign) language.

     

    Hope this helps.

    Regards,

    /Dirk

  • Hundebol 167 posts 314 karma points
    Jun 30, 2010 @ 15:58
    Hundebol
    0

    I created a site that needed that exact thing.

    It's more a great service for the visitiors than anything else (and we know people love it)

    What i did was the following:

    On each Document Type i had a Content picker called "chooseLanguage".
    In the content section the user then needs to choose the related page (in our case danish and english)
    This has to be done on EVERY page and is kind of pain a times (news stories in two languages etc - always double up of pages)

    Then in my Master Template i had the following:

    <div id="language">
    <a href="/{localLink:<umbraco:Item field="pageID" runat="server"></umbraco:Item>}"><img src="/media/53559/UK.gif"></img></a>
    <umbraco:Item field="chooseLanguage" insertTextBefore="&lt;a href=&quot;/{localLink:" insertTextAfter="}&quot;&gt;&lt;img src=&quot;/media/53554/DK.gif&quot;&gt;&lt;/img&gt;&lt;/a&gt;" runat="server"></umbraco:Item>
    </div>

    In this case - my English Master Template - it always shows the english flag, and shows the danish flag if chooseLanguage is chosen.
    Then just reverse it on the danish site.
    Your problem, however, with solution, will be the fact that you have 3 languages. So you really nedd two Content Pickers. Kind of a mess.

    As i said, it's no great solution for the user, but it works as i should!
    I do however look forward to eventually great suggestions

    Best regards,
    Hundebol

  • Sander Houttekier 114 posts 163 karma points
    Jun 30, 2010 @ 16:17
    Sander Houttekier
    0

    i do not think it is a good idea to add 2 content pickers for 3 languages, and then each language that adds up to the list, another content picker.

    if you use the solution presented above, by Hundebol, i believe it would be more apropriate to use a macro inbetween,

    you select 1 language as default, and to build up your language nav, you go ask all pages that link to that default language's page.

     

     

    this is a better solution than adding content pickers per language, yet i'm not fully at ease with this solution just yet :)
    i really think there should be a better solution for these 1:1 multilanguage sites.

     

  • George Mocanu 28 posts 48 karma points
    Jul 07, 2010 @ 15:58
    George Mocanu
    0

    Thank you for your support.

    For begining I will use the simplest solution ; when users browse throw languages to navigate to the main page of each language root node. On some certain points Dirk de Grave has right.

    The solution should be like this .

    Create a root node for the main language and all other to be copied using the 'Relate copied items to original".

     Create a property for language for each root node or use the rootName.

    Design a language selector xslt with macro that should work something like each href of the language picker to be the related page by reading first the parentID and then the childID of the coresponding language.

    But is to complicated for a beginner in Xslt like me.

     

     

Please Sign in or register to post replies

Write your reply to:

Draft