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...