Reported from downstream https://phabricator.miraheze.org/T9174. Sorry for the unusual markup/method, this is how it came in
Language selection can fail with $wgTranslatePageTranslationULS on
- Open any page with English selected (for example, the main page of dragontamer wiki).
- Change the language through the Universal Language Selector to a different language (for example, French/français)
Result: In most cases, the language does not change from English.
- If it failed to change the language, refresh the page.
Result: In some cases, refreshing the page changes the language to the one chosen before that failed.
- If it still hasn't worked, select the language again.
Result: There is a chance selecting again will actually work.
- If it's still showing English, repeat points 3 and 4 until it successfully changes the language.
Note: This issue works in reverse as well, changing from a non-English language to English can fail similarly. It's also possible to happen regardless of languages changed but I mostly encountered it to/from English. Also, if the page has a translation in that language, it can still fail to load the translated page, even if the language changes properly.
This issue completely doesn't exist with $wgTranslatePageTranslationULS being turned off. My guess is that the refresh done by ULS to load the correct version of the page collides with the language changing process itself.
Language gets changed to an incorrect one with $wgTranslatePageTranslationULS on
- Change your language through the ULS. If needed, follow the steps in the first issue. (for example, English > français)
- Change the language through the ULS to a different language than the previous ones. (français > español)
- Change the language to the initial language. (español > English)
Result: The language can change to the incorrect language. It always happened to be the 2nd language (français in the example). A page refresh has always fixed that to the correct language in my testing.
Note: This can happen when selecting more languages in a row as well. I had French keep selecting itself instead of other languages 3 times in a row. As the first issue it's only happening when the $wgTranslatePageTranslationULS setting is turned on.
Language changes when leaving a page
- Change your language through the ULS. If needed, follow the steps in the first issue.
- Click on a link to a different page.
Result: The language can change back to the previous language.
- Go back to the previous page.
Result: In some cases, the language gets changed again, or if it didn't change previously, it can change now (both pages "remember" a different language).
Note: I've been reproducing it consistently on those two pages (1, 2, you can use either the top navigation or copy-paste urls to move between them. I also used safemode=1 and it still happened, so no JS or CSS is triggering this behavior). Without Special:MyLanguage links this issue seemed to happen even more consistently.
The Translate extension might be involved here: The Stardust Labs wiki doesn't use it anymore and I couldn't reproduce this issue on there.
Those are the issues I could find consistent behaviors for, but there can be more I couldn't pin down yet.
Also a note about dragontamer wiki specifically: We will be soon implementing a simplified language selector on that wiki (that is mostly a js-made copy of the user dropdown ULS selector with some CSS tweaks to it). However the original will be kept in the user dropdown if more testing/checking needs to be done there, and we will not modify it in any way.
- dragontamer wiki has $wgTranslatePageTranslationULS turned off, stardustlabs wiki doesn't have this option because it doesn't use Translate anymore.
- Both of those wikis use a JS script that adds Special:MyLanguage/ to most links before page names. This is done after a page has fully loaded. This is not interfering with the selector though, links could as well have this part added manually for the same effect. We turned off the script before as a test and used manually changed links, and the issues still remain.
Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
MediaWiki 1.38.1 (1a600c6)
PHP 7.4.28 (fpm-fcgi)