The $ucfirst and $wgContentLang variables are not used by get().
Keep these inside getMessageFromFallbackChain() instead.
Also add mark getMsgFromNamespace() as public since it is used
in other places in core and by extensions.
Change-Id: I83bf77c17aa46f3929f89c4af97693611761629b
* message (which can be empty)
*/
function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
* message (which can be empty)
*/
function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
if ( is_int( $key ) ) {
// Fix numerical strings that somehow become ints
// on their way here
if ( is_int( $key ) ) {
// Fix numerical strings that somehow become ints
// on their way here
Hooks::run( 'MessageCache::get', array( &$lckey ) );
Hooks::run( 'MessageCache::get', array( &$lckey ) );
- $uckey = $wgContLang->ucfirst( $lckey );
-
// Loop through each language in the fallback list until we find something useful
$lang = wfGetLangObj( $langcode );
$message = $this->getMessageFromFallbackChain(
$lang,
$lckey,
// Loop through each language in the fallback list until we find something useful
$lang = wfGetLangObj( $langcode );
$message = $this->getMessageFromFallbackChain(
$lang,
$lckey,
!$this->mDisable && $useDB
);
!$this->mDisable && $useDB
);
- * Given a language, try and fetch a message from that language, then the
- * fallbacks of that language, then the site language, then the fallbacks for the
- * site language.
+ * Given a language, try and fetch messages from that language.
- * @param Language $lang Requested language
- * @param string $lckey Lowercase key for the message
- * @param string $uckey Uppercase key for the message
- * @param bool $useDB Whether to use the database
+ * Will also consider fallbacks of that language, the site language, and fallbacks for
+ * the site language.
*
* @see MessageCache::get
*
* @see MessageCache::get
+ * @param Language|StubObject $lang Preferred language
+ * @param string $lckey Lowercase key for the message (as for localisation cache)
+ * @param bool $useDB Whether to include messages from the wiki database
* @return string|bool The message, or false if not found
*/
* @return string|bool The message, or false if not found
*/
- protected function getMessageFromFallbackChain( $lang, $lckey, $uckey, $useDB ) {
+ protected function getMessageFromFallbackChain( $lang, $lckey, $useDB ) {
global $wgLanguageCode, $wgContLang;
global $wgLanguageCode, $wgContLang;
+ $uckey = $wgContLang->ucfirst( $lckey );
$langcode = $lang->getCode();
$message = false;
$langcode = $lang->getCode();
$message = false;
* @param string $code Code denoting the language to try.
* @return string|bool The message, or false if it does not exist or on error
*/
* @param string $code Code denoting the language to try.
* @return string|bool The message, or false if it does not exist or on error
*/
- function getMsgFromNamespace( $title, $code ) {
+ public function getMsgFromNamespace( $title, $code ) {
$this->load( $code );
if ( isset( $this->mCache[$code][$title] ) ) {
$entry = $this->mCache[$code][$title];
$this->load( $code );
if ( isset( $this->mCache[$code][$title] ) ) {
$entry = $this->mCache[$code][$title];