We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16680
    • 73 Posts
    Hey guys, I just installed modx yesterday, but am loving it already. So much that I think I may have found the perfect cms, for my needs at least.
    Well, I’m trying to build a multilingual site and found this guide for it:
    http://wiki.modxcms.com/index.php/Make_Multi_Lingual_Site

    However I dont understand this part of the guide, simply because I have never used the system before:


    Create the Template Variable

    (...)

    Edit your templates to call the Languages snippet with no parameters. Place it where you want the flags to appear. Users click on the flags to change the language.

    If this has been answered before I apologize for double posting, but I haven’t been able to find any info.. tongue

    larsb
      Signature on it's way
      • 27376
      • 576 Posts
      You need to create a snippet call in your template where you want the flags to appear so a user can select the flag and the page will be shown in the desired language.
      <!-- Show the language flags -->
      [!Languages!]
      
        • 16680
        • 73 Posts
        Thank you for your answer.
        For some reason I just can’t get this to work. I have read the guide over and over, but still no luck.
        My best result so far of some activity happening is:
        Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ’)’ in /home/www.cruiseback.dk/public_html/aabt/manager/includes/document.parser.class.inc.php(748) : eval()’d code on line 13
        I get this error when I name my snippet Languages and then call it within the template with [!Languages!]. If I call it with [!languages!] its fine and vice versa.
        Im stuck here, hope someone can help me move on with this great cms.

        larsb
          Signature on it&#39;s way
          • 16680
          • 73 Posts
          Ok, I sort of gave up yesterday after having spent hours trying to figure it out, but literally just wandering in circles undecided
          Reading this guide again today, there are some thing that I am not sure of.
          First of all it says:
          Redirect
          Create a new snippet, call it "Redirect" and put the following code inside it:
          Now, for a silly question. Do you have to name the snippet "Redirect" or just Redirect? Im guessing its just Redirect, but I have to start from the beginning to find out what is going wrong here.
          Same question goes for the "Language"/Language snippet.

          Ok, so now I have my two snippets plus all the flag gif’s in /images.
          Then I create the template variable "languages". The guide just tells me to call it "languages", and choose "text" for the type and then associate all templates with it. So is that it? Or is there some basic thing I need to do also?

          Then the template editing part, which this post was originally about. sirlancelot was so kind as to give me a few pointers, but when I place:

          <!-- Show the language flags -->
          [!Languages!]

          Where I want the flag-menu to appear, it just says:

          [[languages]]


          when I preview the site(?)

          Next the document tree, and adding the redirect snippet.
          Now, when I add the redirect snippet I suppose I have to do it in the language template variable field at the bottom of each document?
          Same question goes of course for the specifying of each page language. E.g. "de=3"

          If anyone is still reading this, then thank you wink

          Hopefully someone can give me a few pointers. Im running modx on my own apache so I can’t provide you with a link for now.

          -larsb
            Signature on it&#39;s way
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            First, I’ll address the redirect snippet. Put that in your site_start document (usually document id 1), according to the Site configuration you have set up for your MODx installation. What it will do is to immediately redirect a new visitor to the site to the language home page you want. Call the snippet like this:
            [[Redirect?id=`2`]]

            using the ID of whatever document you want a new user to see first on your site.

            Alternatively, you could skip this step altogether, and just set the site start in the Configuration for your MODx installation to the desired document (2, in this example case).

            Oh, don’t worry about the "" in the Wiki article, those are just editorial delimiters!
              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
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Here’s your TV...

              and what it will look like when editing each document that uses the templates you checked when you created the TV:

              This field (under the document’s regular content field) is where you would add the code for the other languages for this page, as in the example:
              en=2,pl=6,fr=7
                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
                • 8960
                • 150 Posts
                I tried the wiki steps out and it produced nothing, just as larsb had stated. Turns out when I edited my Languages snippet to include more languages, I didn’t add a comma at the end of the language set as seen here:

                  "en" => "English",
                  "de" => "Deutsch",
                  "fr" => "French",
                  "es" => "Spanish"
                  );

                The other issue I just had was when I entered in more than one language in the TV call from the document. In my TV, I put en=33, fr=51 instead of en=33,fr=51. Notice that you do not use a space in between these TV calls.

                If you are still having problems getting the languages to work, double check these 2 points. Also note that the Redirect operates separate from the languages. So if you are having trouble with languages, you shouldn’t be looking at the Redirect to fix that problem.
                  • 16680
                  • 73 Posts
                  YAY! Finally got it working, thanks alot for the support.

                  I only have one issue left, which is kind of weird.

                  When I type in the language (eg. da=1,en=2), in the document’s tv, the system won’t save the changes. Well, occasionally it will, which is what makes it weird. Is this is a bug, or me doing something wrong. (probably me tongue )
                    Signature on it&#39;s way
                    • 7291
                    • 129 Posts
                    I’ve also found that the save button on the bottom of the page sometimes doesn’t save immediately... so currently I go to the top of the page and hit the save button up there. Works fine
                      [center]-- smiley --[/center]
                      [center]New View Media - Custom Website Design[/center]
                      [center]Custom Website Design & Marketing = Strategic Business![/center]
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Every now and then I’ll have that problem, and not just if using the bottom save button. Sometimes I have to try two or three times before a TV gets saved. No idea why.
                        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