https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113403
Revision: 113403
Author: robin
Date: 2012-03-08 20:56:26 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
Update core usage of getLanguageName[s].
Modified Paths:
--------------
trunk/phase3/includes/GlobalFunctions.php
trunk/phase3/includes/SkinLegacy.php
trunk/phase3/includes/SkinTemplate.php
trunk/phase3/includes/api/ApiParse.php
trunk/phase3/includes/api/ApiQuerySiteinfo.php
trunk/phase3/includes/cache/MessageCache.php
trunk/phase3/includes/installer/WebInstaller.php
trunk/phase3/includes/installer/WebInstallerPage.php
trunk/phase3/includes/media/FormatMetadata.php
trunk/phase3/includes/specials/SpecialAllmessages.php
trunk/phase3/maintenance/language/StatOutputs.php
trunk/phase3/maintenance/language/checkLanguage.inc
trunk/phase3/maintenance/language/languages.inc
trunk/phase3/maintenance/language/transstat.php
trunk/phase3/maintenance/rebuildLocalisationCache.php
Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php 2012-03-08 20:44:28 UTC (rev
113402)
+++ trunk/phase3/includes/GlobalFunctions.php 2012-03-08 20:56:26 UTC (rev
113403)
@@ -1322,7 +1322,7 @@
return $wgLang;
}
- $validCodes = array_keys( Language::getLanguageNames() );
+ $validCodes = array_keys( Language::fetchLanguageNames() );
if( in_array( $langcode, $validCodes ) ) {
# $langcode corresponds to a valid language.
return Language::factory( $langcode );
Modified: trunk/phase3/includes/SkinLegacy.php
===================================================================
--- trunk/phase3/includes/SkinLegacy.php 2012-03-08 20:44:28 UTC (rev
113402)
+++ trunk/phase3/includes/SkinLegacy.php 2012-03-08 20:56:26 UTC (rev
113403)
@@ -348,7 +348,7 @@
}
function otherLanguages() {
- global $wgOut, $wgLang, $wgContLang, $wgHideInterlanguageLinks;
+ global $wgOut, $wgLang, $wgHideInterlanguageLinks;
if ( $wgHideInterlanguageLinks ) {
return '';
@@ -375,7 +375,7 @@
$first = false;
$nt = Title::newFromText( $l );
- $text = $wgContLang->getLanguageName(
$nt->getInterwiki() );
+ $text = Language::fetchLanguageName(
$nt->getInterwiki() );
$s .= Html::element( 'a',
array( 'href' => $nt->getFullURL(), 'title' =>
$nt->getText(), 'class' => "external" ),
Modified: trunk/phase3/includes/SkinTemplate.php
===================================================================
--- trunk/phase3/includes/SkinTemplate.php 2012-03-08 20:44:28 UTC (rev
113402)
+++ trunk/phase3/includes/SkinTemplate.php 2012-03-08 20:56:26 UTC (rev
113403)
@@ -428,8 +428,8 @@
if ( $nt ) {
$language_urls[] = array(
'href' => $nt->getFullURL(),
- 'text' => (
$wgContLang->getLanguageName( $nt->getInterwiki() ) != '' ?
-
$wgContLang->getLanguageName( $nt->getInterwiki() ) : $l ),
+ 'text' => (
Language::fetchLanguageName( $nt->getInterwiki() ) != '' ?
+
Language::fetchLanguageName( $nt->getInterwiki() ) : $l ),
'title' => $nt->getText(),
'class' => $class,
'lang' => $nt->getInterwiki(),
Modified: trunk/phase3/includes/api/ApiParse.php
===================================================================
--- trunk/phase3/includes/api/ApiParse.php 2012-03-08 20:44:28 UTC (rev
113402)
+++ trunk/phase3/includes/api/ApiParse.php 2012-03-08 20:56:26 UTC (rev
113403)
@@ -399,7 +399,7 @@
$langs = array();
foreach ( $languages as $l ) {
$nt = Title::newFromText( $l );
- $text = $wgContLang->getLanguageName(
$nt->getInterwiki() );
+ $text = Language::fetchLanguageName(
$nt->getInterwiki() );
$langs[] = Html::element( 'a',
array( 'href' => $nt->getFullURL(), 'title' =>
$nt->getText(), 'class' => "external" ),
Modified: trunk/phase3/includes/api/ApiQuerySiteinfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQuerySiteinfo.php 2012-03-08 20:44:28 UTC
(rev 113402)
+++ trunk/phase3/includes/api/ApiQuerySiteinfo.php 2012-03-08 20:56:26 UTC
(rev 113403)
@@ -273,13 +273,8 @@
$params = $this->extractRequestParams();
$langCode = isset( $params['inlanguagecode'] ) ?
$params['inlanguagecode'] : '';
+ $langNames = Language::fetchLanguageNames( $langCode );
- if( $langCode ) {
- $langNames = Language::getTranslatedLanguageNames(
$langCode );
- } else {
- $langNames = Language::getLanguageNames();
- }
-
$getPrefixes = Interwiki::getAllPrefixes( $local );
$data = array();
@@ -479,13 +474,8 @@
public function appendLanguages( $property ) {
$params = $this->extractRequestParams();
$langCode = isset( $params['inlanguagecode'] ) ?
$params['inlanguagecode'] : '';
+ $langNames = Language::getLanguageNames( $langCode );
- if( $langCode ) {
- $langNames = Language::getTranslatedLanguageNames(
$langCode );
- } else {
- $langNames = Language::getLanguageNames();
- }
-
$data = array();
foreach ( $langNames as $code => $name ) {
Modified: trunk/phase3/includes/cache/MessageCache.php
===================================================================
--- trunk/phase3/includes/cache/MessageCache.php 2012-03-08 20:44:28 UTC
(rev 113402)
+++ trunk/phase3/includes/cache/MessageCache.php 2012-03-08 20:56:26 UTC
(rev 113403)
@@ -497,7 +497,7 @@
if ( $code === 'en' ) {
// Delete all sidebars, like for example on
action=purge on the
// sidebar messages
- $codes = array_keys( Language::getLanguageNames() );
+ $codes = array_keys( Language::fetchLanguageNames() );
}
global $wgMemc;
@@ -869,7 +869,7 @@
* Clear all stored messages. Mainly used after a mass rebuild.
*/
function clear() {
- $langs = Language::getLanguageNames( false );
+ $langs = Language::fetchLanguageNames( null, 'mw' );
foreach ( array_keys($langs) as $code ) {
# Global cache
$this->mMemc->delete( wfMemcKey( 'messages', $code ) );
@@ -891,8 +891,7 @@
}
$lang = array_pop( $pieces );
- $validCodes = Language::getLanguageNames();
- if( !array_key_exists( $lang, $validCodes ) ) {
+ if( !Language::fetchLanguageName( $lang, null, 'mw' ) ) {
return array( $key, $wgLanguageCode );
}
Modified: trunk/phase3/includes/installer/WebInstaller.php
===================================================================
--- trunk/phase3/includes/installer/WebInstaller.php 2012-03-08 20:44:28 UTC
(rev 113402)
+++ trunk/phase3/includes/installer/WebInstaller.php 2012-03-08 20:56:26 UTC
(rev 113403)
@@ -485,7 +485,7 @@
public function getAcceptLanguage() {
global $wgLanguageCode, $wgRequest;
- $mwLanguages = Language::getLanguageNames();
+ $mwLanguages = Language::fetchLanguageNames();
$headerLanguages = array_keys( $wgRequest->getAcceptLang() );
foreach ( $headerLanguages as $lang ) {
Modified: trunk/phase3/includes/installer/WebInstallerPage.php
===================================================================
--- trunk/phase3/includes/installer/WebInstallerPage.php 2012-03-08
20:44:28 UTC (rev 113402)
+++ trunk/phase3/includes/installer/WebInstallerPage.php 2012-03-08
20:56:26 UTC (rev 113403)
@@ -162,7 +162,7 @@
$userLang = $r->getVal( 'uselang' );
$contLang = $r->getVal( 'ContLang' );
- $languages = Language::getLanguageNames();
+ $languages = Language::fetchLanguageNames();
$lifetime = intval( ini_get( 'session.gc_maxlifetime' ) );
if ( !$lifetime ) {
$lifetime = 1440; // PHP default
@@ -233,7 +233,7 @@
$s .= Html::openElement( 'select', array( 'id' => $name, 'name'
=> $name,
'tabindex' => $this->parent->nextTabIndex() ) )
. "\n";
- $languages = Language::getLanguageNames();
+ $languages = Language::fetchLanguageNames();
ksort( $languages );
foreach ( $languages as $code => $lang ) {
if ( isset( $wgDummyLanguageCodes[$code] ) ) continue;
Modified: trunk/phase3/includes/media/FormatMetadata.php
===================================================================
--- trunk/phase3/includes/media/FormatMetadata.php 2012-03-08 20:44:28 UTC
(rev 113402)
+++ trunk/phase3/includes/media/FormatMetadata.php 2012-03-08 20:56:26 UTC
(rev 113403)
@@ -800,7 +800,7 @@
break;
case 'LanguageCode':
- $lang = $wgLang->getLanguageName(
strtolower( $val ) );
+ $lang = Language::fetchLanguageName(
strtolower( $val ), $wgLang );
if ($lang) {
$val = htmlspecialchars( $lang
);
} else {
@@ -941,7 +941,6 @@
* this is treated as wikitext not html).
*/
private static function langItem( $value, $lang, $default = false,
$noHtml = false ) {
- global $wgContLang;
if ( $lang === false && $default === false) {
throw new MWException('$lang and $default cannot both '
. 'be false.');
@@ -966,11 +965,11 @@
}
$lowLang = strtolower( $lang );
- $langName = $wgContLang->getLanguageName( $lowLang );
+ $langName = Language::fetchLanguageName( $lowLang );
if ( $langName === '' ) {
//try just the base language name. (aka en-US -> en ).
list( $langPrefix ) = explode( '-', $lowLang, 2 );
- $langName = $wgContLang->getLanguageName( $langPrefix );
+ $langName = Language::fetchLanguageName( $langPrefix );
if ( $langName === '' ) {
// give up.
$langName = $lang;
Modified: trunk/phase3/includes/specials/SpecialAllmessages.php
===================================================================
--- trunk/phase3/includes/specials/SpecialAllmessages.php 2012-03-08
20:44:28 UTC (rev 113402)
+++ trunk/phase3/includes/specials/SpecialAllmessages.php 2012-03-08
20:56:26 UTC (rev 113403)
@@ -146,7 +146,7 @@
function buildForm() {
global $wgScript;
- $languages = Language::getLanguageNames( false );
+ $languages = Language::fetchLanguageNames( null, 'mw' );
ksort( $languages );
$out = Xml::openElement( 'form', array( 'method' => 'get',
'action' => $wgScript, 'id' => 'mw-allmessages-form' ) ) .
Modified: trunk/phase3/maintenance/language/StatOutputs.php
===================================================================
--- trunk/phase3/maintenance/language/StatOutputs.php 2012-03-08 20:44:28 UTC
(rev 113402)
+++ trunk/phase3/maintenance/language/StatOutputs.php 2012-03-08 20:56:26 UTC
(rev 113403)
@@ -46,7 +46,7 @@
/** Outputs WikiText */
class wikiStatsOutput extends statsOutput {
function heading() {
- global $wgDummyLanguageCodes, $wgContLang;
+ global $wgDummyLanguageCodes;
$version = SpecialVersion::getVersion( 'nodb' );
echo "'''Statistics are based on:''' <code>" . $version .
"</code>\n\n";
echo "'''Note:''' These statistics can be generated by running
<code>php maintenance/language/transstat.php</code>.\n\n";
@@ -55,7 +55,7 @@
if( is_array( $wgDummyLanguageCodes ) ) {
$dummyCodes = array();
foreach( $wgDummyLanguageCodes as $dummyCode =>
$correctCode ) {
- $dummyCodes[] = $wgContLang->getLanguageName(
$dummyCode ) . ' (' . $dummyCode . ')';
+ $dummyCodes[] = Language::fetchLanguageName(
$dummyCode ) . ' (' . $dummyCode . ')';
}
echo ', as well as the following languages that are not
intended for system message translations, usually because they redirect to
other language codes: ' . implode( ', ', $dummyCodes );
}
Modified: trunk/phase3/maintenance/language/checkLanguage.inc
===================================================================
--- trunk/phase3/maintenance/language/checkLanguage.inc 2012-03-08 20:44:28 UTC
(rev 113402)
+++ trunk/phase3/maintenance/language/checkLanguage.inc 2012-03-08 20:56:26 UTC
(rev 113403)
@@ -402,7 +402,6 @@
* Output the checks results as wiki text.
*/
function outputWiki() {
- global $wgContLang;
$detailText = '';
$rows[] = '! Language !! Code !! Total !! ' . implode( ' !! ',
array_diff( $this->checks, $this->nonMessageChecks() ) );
foreach ( $this->results as $code => $results ) {
@@ -438,7 +437,7 @@
# Don't list languages without problems
continue;
}
- $language = $wgContLang->getLanguageName( $code );
+ $language = Language::fetchLanguageName( $code );
$rows[] = "| $language || $code || $problems || " .
implode( ' || ', $numbers );
}
Modified: trunk/phase3/maintenance/language/languages.inc
===================================================================
--- trunk/phase3/maintenance/language/languages.inc 2012-03-08 20:44:28 UTC
(rev 113402)
+++ trunk/phase3/maintenance/language/languages.inc 2012-03-08 20:56:26 UTC
(rev 113403)
@@ -54,7 +54,7 @@
$this->mOptionalMessages = array_merge(
$wgOptionalMessages, $wgEXIFMessages );
}
- $this->mLanguages = array_keys( Language::getLanguageNames(
true ) );
+ $this->mLanguages = array_keys( Language::fetchLanguageNames(
null, 'mwfile' ) );
sort( $this->mLanguages );
}
Modified: trunk/phase3/maintenance/language/transstat.php
===================================================================
--- trunk/phase3/maintenance/language/transstat.php 2012-03-08 20:44:28 UTC
(rev 113402)
+++ trunk/phase3/maintenance/language/transstat.php 2012-03-08 20:56:26 UTC
(rev 113403)
@@ -102,7 +102,7 @@
}
# Calculate the numbers
- $language = $wgContLang->getLanguageName( $code );
+ $language = Language::fetchLanguageName( $code );
$fallback = $wgLanguages->getFallback( $code );
$messages = $wgLanguages->getMessages( $code );
$messagesNumber = count( $messages['translated'] );
Modified: trunk/phase3/maintenance/rebuildLocalisationCache.php
===================================================================
--- trunk/phase3/maintenance/rebuildLocalisationCache.php 2012-03-08
20:44:28 UTC (rev 113402)
+++ trunk/phase3/maintenance/rebuildLocalisationCache.php 2012-03-08
20:56:26 UTC (rev 113403)
@@ -72,7 +72,7 @@
}
$lc = new LocalisationCache_BulkLoad( $conf );
- $codes = array_keys( Language::getLanguageNames( true ) );
+ $codes = array_keys( Language::fetchLanguageNames( null,
'mwfile' ) );
sort( $codes );
// Initialise and split into chunks
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs