We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16182
    • 56 Posts
    I disagree about cloaking. Since YAMS would redirect with a 302, the process is pretty clear. The content would of course be present in a sitemap.xml and also directly linked via language selectors on the pages. The browser address changes, so there is no displaying of one content for users vs. displaying of other content for Googlebot under the same address.

    I feel this should be a choice for YAMS users.
      • 22851
      • 805 Posts
      Quote from: kongo09 at Jan 05, 2010, 10:42 AM

      Country level domains are good for countries - not necessarily languages. What language would you use with Switzerland or Belgium?
      On this point I agree with you!

      Quote from: kongo09 at Jan 05, 2010, 10:42 AM

      Automatic redirection would only happen if YAMS is set that way: e.g. unique URL else current else browser else default language. It would happen on any default language page, i.e. where the root name is empty.
      "unique URL else current else browser else default language." is what YAMS already does (can do). Wouldn’t you consider the default language pages as having unique URLs?

      Quote from: kongo09 at Jan 05, 2010, 10:42 AM

      I’ll try to put a new mode into YAMS to achieve this wink and will post my results here.
      Okay. I look forward to your efforts! Other users may find your contributions useful. Thanks for sharing your views. They are though provoking and I am sure other users considering how to set up their sites will benefit from this discussion.
        YAMS: Yet Another Multilingual Solution for MODx
        YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
        Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
        • 16182
        • 56 Posts
        yes, it is what YAMS does - with the difference that I don’t consider the server name mode without a root name to be unique wink So the only difference would actually be to check for that situation and initiate a redirect if a cookie is set or the browser language points to something other than default.
          • 16182
          • 56 Posts
          I have prepared a changed [tt]yams.class.inc.php[/tt] file to cover my needs as discussed above. Right now, it hijacks the [tt]current_else_browser[/tt] redirection mode. If this is useful at all for the community, I’m happy to make it a proper setting in the interface provided PMS is willing to integrate it into the official code base.

          documentation:

          // active: only for the "current_else_browser" redirection mode
          // but could as well be made a separate mode or even better: a switch for current, current_else_browser and browser mode
          // effect: if the default language has an empty root name and coincides with the monolingual root, the URL for default language pages
          // is no longer considered to indicate the language preference for sure. Instead, YAMS tests if a cookie has been set to indicate
          // an alternative language preference. If so, this leads to a temporary redirect as set in the preferences.
          // Without cookie, YAMS checks if the browser is sending a language preference and if that is different from the default, a
          // temporary redirect is sent as well (and a cookie is set for the future). This happens on any default language page.
          // For non-default language pages that carry a root name, the URL is treated as strongest preference for the language, stronger
          // than a cookie or a browser setting. Therefore, the cookie will be changed to the language reflected in the URL.
          // Note that monolingual pages will always take the URL back to the default language. However, the cookie will remain set to the
          // preferred language and as soon as the clickpath leads back to a multilingual document, a temporary redirect is performed as
          // described above.
            • 16182
            • 56 Posts
            Attached an updated version!

            It resolves the issue that usage of the language change paramter [tt]yams_new_lang=[/tt] didn’t change the language to default if a cookie was set to initiate a redirect to another non-default language. With the new version, the language change parameter overrides any other language preferences for the default language in root name mode.

            Note that it overrides the language even if the URL specified already indicates a different language preference, i.e. [tt]www.mysite.com/de/page?yams_new_lang=en[/tt] will change to English be redirecting to [tt]www.mysite.com/page[/tt] and setting the [tt]yams_lang[/tt] cookie to [tt]en[/tt].

            This is important for generating language change drop-downs or selections. As with this hack the default language with an empty root name has no longer unique URLs that for sure indicate the language, a language selector cannot just link back from [tt]www.mysite.com/de/somepage[/tt] to [tt]www.mysite.com/somepage[/tt] to switch from German to (e.g.) English. It would switch, but then YAMS discovers the cookie that got set while on the German page and it would do another redirect back to the German version. To achieve the language change, the usage of the [tt]yams_new_lang[/tt] parameter is now required, e.g. [tt]www.mysite.com/somapage?yams_new_lang=en[/tt] will switch back to English no matter what the cookie says.

            Hope you find this useful.
              • 16182
              • 56 Posts
              And here comes another update, purely for SEO reasons:

              If you use the [tt]yams_new_lang[/tt] parameter as described above to force a language change, this update now will issue a permanent redirect (301) to remove the [tt]yams_new_lang[/tt] parameter from the URL. In original YAMS, this would not happen for the special case of forced language change to a default language without a special root name, as the URL of that language already would clearly state the language.

              However, with the changes I did to the code, while the [tt]yams_new_lang[/tt] parameter does switch the language, the system wouldn’t redirect and therefore leave the parameter in the URL. This has now changed.

              On a side note: In order to keep the usage of [tt]yams_new_lang[/tt] to a minimum, I’m using the following chunk [tt]languageRepeat[/tt] together with the PHx plugin to output the parameter only for the default language, which is [tt]en[/tt] in my case:
              <li><a href="(yams_docr)[+phx:if=`(yams_tag)`:is=`en`:then=`?yams_new_lang=(yams_tag)`+]" title="[[YAMS? &get=`data` &from=`pagetitle`]]" >(yams_name)</a></li>
              


              This piece of code is called from the template like this
              <ul>[[YAMS? &get=`repeat` &repeattpl=`languageRepeat`]]</ul>
              


              Ok, I’ll shut up now. Enough hacks to YAMS...