X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FMessage.php;h=329d97afac1f9b1e266c7f35e4b4630e6680f187;hb=3a1104b374d209ffa627b48dd2f3a26d0af859ab;hp=4935e33946079859816741fded3806e37a6026a8;hpb=cf73ab56fff68ebf3eb3fc3d1d600c950b42e4dc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Message.php b/includes/Message.php index 4935e33946..329d97afac 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -364,6 +364,31 @@ class Message implements MessageSpecifier { return new self( $keys ); } + /** + * Get a title object for a mediawiki message, where it can be found in the mediawiki namespace. + * The title will be for the current language, if the message key is in + * $wgForceUIMsgAsContentMsg it will be append with the language code (except content + * language), because Message::inContentLanguage will also return in user language. + * + * @see $wgForceUIMsgAsContentMsg + * @return Title + * @since 1.26 + */ + public function getTitle() { + global $wgContLang, $wgForceUIMsgAsContentMsg; + + $code = $this->language->getCode(); + $title = $this->key; + if ( + $wgContLang->getCode() !== $code + && in_array( $this->key, (array)$wgForceUIMsgAsContentMsg ) + ) { + $title .= '/' . $code; + } + + return Title::makeTitle( NS_MEDIAWIKI, $wgContLang->ucfirst( strtr( $title, ' ', '_' ) ) ); + } + /** * Adds parameters to the parameter list of this message. *