X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FGlobalFunctions.php;h=069e1beea459b543e91e1799a89cb6169e899e41;hb=d4f712c326a0c108efda7f71e4eb8a1152a3a678;hp=484dfe8d4d624050a1fa78dd503b9ed3d0e67667;hpb=77f1eaa165a5b8b8aa5762460d5506469c3cdf24;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 484dfe8d4d..069e1beea4 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2350,6 +2350,7 @@ function wfShellExecWithStderr( $cmd, &$retval = null, $environ = [], $limits = * @see $wgShellLocale */ function wfInitShellLocale() { + wfDeprecated( __FUNCTION__, '1.30' ); } /** @@ -3166,29 +3167,13 @@ function wfShorthandToInteger( $string = '', $default = -1 ) { * See unit test for examples. * See mediawiki.language.bcp47 for the JavaScript implementation. * + * @deprecated since 1.31, use LanguageCode::bcp47() directly. + * * @param string $code The language code. * @return string The language code which complying with BCP 47 standards. */ function wfBCP47( $code ) { - $codeSegment = explode( '-', $code ); - $codeBCP = []; - foreach ( $codeSegment as $segNo => $seg ) { - // when previous segment is x, it is a private segment and should be lc - if ( $segNo > 0 && strtolower( $codeSegment[( $segNo - 1 )] ) == 'x' ) { - $codeBCP[$segNo] = strtolower( $seg ); - // ISO 3166 country code - } elseif ( ( strlen( $seg ) == 2 ) && ( $segNo > 0 ) ) { - $codeBCP[$segNo] = strtoupper( $seg ); - // ISO 15924 script code - } elseif ( ( strlen( $seg ) == 4 ) && ( $segNo > 0 ) ) { - $codeBCP[$segNo] = ucfirst( strtolower( $seg ) ); - // Use lowercase for other cases - } else { - $codeBCP[$segNo] = strtolower( $seg ); - } - } - $langCode = implode( '-', $codeBCP ); - return $langCode; + return LanguageCode::bcp47( $code ); } /**