The template fetch function 'switchlanguage' only switches the last element of the url alias. Any parent nodes are translated according to [RegionalSettings].SiteLanguageList rather than the specified language.
The attached patch against git master solves the problem, by ensuring that the specified language is always the first in the prioritised list.
Tested successfully against the following unit tests:
- eZURLAliasMlTest *
- eZURLAliasMlRegression *
- Create a folder in English and Norwegian
- Within it, create an article in English and Norwegian
- Go to a site access where English is the most prioritised language
- Run the 'switchlanguage' template fetch function on the article, fetching the Norwegian url alias
- BUG: The resulting url alias is: "english_folder_name/norwegian_article_name"