On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Allright, so I've been banging about with Evo for 4 years, and I had been using a very simple mechanism for multilingual sites that was fine except now I'm working with higher profile clients and they need unique urls for SEO purposes.

    So, took the plunge and setup YAMS for the first time. Everything seems to be working swimmingly (for the time being!)- just passing the yams tags to snippets through a parameter in the snippet call, etc. However, I'm running into a singular issue that is a requirement for the client.

    I have the site start page setup to use a multilingual template. I have set the option for the site start filename to not be shown. I am only using unique/multilingual aliases: no language dependent server name mode or root name mode. I have set the redirection mode to current else browser.

    The client requests that the site start doc (homepage) be configured so that either the last language selected by the user (which I've noted is set by a cookie by YAMS) or the browser language determine the language displayed when loading the home page. With the configuration as mentioned above, whenever loading the site start page (without a referring url, such as mysitename.com), the language displayed is the default language as setup in the YAMS module configuration for languages.

    I'm willing to modify the class to make this happen, but only for the site start page- I want the default YAMS behavior to truck along as normal for the rest of the site!

    Any ideas? Been banging around this for the last couple of days...
    • hi,

      i think if you would like this behaviour only on the site start page, you shouldn't modify yams behaviour

      personally, in the case you describe, i would simply write a snippet to detect the browser language (using $_SERVER["HTTP_ACCEPT_LANGUAGE"]) and/or the existence of a yams cookie and set the redirection accordingly

      have swing
      • virtual-
        Thanks for the reply. I considered this, but I really don't like doing header redirects on the homepage of a site- I've found that recently Google has been treating 301 redirects as errors (even if it's only a single redirect)- so that's why I was hoping to find a way to deal with this in YAMS directly. I was very much assuming that since I'd set the option in YAMS to not include the language alias on the site start page, that it would treat the home page as a page that doesn't have the language defined and would therefore use the redirection mode in the configuration (I had set this to Browser) which would do exactly as I was hoping for. Alas, this isn't the case, and seems odd to me.
        • hi,

          well, i can understand your hesitation about redirection but, you know, actually YAMS does use that $_SERVER["HTTP_ACCEPT_LANGUAGE"] var i was suggesting you to make a snippet with when redirection is set on "browser"... smiley

          reading your first post, i was surprises by one thing, for a recent website i've used the last release of YAMS (1.2.0 RC3) and, at least one of the behaviors you're looking for seems to be what yams does, the fact that when you come back to the website, you've got it in the language you'd choosen during your las visit.
          This is achieved by setting the redirection mode to "current" or "current or browser"

          one thing that may help it working like this is to put * in YAMS config "MODx URLs" field because, when you do this, yams doesn't retreive the language information from the url (the /en/, /fr/ part) but sets a cookie to manage languages

          have swing