https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113385
Revision: 113385
Author: robin
Date: 2012-03-08 19:30:30 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
Follow-up r112479
* Add @since, fix indentation.
* Change default from 'all' to 'mw' as it's the most used (so default
fetchLanguageNames() is equivalent to default getLanguageNames()).
* Add the include parameter also to fetchLanguageName() as it's needed in
Parser: interlanguage links should only take into account mediawiki names.
(Doesn't make a difference with how the functions are now, but could have been
later.)
Modified Paths:
--------------
trunk/phase3/includes/parser/Parser.php
trunk/phase3/languages/Language.php
Modified: trunk/phase3/includes/parser/Parser.php
===================================================================
--- trunk/phase3/includes/parser/Parser.php 2012-03-08 19:28:35 UTC (rev
113384)
+++ trunk/phase3/includes/parser/Parser.php 2012-03-08 19:30:30 UTC (rev
113385)
@@ -1901,11 +1901,9 @@
# Link not escaped by : , create the various objects
if ( $noforce ) {
- global $wgContLang;
-
# Interwikis
wfProfileIn( __METHOD__."-interwiki" );
- if ( $iw &&
$this->mOptions->getInterwikiMagic() && $nottalk &&
$wgContLang->getLanguageName( $iw ) ) {
+ if ( $iw &&
$this->mOptions->getInterwikiMagic() && $nottalk &&
Language::fetchLanguageName( $iw, null, 'mw' ) ) {
$this->mOutput->addLanguageLink(
$nt->getFullText() );
$s = rtrim( $s . $prefix );
$s .= trim( $trail, "\n" ) == '' ? '':
$prefix . $trail;
Modified: trunk/phase3/languages/Language.php
===================================================================
--- trunk/phase3/languages/Language.php 2012-03-08 19:28:35 UTC (rev 113384)
+++ trunk/phase3/languages/Language.php 2012-03-08 19:30:30 UTC (rev 113385)
@@ -682,14 +682,15 @@
/**
* Get an array of language names, indexed by code.
* @param $inLanguage null|string: Code of language in which to return
the names
- *
Use null for autonyms (native names)
+ * Use null for autonyms (native names)
* @param $include string:
* 'all' all available languages
* 'mw' only if the language is defined in MediaWiki or
wgExtraLanguageNames
* 'mwfile' only if the language is in 'mw' *and* has a
message file
* @return array|bool: language code => language name, false if
$include is wrong
+ * @since 1.20
*/
- public static function fetchLanguageNames( $inLanguage = null, $include
= 'all' ) {
+ public static function fetchLanguageNames( $inLanguage = null, $include
= 'mw' ) {
global $wgExtraLanguageNames;
static $coreLanguageNames;
@@ -743,11 +744,12 @@
/**
* @param $code string: The code of the language for which to get the
name
* @param $inLanguage null|string: Code of language in which to return
the name (null for autonyms)
+ * @param $include string: 'all', 'mw' or 'mwfile'; see
fetchLanguageNames()
* @return string: Language name or empty
* @since 1.20
*/
- public static function fetchLanguageName( $code, $inLanguage = null ) {
- $array = self::fetchLanguageNames( $inLanguage, 'all' );
+ public static function fetchLanguageName( $code, $inLanguage = null,
$include = 'all' ) {
+ $array = self::fetchLanguageNames( $inLanguage, $include );
return !array_key_exists( $code, $array ) ? '' : $array[$code];
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs