used for that. Rather, setRef() existed as memory optimisation for PHP 4.
* QuickTemplate::setTranslator() was deprecated in favour of Skin::msg() parameters.
* MediaWikiI18N::set() was deprecated in favour of Skin::msg() parameters.
+* MediaWikiI18N::translate() was deprecated in favour of Skin::msg() or wfMessage().
* Passing false to ParserOptions::setWrapOutputClass() is deprecated. Use the
'unwrap' transform to ParserOutput::getText() instead.
* ParserOutput objects generated using a non-default value for
if ( isset( $item['text'] ) ) {
$text = $item['text'];
} else {
- $text = $this->translator->translate( isset( $item['msg'] ) ? $item['msg'] : $key );
+ $text = wfMessage( isset( $item['msg'] ) ? $item['msg'] : $key )->text();
}
$html = htmlspecialchars( $text );
$realAttrs = [
'type' => 'submit',
'name' => $mode,
- 'value' => $this->translator->translate(
- $mode == 'go' ? 'searcharticle' : 'searchbutton' ),
+ 'value' => wfMessage( $mode == 'go' ? 'searcharticle' : 'searchbutton' )->text(),
];
$realAttrs = array_merge(
$realAttrs,
'src' => $attrs['src'],
'alt' => isset( $attrs['alt'] )
? $attrs['alt']
- : $this->translator->translate( 'searchbutton' ),
+ : wfMessage( 'searchbutton' )->text(),
'width' => isset( $attrs['width'] ) ? $attrs['width'] : null,
'height' => isset( $attrs['height'] ) ? $attrs['height'] : null,
];
$this->context[$varName] = $value;
}
+ /**
+ * @deprecate since 1.31 Use BaseTemplate::msg(), Skin::msg(), or wfMessage() instead.
+ */
function translate( $value ) {
+ wfDeprecated( __METHOD__, '1.31' );
// Hack for i18n:attributes in PHPTAL 1.0.0 dev version as of 2004-10-23
$value = preg_replace( '/^string:/', '', $value );
/**
* @private
- * @param string $str
+ * @param string $msgKey
*/
- function msg( $str ) {
- echo htmlspecialchars( $this->translator->translate( $str ) );
+ function msg( $msgKey ) {
+ echo htmlspecialchars( wfMessage( $msgKey )->text() );
}
/**
* @private
- * @param string $str
+ * @param string $msgKey
*/
- function msgHtml( $str ) {
- echo $this->translator->translate( $str );
+ function msgHtml( $msgKey ) {
+ echo wfMessage( $msgKey )->text();
}
/**
* @private
* @param string $str
*/
- function msgWiki( $str ) {
+ function msgWiki( $msgKey ) {
global $wgOut;
- $text = $this->translator->translate( $str );
+ $text = wfMessage( $msgKey )->text();
echo $wgOut->parse( $text );
}
/**
* @private
*
- * @param string $str
+ * @param string $msgKey
* @return bool
*/
- function haveMsg( $str ) {
- $msg = $this->translator->translate( $str );
- return ( $msg != '-' ) && ( $msg != '' ); # ????
+ function haveMsg( $msgKey ) {
+ $msg = wfMessage( $msgKey );
+ return $msg->exists() && !$msg->isDisabled();
}
/**