We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27305
    • 173 Posts
    I`m working on a site that has a language selector screen with 3 choices english, russian and chinese. Basically the whole site is in english but they want one part of the site translated into those 3 languages, and the rest remains as english. The translated section would be called "International"

    At the moment I’m using wayfinder to generate a drop down menu, I’m wondering if I could have all the language pages in one folder but somehow filter them based on the language they choose, perhaps a cookie or something. So when wayfinder generates the menu you only see one set of pages rather than all of them

    Has anyone done this before, or could point me in the right direction.

    Many thanks
    Simon
      I made my first site with modx
      ------------------------
      Shopping blog
      Sky+ HD
      • 16183
      • 1,390 Posts
      Check this for starters: http://wiki.modxcms.com/index.php/Make_Multi_Lingual_Site


      and this: http://modxcms.com/forums/index.php/topic,10807.0.html

      quote from the second link (quoting doze) .....(assuming you use multiple folders)

      Use [!Wayfinder? &startId=`[[UltimateParent]]`!] and it always lists the menu from the top folder of each language..

      cheers/k
        • 27305
        • 173 Posts
        I did read the language wiki, but that would involve duplicating the entire site 3 times (I have a lot of content) I only want one part of the site translated. Basically the folder international will have about 6 pages in it, I need to duplicate just that folder 3 times one for each language, then somehow make wayfinder generate its menu based on a language parameter.

        Somthing like

        If lang="english" then
        Do this wayfinder call

        If lang="russian" then
        Do this wayfinder call


        If lang="china" then
        Do this wayfinder call

        I’m not even sure if that makes sense?

          I made my first site with modx
          ------------------------
          Shopping blog
          Sky+ HD
          • 16183
          • 1,390 Posts
          Hmmm, I’m just trying to get my head round what you have described.

          Anyway. The way I understand it. You have a menu or a link somewhere in your main site with the label international. You also have a languages folder with 18 documents, 6 for each language (english, russian, chinese), right? And you want the menus for these language pages to be different depending on the language chosen, right?

          I’m sure there’s different ways of doing this. Here’s my 2 cents:

          A visitor comes to your site and clicks on "international". They are taken to a landing page with say, 3 flags or other images one for each language. If I click on chinese, I should be taken to another page in chinese. I suppose this chinese page (and the other languages too) have a page that will act as their landing page, right?. If this is the case, then, what I would do is that on that landing page, chinese in this case, I will have a Wayfinder call and use the &includeDocs filter parameter to exclude the 12 "other language" documents from the output (using their doc ids) and only include the chinese documents you want. E.g. &includeDocs=`8,56,81,80,12,83`.

          I will do the same for the english and russian landing pages. Only difference between the 3 Wayfinder calls would be the docs that are included.

          I hope this is what you were after?

          &includeDocs
              default: 0
              values: [ comma-delimited list of document ids ]
              description: Acts as a filter and will limit the output to only the documents specified in this parameter. 
          The startId is still required..
            • 27305
            • 173 Posts
            I actually have a flash landing page where the users will choose the language (flags page), then I have 8 top level navigation links, of which international is just one of them.

            When you select english it drops you to the proper home page, but when you select the other languages I want it to drop you in the international section, the pages will then be translated into that language, if a person then browses the rest of the site its in english.

            I would rather translate the whole site, but the client I’m working for only wants the international bit translated, bloody stupid if you ask me.

            Actually your suggestion has given me an idea, perhaps I could use a session variable to store the language, and write a snippet that makes the wayfinder call to exclude documents.

            hmmmm.....

              I made my first site with modx
              ------------------------
              Shopping blog
              Sky+ HD
              • 16183
              • 1,390 Posts
              Why not use TVs that will call the Wayfinder menu that you want depending on what page one is in? Coz the solution I suggested above would mean having a sub-menu but you want one nav that will change depending on the language. Using a TV to call the right Wayfinder snippet call, in combination with the include parameters should work then , or?
                • 24719
                • 194 Posts
                i think you could use a wayfinder config file. In that file, check the cookie or whatever, and then set the startid programmatically based on the value of the cookie.
                  • 27305
                  • 173 Posts
                  I`ll take al look at the wayfinder config option, could use session rather than cookies. The only trouble is I’m no programmer, so struggling like mad to understand.

                  Can you change the wayfinder config file from the call? I can’t see it as a parameter.

                  ss
                    I made my first site with modx
                    ------------------------
                    Shopping blog
                    Sky+ HD
                    • 24719
                    • 194 Posts
                    you just add &config=`languages` and create a file called assets/snippets/wayfinder/languages.config.php containing:

                    <?php
                    switch ($_SESSION['lang'])
                    {
                    case 'chinese':
                      $startId = 10;   // id of the chinese page
                      break;
                    case 'russian':
                      $startId = 20;  // id of the russian page
                      break;
                    default:
                      $startId = 5;  // this could just be passed in as the &startId parameter
                    }
                    


                    that should work i think
                      • 27305
                      • 173 Posts
                      That seems to be exactly what I’m after, I`ll let you know if I can get it working

                      thanks redman

                      ss
                        I made my first site with modx
                        ------------------------
                        Shopping blog
                        Sky+ HD