Copied to clipboard

Flag this post as spam?

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


  • seshadri 8 posts 28 karma points
    Aug 30, 2010 @ 14:57
    seshadri
    0

    Multilanguage Page in Umbraco

    Hi,

    I have created Umbraco setup using link http://umbraco.org/documentation/books/multilingual-11-sites/summary-of-the-multilingual-11-site-system.

     

     

    I'm using 2 different culture which  is cy-GB (Cymraeg (y Deyrnas Unedig) ). and en English.

    On Document I have created a field called PageHeader with  Alias name  "PageHeader_cy-GB" and PageHeader for general content. On Web template I have given different values. Whatever culture I give its takeing Default   value. Any Idea please help me at the Earliest. I have added

     

  • Jamie Howarth 306 posts 773 karma points c-trib
    Aug 30, 2010 @ 15:31
    Jamie Howarth
    0

    Hi seshadri,

    It's recommended that the best way of doing multilingual is with multiple root content nodes - one per language.

    I have had a client request similar functionality recently, however, with multilingual editing capabilities all shown in the editor for a single content node and I am working on a package that might be able to implement this without too many core hacks :-)

    In response to your question, however, you'd need to insert a macro on your template. The method described in the tutorial will not allow you to use page fields on your master templates.

    Hope this helps.

    Benjamin

  • seshadri 8 posts 28 karma points
    Aug 30, 2010 @ 15:52
    seshadri
    0

    Hi Benjamin,

    Thanks for immediate Response. What macro property needs to be added? Is it possible to translate Dynamic content coming from backend to required cultural Langage.

    Regards Seshadri

  • Jamie Howarth 306 posts 773 karma points c-trib
    Aug 30, 2010 @ 16:12
    Jamie Howarth
    0

    Hi Seshadri,

    I think you misunderstand - you'd have to create a brand-new macro which will automatically identify the language you want and retrieve the content accordingly.

    See section 3 of the tutorial - the XSLT lets you set a querystring variable for each and every page. The idea is that you use this language selector to then dynamically pick the Umbraco property from the page according to which language is being requested.

    <xsl:value-of select="./[name()=concat('theFieldIWant',$flang)]" />

    If I went to /anypage.aspx?lang=cy, the XSLT from section 3 of the tutorial would set $flang to be _cy, so the XSLT would try and retrieve theFieldIWant_cy. If a querystring was not specified it'd default to theFieldIWant_en.

    HTH,

    Benjamin.

     

     

  • seshadri 8 posts 28 karma points
    Sep 02, 2010 @ 13:12
    seshadri
    0

    Thanks Benjamin,

     

    I have create a Property called PageHeader with alias Name as    PageHeader and PageHeader_cy-GB.

    This I have created on Different tabs like "Content" which has  PageHeader  and "Content Cymraeg" which has PageHeader_cy-GB.

    On the Content tab for default Content I have added as Default Header and for Content Cymraeg have added different value.

    on xslt

     

    <xsl:variable name="flang">
        <xsl:if test="$dlang != '' and $dlang != $initlang ">
         
             <xsl:value-of select="$dlang" />
       
            <xsl:value-of select="concat('PageHeader',$dlang)" />
        </xsl:if>
    </xsl:variable>

    on Query string value   Content Cymraeg is cy-GB.  But all time I get value as Default Header.Please help me out. I think I have missed some Macro property.

    If its default property to identify Language, how to set the property?

    Please help me in resolving this. Thanks in advance.

  • seshadri 8 posts 28 karma points
    Sep 03, 2010 @ 11:55
    seshadri
    0

    Hi any help. I'm struck here

  • Jamie Howarth 306 posts 773 karma points c-trib
    Sep 03, 2010 @ 12:30
    Jamie Howarth
    0

    Hi seshadri,

    1. You need to add this:
      <xsl:include href="../xslt/lang_lib.xslt" />

      to each XSLT file that you want to use translations in. If you've followed section 3 of the above tutorial correctly lang_lib.xslt is the library function to do your translations.

    2. Your code will select the string "PageHeader", not the XSLT node. You should be using this:
      <xsl:value-of select="./*[name()=concat('PageHeader',$flang)]" />

      Note the use of square brackets which are conditions - namely that the XPath selects a node whose name matches concat('PageHeader',$flang).

    Doing select="concat('PageHeader',$flang)" - your current code - will only get XSLT to evaluate that expression literally. You want to effectively turn that expression into an evaluation of XPath, which is what the code above does.

    HTH,

    Benjamin

  • seshadri 8 posts 28 karma points
    Sep 03, 2010 @ 12:38
    seshadri
    0

    Hi,

    when I try to save xslt if get following error.

     

    Hide ErrorsError occured
    System.Web.HttpException: Failed to map the path '/umbraco/..../bin/Translate.dll'.
    at System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path)
    at System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath2.MapPath(String siteID, VirtualPath vpath)
    at System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull)
    at System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath)
    at System.Web.VirtualPath.MapPathInternal()
    at System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping)
    at System.Web.HttpRequest.MapPath(VirtualPath virtualPath)
    at System.Web.HttpServerUtility.MapPath(String path)
    at umbraco.macro.AddMacroXsltExtensions()
    at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String fileContents, Boolean ignoreDebugging)

    any Idea.

  • seshadri 8 posts 28 karma points
    Sep 03, 2010 @ 13:28
    seshadri
    0

    Thanks for the Help Benjamin. My xslt is some what like this

     

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xml:lang="en" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:kv_trans ="urn:kv_trans"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fn="http://www.w3.org/2005/xpath-functions"  xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:cs="urn:cs" exclude-result-prefixes="xs xsi xdt fn xsl cs msxsl umbraco.library kv_trans">
     
      <xsl:output version="4.0" method="xml" indent="yes" encoding="UTF-8" cdata-section-elements="text" omit-xml-declaration="yes"/>
     <xsl:include href="d:/cloudamber/traffic_Wales/xslt/lang_lib.xslt" />

      <xsl:strip-space elements="*" />
      <xsl:param name="hostName" select="0"/>
      <xsl:param name="SiteSkin"/>
      <xsl:param name="imageURL"/>
      <xsl:param name="voyagerURL"/>
      <!--<xsl:param name="SubSkin"/>-->
      <xsl:param name="currentPage"/>

     
      <xsl:template match="Menu">
        <xsl:call-template name="setlang" />
       
        <xsl:value-of select="./*[name()=concat('PageHeader','$flang')]" />

     

     

    But there is no XML node named PageHeader but its available in dictionary with 2 tabs for cy-GB and en-US respectively. How to display the current PageHeader based on Language. I have added

    <xsl:value-of select="./*[name()=concat('PageHeader','$flang')]" />

    as you have mentioned and included xslt as

    <xsl:include href="d:/cloudamber/traffic_Wales/xslt/lang_lib.xslt" />

     

    But there is no change in output.

    Can you please help me in this, where I have gone wrong? Thanks in advance

  • seshadri 8 posts 28 karma points
    Sep 03, 2010 @ 16:31
    seshadri
    0

    Hi any idea so far. Is it because of the error? Any suggestions please help. Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft