https://bugzilla.wikimedia.org/show_bug.cgi?id=30047

       Web browser: ---
             Bug #: 30047
           Summary: Language selection does not change the
                    Content-language. -> patch
           Product: MediaWiki extensions
           Version: any
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: LanguageSelector
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


I have a closed-full translated wiki. It wold be very helpful if the
LanguageSelector can also switch the content-language.

Following code in LanguageSelector.php works very well for us:

//________________________________________________
define( 'LANGUAGE_SELECTOR_ADJUST_CONTENT', 1 ); 

$wgHooks['BeforeInitialize'][] = 'wfLanguageSelectorAdjustContent';

function wfLanguageSelectorAdjustContent( &$title, &$article, &$output, &$user,
$request, $this ) {
  global $wgLanguageSelectorRequestedLanguage, $wgLanguageNames,
$wgLanguageSelectorAdjustContent;
  if( isset($wgLanguageSelectorAdjustContent) &&
$wgLanguageSelectorAdjustContent=== LANGUAGE_SELECTOR_ADJUST_CONTENT){
    $langstr="/".$wgLanguageSelectorRequestedLanguage;
    $searchstr="#/(". implode('|',array_keys($wgLanguageNames)) ."$)#";
    $title->mTextform =preg_replace($searchstr,$langstr, $title->mTextform);
    $title->mUrlform =preg_replace($searchstr,$langstr, $title->mUrlform);
    $title->mDbkeyform =preg_replace($searchstr,$langstr, $title->mDbkeyform);
    $title->mUserCaseDBKey =preg_replace($searchstr,$langstr,
$title->mUserCaseDBKey);
  }
  return true;
}

//________________________________________________

So i can switch the new behavior in the LocalSettings.

$wgLanguageSelectorAdjustContent= LANGUAGE_SELECTOR_ADJUST_CONTENT;

Please let me know if you can add this to the next release or better to 1_17?

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to