We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    I am no coder, but my guess is, the plugin needs OnWebPagePrerender or OnLoadWebDocument checked, remember that plugins can listen to Systems Events and since the plugin uses Sessions it makes sense.

    But I’ll let Wendy (or any qualified php whiz) explain it better...
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 34017
      • 898 Posts
      Wendy,

      One question with your solution. Where did you set the $lang? Did you create a snippet/TV/form?

      Thanks,
      Chuck
        Chuck the Trukk
        ProWebscape.com :: Nashville-WebDesign.com
        - - - - - - - -
        What are TV's? Here's some info below.
        http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
        http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
        • 32241
        • 1,495 Posts
        Quote from: ProWebscape at Jun 29, 2006, 12:45 AM

        Wendy,

        One question with your solution. Where did you set the $lang? Did you create a snippet/TV/form?

        Thanks,
        Chuck

        Lets take an example with [*content*].
        The solution will always assume that the default language is inside document variable content. The solution will not care about what language is inside of that document variable, so you need to set your own best practices to always assume that the default languaue is always be english or other language that you choose.

        Now whenever you put ?lang=en or ?lang=fr in your address, the solution will store that configuration in the system. So whenever a user requested a new page, the system will try to look for the language translation such as [*content_en*] or [*content_fr*]. If the current document variables/template variable is not accessible or it’s empty, it will revert back to [*content*] instead.

        That’s the whole concept of the solution. A pretty straight forward solution that serve well on my current site.

        Sincerely,
        Wendy Novianto
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
          • 34017
          • 898 Posts
          Wendy,

          After looking at your site and reading your example, it does make sense. Seems like a nice, robust solution.

          Chuck
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 32241
            • 1,495 Posts
            Quote from: ppaul at Jun 28, 2006, 12:21 PM

            This is my short term solution that I use for my current website. It uses TV and session

            Sorry for the dumb question:
            But: How do Plugin and Snippet interact? And why is the Plugin needed at all? It seems to me that the snippet is performing very similar actions to those of the plugin (also using the $_SESSION variable for instance?

            The snippet alone is enough, but the plugin is needed to ensure that everytime someone type in ?lang=en in the address, the plugin will grab the input and store it in the current session, which you can’t achieve it with snippet alone, because there is a possibility that the snippet is not included in all the pages.

            If you want to put the plugin code on the snippet, you can do so. It’s just my way of doing it, but with MODx you can have hundred of ways to achieve the same thing because of the flexibility in MODx.
              Wendy Novianto
              [font=Verdana]PT DJAMOER Technology Media
              [font=Verdana]Xituz Media
              • 9549
              • 93 Posts
              How do you translate the menu using this method? I’ve been struggling to figure out how to make a site in three different languages. Using this, or sottwell’s method.. I don’t know. The catch is that my client wants a catalogue to add their products, and using separate folders for each language would cause problems. That said, using TVs would be easier. But then comes two problems, I don’t know how to update TVs from the frontend and I must rework the menu somehow. undecided
                • 9549
                • 93 Posts
                I ended up combining both sottwell’s SetLangCookie method and Djaemor’s LanguageVar snippet. I build the menu tree as sottwell suggested and then created an unpublished folder on top of that to hold all articles, products or whatever it may be. That folder has the same structure as the language folders.

                And to list the articles in different languages I simply called the Ditto snippet in each language folder with a chunk like this &tpl=`chkShowProdEn` or &tpl=`chkShowProdDe` depending on the chosen language. Later on, in each chkShowProd chunk I typed <a href="[~[+id+]~]&lang=en"> to make the outputs as links to the preferred language via the LanguageVar snippet.


                All this may seem like a mess, I could explain it in more detail if necessary.
                I don’t know if this is the optimal way to go, but it works... for now grin