Polyglot doesn't work for Menu-Level

Mar 1, 2013 at 9:16 AM
Edited Mar 1, 2013 at 9:20 AM
hi,

I like this tools, it works perfectly to easy create multi-Language Pages for each Site I need. One Problem maybe, it works only in Content-level, but not in Menu (1-, 2-...Level). We hope this could be improved in further, many Thanks!

-Jianchun
Coordinator
Mar 1, 2013 at 8:09 PM

Hi! Thanks for looking into this package! I have included an example menu macro (TranslatedNavigation). Of course, you might have to modify it, depending on your website's structure, but I have used it many times one way or another and it works. Please let me know if you need further assistance.

Best regards,

Dimitri

Mar 4, 2013 at 9:01 AM
Edited Mar 4, 2013 at 9:16 AM
Hi Dimitri,

Thanks very much for your rapid reply! I've tried your macro "translatedNavigation" from Polyglot 1.4 Version before I post this in thread, but anyway it didn't work, I thought it may be "Further Steps" as descripted in your documemt. My Example, I have my Top Navigation with macro in "umbTopNavigation.xslt":
......
<!-- Input the documenttype you want here -->
<xsl:variable name="level" select="1"/>
<xsl:template match="/">
<ul id="topNavigation">
    <li class="home">
        <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
            <xsl:attribute name="class">home current</xsl:attribute>
        </xsl:if>
        <a href="/">Home</a>
     </li>
    <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
        <li class="other">
            <xsl:if test="@id = $currentPage/@id">
                 <xsl:attribute name="class">current</xsl:attribute>
            </xsl:if>
            <a class="navigation" href="{umbraco.library:NiceUrl(@id)}">
                <span><xsl:value-of select="@nodeName"/></span>
            </a>
        </li>
    </xsl:for-each>
</ul>
......
And I tried to use your macro "Translated Navigation" to translate the top menu with name ="Contact us", with:
<umbraco:Macro UlCssId="topNavigation" Level="1" NaviHideProperty="" CurrentItemCssClass="other (or navigation)" TitlePropertyAlias="Contact us" Alias="TranslatedNavigation" runat="server"></umbraco:Macro>
And I insert it in my parent Template at place of where i use Macro for Top Navigation, but I save and refresh my Site and it works nothing, and I don't know where I should insert this. By the way I also need to translate all from my second menu from macro "umb2ndLevelNavigation.xslt".

Have you any sample that works fine, or are there simple way, I just tell the parameter: the node ID, and the translatied Texts for other languages, then I swich the selector in Page and the name of pages will be translated in menu.

Many Thanks!

Jianchun
Coordinator
Mar 5, 2013 at 1:31 PM
Hi Jianchun,

I think I see a couple of things that could be corrected in the call to the macro:
  • The TitlePropertyAlias needs to be set to the alias of a property present in each node, which contains the title of the node (page). So it is not specific to one page like "contact us". Also, I think you are not using the alias but the name of the field because "contact us" contains a space, and aliases cannot contain spaces as far as I know.
  • CurrentItemCssClass needs to be set to a css class or be left blank. "other (or navigation)" would not work.
Please let me know if this helps resolve the issue or if you need more help. On a little hobby web site, which I am maintaining, the navigation does get translated. For example here you can see my menu in English:

http://dimitros.net/home?lang=en

and here, part of it has been translated to French

http://dimitros.net/home?lang=fr.

So I am sure we can get it working on your web site as well :)

Best regards,

Dimitri
Mar 12, 2013 at 10:37 AM
Edited Mar 12, 2013 at 10:44 AM
Hi Dimitri,

Many Thanks for your help!

I try to translate menus with your solution at first from my initial installed umbraco business site. But I cannot understand the TitlePropertyAlias. I have no special alias in property which contains the title of node. For example the node of "Contact us", it has only "Body Text" in Tab "Content", this node has name "Contct us", node id like 1074, In its Template "Textpage", the Umbraco Field "PageName" will display its Page Name:
Snapshot1
Snapshot2

In Basic Template "StarterKit" runs Mrcro "umbTopNavigation" to call all page names including "Contact us" in menum, see my last post. The question is, the Macro "TranslatedNavigation" will be only once called in this basic Template, or everytime called in each node? Where can I put translated Text "Kontakt" for "Contact us" if German in selector selected?

Thanks!

-Jianchun
Coordinator
Mar 12, 2013 at 11:20 AM
Hi Jianchun!

The TranslatedNavigation macro is supposed to replace the existing navigation. So indeed you would have to use it instead of umbTopNavigation. If placed in a master template that is used by all pages, it will get called on all pages and will produce a menu with the names of all the pages a user can go to. You might have to modify it a bit of course, depending on your site's structure.

Exactly because the names of nodes cannot be multilingual, you need to have a special property on each node, where you will put the name of each page like "Contact us", etc. It is the alias of this property that has to go into TitlePropertyAlias. The reason this is necessary is that you need some place where you can translate the name of each page (the node name itself is not multilingual:)). You can either do this by placing a "title" property in the translation document types as well, or by placing all title properties on the basic nodes, one property per language with the language suffix. So for example you would have "title", "title_fr", "title_de", etc.

If something that I have mentioned is not clear, please let me know.

Best regards,

Dimitri