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 );
}
function otherLanguages() {
- global $wgOut, $wgLang, $wgContLang, $wgHideInterlanguageLinks;
+ global $wgOut, $wgLang, $wgHideInterlanguageLinks;
if ( $wgHideInterlanguageLinks ) {
return '';
$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" ),
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(),
$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" ),
$params = $this->extractRequestParams();
$langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
-
- if( $langCode ) {
- $langNames = Language::getTranslatedLanguageNames( $langCode );
- } else {
- $langNames = Language::getLanguageNames();
- }
+ $langNames = Language::fetchLanguageNames( $langCode );
$getPrefixes = Interwiki::getAllPrefixes( $local );
$data = array();
public function appendLanguages( $property ) {
$params = $this->extractRequestParams();
$langCode = isset( $params['inlanguagecode'] ) ? $params['inlanguagecode'] : '';
-
- if( $langCode ) {
- $langNames = Language::getTranslatedLanguageNames( $langCode );
- } else {
- $langNames = Language::getLanguageNames();
- }
+ $langNames = Language::getLanguageNames( $langCode );
$data = array();
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;
* 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 ) );
}
$lang = array_pop( $pieces );
- $validCodes = Language::getLanguageNames();
- if( !array_key_exists( $lang, $validCodes ) ) {
+ if( !Language::fetchLanguageName( $lang, null, 'mw' ) ) {
return array( $key, $wgLanguageCode );
}
public function getAcceptLanguage() {
global $wgLanguageCode, $wgRequest;
- $mwLanguages = Language::getLanguageNames();
+ $mwLanguages = Language::fetchLanguageNames();
$headerLanguages = array_keys( $wgRequest->getAcceptLang() );
foreach ( $headerLanguages as $lang ) {
$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
$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;
break;
case 'LanguageCode':
- $lang = $wgLang->getLanguageName( strtolower( $val ) );
+ $lang = Language::fetchLanguageName( strtolower( $val ), $wgLang );
if ($lang) {
$val = htmlspecialchars( $lang );
} else {
* 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.');
}
$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;
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' ) ) .
/** 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";
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 );
}
* 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 ) {
# Don't list languages without problems
continue;
}
- $language = $wgContLang->getLanguageName( $code );
+ $language = Language::fetchLanguageName( $code );
$rows[] = "| $language || $code || $problems || " . implode( ' || ', $numbers );
}
$this->mOptionalMessages = array_merge( $wgOptionalMessages, $wgEXIFMessages );
}
- $this->mLanguages = array_keys( Language::getLanguageNames( true ) );
+ $this->mLanguages = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) );
sort( $this->mLanguages );
}
}
# Calculate the numbers
- $language = $wgContLang->getLanguageName( $code );
+ $language = Language::fetchLanguageName( $code );
$fallback = $wgLanguages->getFallback( $code );
$messages = $wgLanguages->getMessages( $code );
$messagesNumber = count( $messages['translated'] );
}
$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