Copied to clipboard

Flag this post as spam?

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


  • Roger Hughes 55 posts 88 karma points
    Sep 28, 2009 @ 10:11
    Roger Hughes
    0

    Inline XSLT for languages

    Hi all, Im new to the forum so im not sure if this has been addressed before.

    I have an issue with translating languages using inline XSLT.
    I followed the tutorials to create language types, tabs and dictionary items. This all works fine. I have a couple of links on the homepage that passes through the language codes via a querystring.
    Now, the tutorial shoes how to translate the languages but only in the XSLT files.

    I need to translate the content in the umbraco page items not the XSLT.

    Heres what I have:

    <%@ Master Language="C#" MasterPageFile="/masterpages/BritanniaMaster.master" AutoEventWireup="true" %>
    <asp:Content id="BritanniaHomepagecontent" ContentPlaceHolderID="BritanniaMasterContentPlaceHolder" runat="server">
    <div id=langselect>
        <a href="?lang=en">English</a>&nbsp; | &nbsp;
        <a href="?lang=fr">French</a>&nbsp; | &nbsp;
        <a href="?lang=de">German</a>
    </div>

     <h2><umbraco:Item field="pageHeading" runat="server" xslt="concat(umbraco.library:GetXmlNodeById({0})/@nodeName,$flang)"></umbraco:Item></h2>
     <p><umbraco:Item field="siteIntroduction" runat="server" xslt="concat(umbraco.library:GetXmlNodeById({0})/@nodeName,$flang)"></umbraco:Item></p>

     

    I know the inline XSLT here is incorrect but it gives you an idea of what I need to do.
    Can anyone help me out with the correct inline XSLT please?

    Many thanks

    Rog

  • Roger Hughes 55 posts 88 karma points
    Sep 28, 2009 @ 10:32
    Roger Hughes
    0

    The other thing is that the item field names above seem to be wrong. In my document type, the tabs have aliases like this:

    pageHeading_en
    pageHeading_fr
    pageHeading_de

    How does the page know what language is the default? Also, which one of these do I put in the itme field on page or do I just omit the _en/_fr/_de

    Please give some ideas on this.

    Thanks!

  • Roger Hughes 55 posts 88 karma points
    Sep 28, 2009 @ 11:24
    Roger Hughes
    0

    No one know an answer?

  • Petr Snobelt 923 posts 1535 karma points
    Sep 29, 2009 @ 22:16
    Petr Snobelt
    0

    Hi, it doesn't matter how your tabs are named, is important how you name properties, for example bodyText_en, bodyText_de :

     <p><umbraco:Item field="bodyText" runat="server" xslt="umbraco.library:GetXmlNodeById({0})/data[@alias = 'bodyText_' + $flang])" /></p>

    Not tested, just sample ...

Please Sign in or register to post replies

Write your reply to:

Draft