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
    Mar 12, 2010 @ 21:20
    Garrett Fisher
    0

    Dictionary Items - Images?

    Hi,

    My main navigation uses images with text in them, which is a problem for multilingual sites.  Before I added the additional (foreign-language) sites, in my Navi.xslt macro, I was writing the @id of the node as the id of the link, and then selecting a background image for each one in the CSS:

                   <xsl:for-each select="$currentPage/ancestor-or-self::node [@level=$level]/node [string(data [@alias='umbracoNaviHide']) != '1']">

    <xsl:if test="@nodeName != 'Forms'">
    <a href="{umbraco.library:NiceUrl(@id)}" id="nav_{@id}" title="{@nodeName}">
    <xsl:if test="$currentPage/ancestor-or-self::node/@id = current()/@id">
    <xsl:attribute name="class">selected</xsl:attribute>
    </xsl:if>
    <xsl:text> </xsl:text>
    </a>
    </xsl:if>

    </xsl:for-each>

    The problem that I am having, though, is that no matter which site I am in, it's writing the ID's of the Original (English) site.  I also tried

    $currentPage/ancestor::root/node

    And that doesn't work either because the root doesn't know which Home Page's child nodes to iterate through.  In this case I get ALL level 2 nodes.  How do I select ONLY the level 2 nodes of the CURRENT site?  From the current Page?

    Thanks,

    Garrett

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 12, 2010 @ 21:31
    Douglas Robar
    0

    Try this instead...

    $currentPage/ancestor-or-self::node [@level = 1]/node

    That will traverse up the tree from whatever page the visitor is on until it gets to a node at "level 1" (the homepage of the content tree within which the currentPage exists) and then gets the node below that. This way you never get outside your current language's pages.

    cheers,
    doug.

  • Garrett Fisher 341 posts 496 karma points
    Mar 12, 2010 @ 22:14
    Garrett Fisher
    0

    Thanks for your reply, Douglas. Turns out the issue I am having is that, while I THOUGHT I was browsing the other (foreign-language) sites, but in fact I am ALWAYS on the English site, even though my subdomains are set to fr.localhost, es.localhost, etc.  I finally got frustrated and changed some content on the Spanish site and sure enough, it didn't show up, even though I am on, for example, http://es.localhost/about.aspx. ; I am seeing the content from http://en.localhost/about.aspx. ; What could I be doing wrong here?  I thought you set the subdomain on the Home page and Umbraco would take care of the rest. I DO have <useDomainPrefixes> set to true.

    //Garrett

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 13, 2010 @ 12:46
    Douglas Robar
    1

    A couple things to check...

    • In IIS you have ONE website that points to your umbraco installation. This IIS site should have host headers (or 'bindings' depending on your version of IIS) for the en.localhost and es.localhost domains. All requests should go to the same umbraco site and umbraco will figure out which node to serve up based on the hostname.
    • You have set up DNS or your local 'hosts' file to resolve en.localhost and es.localhost to your IIS site's IP address (127.0.0.1, probably since your domains use 'localhost')
    • In umbraco's Setting section you have both and English and Spanish language set to the appropriate cultures.
    • In umbraco's Content section you have two top-level nodes; one for the en.localhost site and one for the es.localhost site. It doesn't matter what you call those nodes in umbraco but for this example I'll assume they are 'en' and 'es' just for clarity. That is, your content tree looks something like:
    CONTENT
    - en
    - - products
    - - about us
    - - blah blah blah
    - es
    - - products
    - - yada yada yada
    • You have right-clicked on both the 'en' and 'es' nodes and selected the Manage Hostnames. You enter the domain and select the appropiate culture for each (the 'en' node above would have en.localhost for the domain and English for the language; the 'es' node would have es.localhost and Spanish for the language)
    • You have 'hideTopLevelNode' set to true in web.config and 'useDomainPrefixes' to true in the umbracoSettings.config file
    • That's it, except for one thing... you need to force umbraco to recalculate the urls for all the pages based on these new settings. You can force umbraco to recalculate urls for all your pages by right-clicking each "level 1" node in the content tree (the 'en' and 'es' nodes above). Select the 'Publish' menu and tick the Include Children box. Repeat for all the top-most nodes in your content tree. (note: using the 'republish entire site' will not recalculate the urls... you need the 'publish' menu for this).

     

    That should do it!

    cheers,
    doug.

  • Garrett Fisher 341 posts 496 karma points
    Mar 15, 2010 @ 16:53
    Garrett Fisher
    0

    Wow, do I ever appreciate your taking the time to write such a thorough response.  Thanks so much for your help! 

    My configuiration was as described above in every case but one-- how the nodes were named.  Did you know that if they are both called "Home" then the entire system breaks?  In other words, ALL other language sites will show the content of the Original if their top level nodes are named the same.  What's with That??

    In the interest of being equally thorough, I named the home pages "En" and "Es" as in your example, and all of a sudden the correct content started showing up.  Thoughts?

    //Garrett

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 15, 2010 @ 18:57
    Douglas Robar
    0

    You're welcome! Glad you got it working now.

    My thoughts...

    1) It's a bug. Would you please report it on CodePlex so it can be fixed?

    2) Though it's a bug I've not heard of anyone else having the issue because (I think) there is a usability issue if you have nodes with the same name... how can you tell your content editors which one to click on? How would they distinguish one from the other? That's why people use the EN/ES/FR or English/Spanish/French or some other way to easily denote one site from another. Since the top-level node is hidden from the url (when you have hideTopLevelNode set to true) it doesn't matter what you call it so pick something that will help your users.

    But as I say, it's a bug so please report it. And thanks for hanging in there to find a resolution and report it for the benefit of the next person who might have this problem.

    cheers,
    doug.

  • Garrett Fisher 341 posts 496 karma points
    Mar 15, 2010 @ 19:22
    Garrett Fisher
    0

    Worship Umbraco.  This is actually the first bug I have found with it, and I've done 8 implementations.  This was my first foray into multilinguaql though. 

    With regard to the node naming: well, honestly, I originally named them "Home" simply so that it didn't say "En" or "Es" in the browser title bar. I'm using an XSLT Macro for the Page Title which inserts the page name after the site name.  I guess I'll have to put an additional check into that routine to assess whether it's a home page doc type or something like that.

    With regard to <hideTopLevelNode>, this tag was actually NOT IN my umbracoSettings.config file so I took a stab and put next to <useDomainPrefixes>.  Is this where it goes?  In the requestHandler node?

  • Garrett Fisher 341 posts 496 karma points
    Mar 15, 2010 @ 19:36
    Garrett Fisher
    0

    Doug, FYI:

    http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=26484

    If you have time, get back to me on the hideTopLevelNode issue.

    Thanks again,

    Garrett

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 15, 2010 @ 20:22
    Douglas Robar
    0

    It is in the web.config and is actually, umbracoHideTopLevelNodeFromPath.

    No harm done by adding it to the umbracoSettings.config file, but then again, it won't help either. Probably ought to remove it to avoid confusion later on.

    You can read more about the web.config settings at http://our.umbraco.org/wiki/reference/webconfig

    As for the node names of the 'home' pages... Why not use language-specific node names like:

    Home (for English)
    Accueil (for French)
    Inicio (for Spanish)

    (note: I don't speak French or Spanish so you'd want to check the real words to use!)

    cheers,
    doug.

  • Garrett Fisher 341 posts 496 karma points
    Mar 16, 2010 @ 14:21
    Garrett Fisher
    0

    Hahaha!  Ok.  What's funny also is that's already exactly what I did.  You've been a terrific help.  Thanks again, Doug.

    [By the way, umbracoHideTopLevelNodeFromPath is set to true out of the box]

    //Garrett 

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Mar 16, 2010 @ 14:36
    Douglas Robar
    0

    You're welcome!

    When you have a moment, please mark the answer(s) in your various (semi-related) posts for the benefit of the next person (and spread a little karma love in the process :) )

    cheers,
    doug.

  • Garrett Fisher 341 posts 496 karma points
    Mar 16, 2010 @ 18:06
    Garrett Fisher
    0

    Done.

    Hey Doug, running into a couple more issues now-- remember when I asked you how to get the dictionary items in the XSLT? 

    <xsl:value-of select="umbraco.library:GetDictionaryItem(@nodeName)" />

    Well that was specifically about the node names.  What if I just need to pass in the NAME (or Alias, I guess) of the dictionary item itself?  What is that syntax? I tried both:

    <xsl:value-of select="umbraco.library:GetDictionaryItem('Site Locator')" />

    And:

    <xsl:value-of select="umbraco.library:GetDictionaryItem('#Site Locator')" />

    But neither works.  'Site Locator' is the example key.  What am I doing wrong?

    Other question is about links in templates or XSLT files. Now,

    <xsl:value-of select="umbraco.library:GetDictionaryItem(@nodeName)" /

    Works for writing out the NAME of the page, but if this is a LINK to the page, how do I "translate" That??  There has to be a way to get the URL of the "related" node, no?  Here's my example:

    <a href="/sitelocator.aspx"><umbraco:Item field="#Advanced Locator" runat="server"></umbraco:Item></a>

    But the URL in the Spanish site is different because of the page title, i.e.:

    <a href="/localizador-de-sitios.aspx"><umbraco:Item field="#Advanced Locator" runat="server"></umbraco:Item></a>

    Is there a way I can get this link dynamically, or do I have to wrap this whole thing in a Macro, get the Home page's Language alias value, and then write the link according to this logic?  That seems like a lot of work.  Can I take advantage of Umbraco URL Names or Umbraco URL Aliases here somehow?

    Thanks,

    Garrett

Please Sign in or register to post replies

Write your reply to:

Draft