r110054 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110053‎ | r110054 | r110055 >
Date:11:34, 26 January 2012
Author:hashar
Status:resolved (Comments)
Tags:
Comment:
enhance doxygen generation for Message class
Modified paths:
  • /trunk/phase3/includes/Message.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Message.php
@@ -4,53 +4,79 @@
55 * processing them into variety of formats that are needed in MediaWiki.
66 *
77 * It is intented to replace the old wfMsg* functions that over time grew
8 - * unusable.
 8+ * unusable. \see https://www.mediawiki.org/wiki/New_messages_API for
 9+ * equivalence between old and new functions.
910 *
10 - * Examples:
 11+ * Below, you will find several examples of wfMessage() usage.
 12+ *
 13+ *
1114 * Fetching a message text for interface message
 15+ * @code
1216 * $button = Xml::button( wfMessage( 'submit' )->text() );
13 - * </pre>
 17+ * @endcode
 18+ *
1419 * Messages can have parameters:
 20+ *
 21+ * @code
1522 * wfMessage( 'welcome-to' )->params( $wgSitename )->text();
16 - * {{GRAMMAR}} and friends work correctly
 23+ * @endcode
 24+ *
 25+ * {{GRAMMAR}} and friends work correctly
 26+ * @code
1727 * wfMessage( 'are-friends', $user, $friend );
1828 * wfMessage( 'bad-message' )->rawParams( '<script>...</script>' )->escaped();
19 - * </pre>
 29+ * @endcode
 30+ *
2031 * Sometimes the message text ends up in the database, so content language is needed.
 32+ * @code
2133 * wfMessage( 'file-log', $user, $filename )->inContentLanguage()->text()
2234 * </pre>
23 - * Checking if message exists:
 35+ * @endcode
 36+ *
 37+ * Checking whether a message exists:
 38+ * @code
2439 * wfMessage( 'mysterious-message' )->exists()
25 - * </pre>
 40+ * @endcode
 41+ *
2642 * If you want to use a different language:
 43+ * @code
2744 * wfMessage( 'email-header' )->inLanguage( $user->getOption( 'language' ) )->plain()
28 - * Note that you cannot parse the text except in the content or interface
29 - * languages
30 - * </pre>
 45+ * @endcode
3146 *
 47+ * \note You cannot parse the text except in the content or interface
 48+ * \note languages
3249 *
3350 * Comparison with old wfMsg* functions:
3451 *
3552 * Use full parsing.
 53+ *
 54+ * @code
3655 * wfMsgExt( 'key', array( 'parseinline' ), 'apple' );
3756 * === wfMessage( 'key', 'apple' )->parse();
38 - * </pre>
 57+ * @endcode
 58+ *
3959 * Parseinline is used because it is more useful when pre-building html.
4060 * In normal use it is better to use OutputPage::(add|wrap)WikiMsg.
4161 *
4262 * Places where html cannot be used. {{-transformation is done.
 63+ * @code
4364 * wfMsgExt( 'key', array( 'parsemag' ), 'apple', 'pear' );
4465 * === wfMessage( 'key', 'apple', 'pear' )->text();
45 - * </pre>
 66+ * @endcode
4667 *
4768 * Shortcut for escaping the message too, similar to wfMsgHTML, but
4869 * parameters are not replaced after escaping by default.
 70+ * @code
4971 * $escaped = wfMessage( 'key' )->rawParams( 'apple' )->escaped();
50 - * </pre>
 72+ * @endcode
5173 *
5274 * @todo
5375 * - test, can we have tests?
5476 *
 77+ * \see https://www.mediawiki.org/wiki/WfMessage()
 78+ * \see https://www.mediawiki.org/wiki/New_messages_API
 79+ * \see https://www.mediawiki.org/wiki/Localisation
 80+ *
5581 * @since 1.17
5682 * @author Niklas Laxström
5783 */

Follow-up revisions

RevisionCommit summaryAuthorDate
r110057Fix r110054, \ -> @demon13:45, 26 January 2012
r110060update Message class doc...hashar14:55, 26 January 2012

Comments

#Comment by Nikerabbit (talk | contribs)   11:46, 26 January 2012

Why \see and not @see?

#Comment by Hashar (talk | contribs)   13:33, 26 January 2012

Backslashes is the way to enter commands in Doxygen. It comes from JavaDoc. The @ is an alias for compatibility with PHPDocumentator.

So both of them are valid. Will change them to @ later on.

Status & tagging log