X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=languages%2FLanguage.php;h=1320a57cb8038c70ee7ef6cd3e29da027506bde4;hb=5a7e9ba954c9b0556269be941080cd8c8fd10ff0;hp=d750f7d519a11f846ed7a6626e60e1444c047d46;hpb=2224e31507249e2ed86eae5f0beac731ee8a921c;p=lhc%2Fweb%2Fwiklou.git diff --git a/languages/Language.php b/languages/Language.php index d750f7d519..1320a57cb8 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -273,7 +273,7 @@ class Language { * language, script or variant codes actually exist in the repositories. * * Based on regexes by Mark Davis of the Unicode Consortium: - * http://unicode.org/repos/cldr/trunk/tools/java/org/unicode/cldr/util/data/langtagRegex.txt + * https://www.unicode.org/repos/cldr/trunk/tools/java/org/unicode/cldr/util/data/langtagRegex.txt * * @param string $code * @param bool $lenient Whether to allow '_' as separator. The default is only '-'. @@ -792,12 +792,12 @@ class Language { /** * Get an array of language names, indexed by code. * @param null|string $inLanguage Code of language in which to return the names - * Use null for autonyms (native names) + * Use null for autonyms (native names) * @param string $include One of: - * 'all' all available languages - * 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames (default) - * 'mwfile' only if the language is in 'mw' *and* has a message file - * @return array Language code => language name + * 'all' all available languages + * 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames (default) + * 'mwfile' only if the language is in 'mw' *and* has a message file + * @return array Language code => language name (sorted by key) * @since 1.20 */ public static function fetchLanguageNames( $inLanguage = null, $include = 'mw' ) { @@ -823,7 +823,7 @@ class Language { * 'all' all available languages * 'mw' only if the language is defined in MediaWiki or wgExtraLanguageNames (default) * 'mwfile' only if the language is in 'mw' *and* has a message file - * @return array Language code => language name + * @return array Language code => language name (sorted by key) */ private static function fetchLanguageNamesUncached( $inLanguage = null, $include = 'mw' ) { global $wgExtraLanguageNames, $wgUsePigLatinVariant; @@ -1951,8 +1951,8 @@ class Language { * Gets directionality of the first strongly directional codepoint, for embedBidi() * * This is the rule the BIDI algorithm uses to determine the directionality of - * paragraphs ( http://unicode.org/reports/tr9/#The_Paragraph_Level ) and - * FSI isolates ( http://unicode.org/reports/tr9/#Explicit_Directional_Isolates ). + * paragraphs ( https://www.unicode.org/reports/tr9/#The_Paragraph_Level ) and + * FSI isolates ( https://www.unicode.org/reports/tr9/#Explicit_Directional_Isolates ). * * TODO: Does not handle BIDI control characters inside the text. * TODO: Does not handle unallocated characters. @@ -2990,8 +2990,8 @@ class Language { global $wgAllUnicodeFixes; $s = UtfNormal\Validator::cleanUp( $s ); if ( $wgAllUnicodeFixes ) { - $s = $this->transformUsingPairFile( 'normalize-ar.ser', $s ); - $s = $this->transformUsingPairFile( 'normalize-ml.ser', $s ); + $s = $this->transformUsingPairFile( 'normalize-ar.php', $s ); + $s = $this->transformUsingPairFile( 'normalize-ml.php', $s ); } return $s; @@ -3011,12 +3011,10 @@ class Language { * @throws MWException * @return string */ - function transformUsingPairFile( $file, $string ) { + protected function transformUsingPairFile( $file, $string ) { if ( !isset( $this->transformData[$file] ) ) { - $data = wfGetPrecompiledData( $file ); - if ( $data === false ) { - throw new MWException( __METHOD__ . ": The transformation file $file is missing" ); - } + global $IP; + $data = require "$IP/languages/data/{$file}"; $this->transformData[$file] = new ReplacementArray( $data ); } return $this->transformData[$file]->replace( $string ); @@ -3485,7 +3483,7 @@ class Language { * @param int $length Maximum length (including ellipsis) * @param string $ellipsis String to append to the truncated text * @param bool $adjustLength Subtract length of ellipsis from $length. - * $adjustLength was introduced in 1.18, before that behaved as if false. + * $adjustLength was introduced in 1.18, before that behaved as if false. * @return string */ function truncate( $string, $length, $ellipsis = '...', $adjustLength = true ) {