* @return string
*/
function getMessageFromDB( $msg ) {
- return wfMsgExt( $msg, array( 'parsemag', 'language' => $this ) );
+ return wfMessage( $msg )->inLanguage( $this )->text();
}
/**
*
* An example of this function being called:
* <code>
- * wfMsg( 'message', $wgLang->formatNum( $num ) )
+ * wfMessage( 'message' )->numParams( $num )->text()
* </code>
*
* See LanguageGu.php for the Gujarati implementation and
*/
function commaList( array $list ) {
return implode(
- wfMsgExt(
- 'comma-separator',
- array( 'parsemag', 'escapenoentities', 'language' => $this )
- ),
+ wfMessage( 'comma-separator' )->inLanguage( $this )->escaped(),
$list
);
}
*/
function semicolonList( array $list ) {
return implode(
- wfMsgExt(
- 'semicolon-separator',
- array( 'parsemag', 'escapenoentities', 'language' => $this )
- ),
+ wfMessage( 'semicolon-separator' )->inLanguage( $this )->escaped(),
$list
);
}
*/
function pipeList( array $list ) {
return implode(
- wfMsgExt(
- 'pipe-separator',
- array( 'escapenoentities', 'language' => $this )
- ),
+ wfMessage( 'pipe-separator' )->inLanguage( $this )->escaped(),
$list
);
}
function truncate( $string, $length, $ellipsis = '...', $adjustLength = true ) {
# Use the localized ellipsis character
if ( $ellipsis == '...' ) {
- $ellipsis = wfMsgExt( 'ellipsis', array( 'escapenoentities', 'language' => $this ) );
+ $ellipsis = wfMessage( 'ellipsis' )->inLanguage( $this )->escaped();
}
# Check if there is no need to truncate
if ( $length == 0 ) {
function truncateHtml( $text, $length, $ellipsis = '...' ) {
# Use the localized ellipsis character
if ( $ellipsis == '...' ) {
- $ellipsis = wfMsgExt( 'ellipsis', array( 'escapenoentities', 'language' => $this ) );
+ $ellipsis = wfMessage( 'ellipsis' )->inLanguage( $this )->escaped();
}
# Check if there is clearly no need to truncate
if ( $length <= 0 ) {
$dirmark = ( $oppositedm ? $this->getDirMark( true ) : '' ) .
$this->getDirMark();
$details = $details ? $dirmark . $this->getMessageFromDB( 'word-separator' ) .
- wfMsgExt( 'parentheses', array( 'escape', 'replaceafter', 'language' => $this ), $details ) : '';
+ wfMessage( 'parentheses' )->rawParams( $details )->inLanguage( $this )->escaped() : '';
return $page . $details;
}
return $this->mConverter->getConvRuleTitle();
}
+ /**
+ * Get the compiled plural rules for the language
+ * @since 1.20
+ * @return array Associative array with plural form, and plural rule as key-value pairs
+ */
+ public function getCompiledPluralRules() {
+ return self::$dataCache->getItem( strtolower( $this->mCode ), 'compiledPluralRules' );
+ }
+
/**
* Get the plural rules for the language
* @since 1.20
* @return int The index of the plural form
*/
private function getPluralForm( $number ) {
- $pluralRules = $this->getPluralRules();
- $form = CLDRPluralRuleEvaluator::evaluate( $number, $pluralRules );
+ $pluralRules = $this->getCompiledPluralRules();
+ $form = CLDRPluralRuleEvaluator::evaluateCompiled( $number, $pluralRules );
return $form;
}