We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27708 MODX Staff
    • 2,502 Posts
    I am most interested in having the ability to have multilanguage sites running on MODx but it seems to me that the plugin and snippet method is a long way around what should be in the core installation to begin with.

    To do this efficiently, from my limited experience with PHP/MySQL, the content for the documents should be stored in a seperate table from that of the site_content table so that all the various versions of a document reference the same id. This way there is no need for complex include files or seperate doc id’s which in large sites could be very difficult or unweildly to manage. I am not skilled or versed enough to figure it out but I don’t see why land selection can’t reference the various language versions of the same id provided that it is available.

    Am I out to lunch on this or is this doable in some future version. Maybe there is a way to do this via plugin or module and I just don’t see it yet.

    For my clients, especially prospective clients in Canada. Multilingual sites is very important.
      Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
      • 25663 MODX Staff
      • 12,272 Posts
      Multi-language sites are a key thing that will be addressed after the 095 release. We’re excited about getting it done, and the lag will not be like the lag between 092 and 095. smiley
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 3919
        • 1 Posts
        Hi everybody!

        I just got playing with MODx (0.9.5) a few weeks ago, mostly just evaluating its strengths and weaknesses (if any).
        Now I’m facing a problem creating a multilingual site and found this topic. I did every step just as it was described to get this thing running, but something is not working.

        I noticed that the first posts of this topic are quite old now, so I think the problem is mainly caused by the changes made to the core of MODx since than, probably.

        I created the [[SetLangCookie]] snippet and the [*lang*] TV just as Susan was telling. The [[SetLangCookie]] is called on every Language’s main page (is embedded in the page’s content) so I guess this is OK as long as I only want to change the cookie when I change languages. There is a difference between my site and the others described, which consists of the [[WayFinder]] snippet which I am using to create the menus.

        I am calling this snippet this way (is embedded in the template I’m using):

        [[Wayfinder? &startId=`[*lang*]` &rowTpl=`rowTpl` &hereTpl=`hereTpl` &parentRowHereTpl='parentRowHereTpl' &parentRowTpl=`parentRowTpl` &innerRowTpl=`innerRowTpl` &innerHereTpl=`innerHereTpl` &innerTpl=`innerTpl` &outerTpl=`outerTpl` ]]


        The &startId parameter is meant to tell the snippet from where to start parsing the document tree.
        The problem itself is that the [*lang*] TV doesn’t return any value, and so MODx dies with a huge error message:
        Parse error: parse error, unexpected $ in /var/www/html/aim-solutions.mkweb/htdocs/aim-solutions/manager/includes/tmplvars.commands.inc.php(50) : eval()'d code on line 1
        « MODx Parse Error »
        MODx encountered the following error while attempting to parse the requested resource:
        « Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND sc.published=1 AND sc.deleted=0 AND (sc.privateweb=0) AND sc »
              SQL: SELECT DISTINCT sc.id,sc.menutitle,sc.pagetitle,sc.introtext,sc.menuindex,sc.published,sc.hidemenu,sc.parent,sc.isfolder,sc.description,sc.alias,sc.longtitle,sc.type,if(sc.type='reference',sc.content,'') as content, sc.template,sc.link_attributes FROM `aim_solutions`.aim_site_content sc LEFT JOIN `aim_solutions`.aim_document_groups dg on dg.document = sc.id WHERE sc.parent = AND sc.published=1 AND sc.deleted=0 AND (sc.privateweb=0) AND sc.hidemenu = 0 GROUP BY sc.id ORDER BY sc.menuindex ASC;
              [Copy SQL to ClipBoard]
         
        Parser timing
          MySQL: 	0.0115 s	(6 Requests)
          PHP: 	0.1233 s	 
          Total: 	0.1348 s	 


        From the outputted SQL one can see that the error is caused by
        sc.parent = AND
        ,
        sc.parent
        not having a value.

        Is there somebody, who can say anything about this which would help me pass trough this?

        Any help would be greatly appreciated. smiley

        Thanks
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          This was written nearly two years ago, and the site it was done for has only been upgraded to 0.9.2.2 for the security patch. So I really don’t know if it would work with 0.9.5 or not, although I can’t think of any reason why it shouldn’t.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 32942
            • 141 Posts
            OK I’m back in this topic to see if there is any development.
            hmm seems no..

            Are there any news about i8n you could tell us please Mrs. Ottwell?

            sincerly .X4
              • 7923
              • 4,213 Posts


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 32942
                • 141 Posts
                thx Doze!
                sounds like good wiki stuff
                  • 9564
                  • 13 Posts
                  Don’t know why, but the TV [*lang*] doesn’t return any value, if I’m using the posted code in MODx v0.9.5!

                  Finally I tried to put all the code into one line, put it into the TV as standard-value - and suddenly it works:

                  @EVAL return ($modx->documentObject['parent'] == 0) ? $modx->documentIdentifier : (isset($_COOKIE['Language'])) ? $_COOKIE['Language'] : $modx->config['site_start'];



                  ---
                  Mmmh, I actually didn’t read this thrad to the end - this was already metioned by "boteeka".
                  Probably my way is a solution... but I really want to know why the TVs behave in such a *** way!?
                  ---