Author: bugzilla
Description:
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?
Version: unspecified
Severity: normal
See Also:
T63695: Selecting a different language should switch the language of the content served