mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-12-22 03:22:40 +00:00
45 lines
924 B
PHP
45 lines
924 B
PHP
|
<?php
|
||
|
|
||
|
namespace Cite;
|
||
|
|
||
|
use Language;
|
||
|
use Message;
|
||
|
use MessageLocalizer;
|
||
|
use MessageSpecifier;
|
||
|
|
||
|
class ReferenceMessageLocalizer implements MessageLocalizer {
|
||
|
/**
|
||
|
* @var Language
|
||
|
*/
|
||
|
private $language;
|
||
|
|
||
|
/**
|
||
|
* @param Language $language
|
||
|
*/
|
||
|
public function __construct( Language $language ) {
|
||
|
$this->language = $language;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return Language
|
||
|
*/
|
||
|
public function getLanguage(): Language {
|
||
|
return $this->language;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* This is the method for getting translated interface messages.
|
||
|
*
|
||
|
* @see https://www.mediawiki.org/wiki/Manual:Messages_API
|
||
|
* @see Message::__construct
|
||
|
*
|
||
|
* @param string|string[]|MessageSpecifier $key Message key, or array of keys,
|
||
|
* or a MessageSpecifier.
|
||
|
* @param mixed ...$params Normal message parameters
|
||
|
* @return Message
|
||
|
*/
|
||
|
public function msg( $key, ...$params ): Message {
|
||
|
return wfMessage( $key, ...$params )->inLanguage( $this->language );
|
||
|
}
|
||
|
}
|