From 7bdbb72e88cf3e995d9c0dad747b56e10ab6cee2 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Thu, 26 Jan 2012 11:34:30 +0000 Subject: [PATCH] enhance doxygen generation for Message class --- includes/Message.php | 52 +++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/includes/Message.php b/includes/Message.php index ed39d5c5ed..4916a58985 100644 --- a/includes/Message.php +++ b/includes/Message.php @@ -4,53 +4,79 @@ * processing them into variety of formats that are needed in MediaWiki. * * It is intented to replace the old wfMsg* functions that over time grew - * unusable. + * unusable. \see https://www.mediawiki.org/wiki/New_messages_API for + * equivalence between old and new functions. + * + * Below, you will find several examples of wfMessage() usage. + * * - * Examples: * Fetching a message text for interface message + * @code * $button = Xml::button( wfMessage( 'submit' )->text() ); - * + * @endcode + * * Messages can have parameters: + * + * @code * wfMessage( 'welcome-to' )->params( $wgSitename )->text(); - * {{GRAMMAR}} and friends work correctly + * @endcode + * + * {{GRAMMAR}} and friends work correctly + * @code * wfMessage( 'are-friends', $user, $friend ); * wfMessage( 'bad-message' )->rawParams( '' )->escaped(); - * + * @endcode + * * Sometimes the message text ends up in the database, so content language is needed. + * @code * wfMessage( 'file-log', $user, $filename )->inContentLanguage()->text() * - * Checking if message exists: + * @endcode + * + * Checking whether a message exists: + * @code * wfMessage( 'mysterious-message' )->exists() - * + * @endcode + * * If you want to use a different language: + * @code * wfMessage( 'email-header' )->inLanguage( $user->getOption( 'language' ) )->plain() - * Note that you cannot parse the text except in the content or interface - * languages - * + * @endcode * + * \note You cannot parse the text except in the content or interface + * \note languages * * Comparison with old wfMsg* functions: * * Use full parsing. + * + * @code * wfMsgExt( 'key', array( 'parseinline' ), 'apple' ); * === wfMessage( 'key', 'apple' )->parse(); - * + * @endcode + * * Parseinline is used because it is more useful when pre-building html. * In normal use it is better to use OutputPage::(add|wrap)WikiMsg. * * Places where html cannot be used. {{-transformation is done. + * @code * wfMsgExt( 'key', array( 'parsemag' ), 'apple', 'pear' ); * === wfMessage( 'key', 'apple', 'pear' )->text(); - * + * @endcode * * Shortcut for escaping the message too, similar to wfMsgHTML, but * parameters are not replaced after escaping by default. + * @code * $escaped = wfMessage( 'key' )->rawParams( 'apple' )->escaped(); - * + * @endcode * * @todo * - test, can we have tests? * + * \see https://www.mediawiki.org/wiki/WfMessage() + * \see https://www.mediawiki.org/wiki/New_messages_API + * \see https://www.mediawiki.org/wiki/Localisation + * * @since 1.17 * @author Niklas Laxström */ -- 2.20.1