$wgWhitelistRead = array ( ':Accueil', ':Main_Page');
+/*
+When translating messages with wfMsg(), it is not always clear what should
+be considered UI messages and what shoud be content messages.
+
+For example, for regular wikipedia site like en, there should be only one
+'mainpage', therefore when getting the link of 'mainpage', we should
+treate it as content of the site and call wfMsgForContent(), while for
+rendering the text of the link, we call wfMsg(). The code in default
+behaves this way. However, sites like common do offer different versions
+of 'mainpage' and the like for different languages. This array provides a
+way to override the default behavior. For example, to allow language specific
+mainpage and community portal, set
+
+$wgForceUIMsgAsContentMsg = array( 'mainpage', 'portal-url' );
+
+*/
+$wgForceUIMsgAsContentMsg = array();
+
/**
* Authentication plugin.
*/
* Get a message from anywhere, for the content
*/
function wfMsgForContent( $key ) {
+ global $wgForceUIMsgAsContentMsg;
$args = func_get_args();
array_shift( $args );
- return wfMsgReal( $key, $args, true, true );
+ $forcontent = true;
+ if( is_array( $wgForceUIMsgAsContentMsg ) &&
+ in_array( $key, $wgForceUIMsgAsContentMsg ) )
+ $forcontent = false;
+ return wfMsgReal( $key, $args, true, $forcontent );
}
/**
* Get a message from the language file, for the content
*/
function wfMsgNoDBForContent( $key ) {
+ global $wgForceUIMsgAsContentMsg;
$args = func_get_args();
array_shift( $args );
- return wfMsgReal( $key, $args, false, true );
+ $forcontent = true;
+ if( is_array( $wgForceUIMsgAsContentMsg ) &&
+ in_array( $key, $wgForceUIMsgAsContentMsg ) )
+ $forcontent = false;
+ return wfMsgReal( $key, $args, false, $forcontent );
}
* @subpackage Maintenance
*/
-
+require_once('languages/Names.php');
function initialiseMessages( $overwrite = false, $messageArray = false ) {
global $wgContLang, $wgContLanguageCode;
global $wgContLangClass, $wgAllMessagesEn;
global $wgDisableLangConversion;
+ global $wgForceUIMsgAsContentMsg;
+ global $wgLanguageNames;
global $IP;
# overwrite language conversion option so that all variants
}
}
+ /*
+ initialize all messages in $wgForceUIMsgAsContentMsg for all
+ languages in Names.php
+ */
+ if( is_array( $wgForceUIMsgAsContentMsg ) ) {
+ foreach( $wgForceUIMsgAsContentMsg as $uikey ) {
+ foreach( $wgLanguageNames as $code => $name) {
+ if( $code == $wgContLanguageCode )
+ continue;
+ $msg = $wgContLang->getMessage( $uikey );
+ if( $msg )
+ $messages[$uikey. '/' . $code] = $msg;
+ }
+ }
+ }
+
initialiseMessagesReal( $overwrite, $messages );
}