•  
      request #27517 User's locale is not respected when logging in on MediaWiki
    Infos
    #27517
    Thomas Gerbet (tgerbet)
    2022-07-26 15:12
    2022-06-27 15:08
    29062
    Details
    User's locale is not respected when logging in on MediaWiki

    The interface is always displayed in English even if the the user's locale is set to fr.

    The case seems to have been managed in the MediaWiki extension: https://github.com/wikimedia/mediawiki-extensions-TuleapIntegration/blob/780794ec048c424fd8925b2b3705be58250cb193/src/Special/TuleapLogin.php#L116-L118

    Mediawiki Standalone
    Empty
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Robert Vogel (rvogel), Dejan Savuljesku (dsavuljesku)
    Stage
    Dejan Savuljesku (dsavuljesku)
    Closed
    2022-07-18
    Attachments
    References
    Referencing request #27517

    Follow-ups

    User avatar
    Robert Vogel (rvogel)2022-07-18 17:34

    A simple workaround can be to reduce the list of languages. This can easily be implemented in the "TuleapIntegration" extension.

    Example Code to try out in LocalSettings.Tuleap.php

    $GLOBALS['wgHooks']['GetPreferences'][] = function( $user, array &$preferences ) {
    	$preferences['language']['options'] = array_filter(
    		$preferences['language']['options'],
    		function( $langCode ) {
    			return in_array( $langCode, ['en', 'fr', 'pt'] );
    		}
    );
    	return true;
    };
    
    User avatar

    Integrated in Tuleap 13.10.99.138

    I suggest to open a dedicated request to track the issue related to language switch.


    • Status changed from Verified to Closed
    • Connected artifacts
    • Close date set to 2022-07-18
    User avatar
    Robert Vogel (rvogel)2022-07-15 14:35

    I have tested this on our internal testsystem. The user preference is properly transferred from Tuleap and persisted into the Wikis DB (A re-login/session-reset may be requried though).

    But: Currently this change does not take any effect, as LocalSettings.Tuleap.php contains

    $GLOBALS['wgHiddenPrefs'][] = 'language';
    

    In such cases, MediaWiki will fall back to the default value, which is the same as the wikis content language. We must not modify the content language based on a user specific preference, so we have to remove that setting.

    If you need to hide the "Language" option from "Special:Preferences" we may try to use CSS in the skin to just hide it, or come up with another programmatic solution.

    Which do you prefer?