Index: trunk/extensions/Translate/SpecialMyLanguage.php |
— | — | @@ -1,16 +1,21 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Special page just to redirect the user to translated version if page, |
5 | | - * if it exists. |
| 4 | + * Contains logic for special page Special:MyLanguage |
6 | 5 | * |
7 | | - * Usage: [[Special:MyLanguage/Page name|link text]] |
8 | | - * |
9 | | - * @ingroup SpecialPage |
| 6 | + * @file |
10 | 7 | * @author Niklas Laxström |
11 | 8 | * @copyright Copyright © 2010 Niklas Laxström |
12 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
13 | 10 | */ |
14 | 11 | |
| 12 | +/** |
| 13 | + * Unlisted special page just to redirect the user to the translated version of |
| 14 | + * a page, if it exists. |
| 15 | + * |
| 16 | + * Usage: [[Special:MyLanguage/Page name|link text]] |
| 17 | + * |
| 18 | + * @ingroup SpecialPage |
| 19 | + */ |
15 | 20 | class SpecialMyLanguage extends UnlistedSpecialPage { |
16 | 21 | /** |
17 | 22 | * Construct |
Index: trunk/extensions/Translate/MessageCollection.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * An extension to ease the translation of Mediawiki |
| 4 | + * This file contains classes that implements message collections. |
5 | 5 | * |
6 | 6 | * @ingroup Extensions |
7 | 7 | * @file |
— | — | @@ -9,6 +9,9 @@ |
10 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
11 | 11 | */ |
12 | 12 | |
| 13 | +/** |
| 14 | + * @todo Needs documentation. |
| 15 | + */ |
13 | 16 | class MessageCollection implements ArrayAccess, Iterator, Countable { |
14 | 17 | /** |
15 | 18 | * It is handy to store the language code here. |
Index: trunk/extensions/Translate/SpecialLanguageStats.php |
— | — | @@ -1,17 +1,23 @@ |
2 | 2 | <?php |
| 3 | +/** |
| 4 | + * Contains logic for special page Special:LanguageStats. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @author Siebrand Mazeland |
| 8 | + * @author Niklas Laxström |
| 9 | + * @copyright Copyright © 2008-2010 Siebrand Mazeland, Niklas Laxström |
| 10 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 11 | + */ |
3 | 12 | |
4 | 13 | /** |
5 | | - * Implements a special page which givens translation statistics for a given |
6 | | - * set of message groups. Message group names can be entered (pipe separated) |
7 | | - * into the form, or added as a parameter in the URL. |
| 14 | + * Implements includable special page Special:LanguageStats which provides |
| 15 | + * translation statistics for all defined message groups. |
8 | 16 | * |
9 | 17 | * Loosely based on the statistics code in phase3/maintenance/language |
10 | 18 | * |
11 | | - * Use {{Special:LanguageStats/nl/1}} to show for 'nl' and suppres complete. |
| 19 | + * Use {{Special:LanguageStats/nl/1}} to show for 'nl' and suppres completely |
| 20 | + * translated groups. |
12 | 21 | * |
13 | | - * @author Siebrand Mazeland |
14 | | - * @copyright Copyright © 2008-2010 Siebrand Mazeland |
15 | | - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
16 | 22 | * @ingroup SpecialPage |
17 | 23 | */ |
18 | 24 | class SpecialLanguageStats extends IncludableSpecialPage { |
— | — | @@ -62,7 +68,7 @@ |
63 | 69 | /** |
64 | 70 | * HTML for the top form. |
65 | 71 | * @param $code \string A language code (default empty, example: 'en'). |
66 | | - * @param $suppressComplete \bool If completely translated groups should be suppressed. |
| 72 | + * @param $suppressComplete \bool If completely translated groups should be suppressed (default: false). |
67 | 73 | * @return \string HTML |
68 | 74 | */ |
69 | 75 | function buildLanguageForm( $code = '', $suppressComplete = false ) { |
— | — | @@ -108,6 +114,7 @@ |
109 | 115 | |
110 | 116 | /** |
111 | 117 | * Statistics table element (heading or regular cell) |
| 118 | + * |
112 | 119 | * @todo document |
113 | 120 | * @param $in \string |
114 | 121 | * @param $bgcolor \string |
— | — | @@ -190,6 +197,7 @@ |
191 | 198 | /** |
192 | 199 | * HTML for language statistics. |
193 | 200 | * Copied and adaped from groupStatistics.php by Nikerabbit |
| 201 | + * |
194 | 202 | * @param $code \string A language code (default empty, example: 'en'). |
195 | 203 | * @param $suppressComplete \bool If completely translated groups should be suppressed |
196 | 204 | * @return \string HTML |
— | — | @@ -325,7 +333,11 @@ |
326 | 334 | } |
327 | 335 | |
328 | 336 | /** |
329 | | - * @todo name does not match behaviour. |
| 337 | + * Used to circumvent ugly tooltips when newlines are used in the |
| 338 | + * message content ("x\ny" becomes "x y"). |
| 339 | + * |
| 340 | + * @todo Name does not match behaviour. |
| 341 | + * @todo Make this a static helper function somewhere? |
330 | 342 | */ |
331 | 343 | private static function newlineToWordSeparator( $text ) { |
332 | 344 | $wordSeparator = wfMsg( 'word-separator' ); |
Index: trunk/extensions/Translate/MessageChecks.php |
— | — | @@ -1,12 +1,13 @@ |
2 | 2 | <?php |
3 | 3 | /** |
| 4 | + * Message checking framework. |
| 5 | + * |
4 | 6 | * @file |
5 | 7 | * @defgroup MessageCheckers Message Checkers |
| 8 | + * |
6 | 9 | */ |
7 | 10 | |
8 | 11 | /** |
9 | | - * Message checking framework. |
10 | | - * |
11 | 12 | * Message checkers try to find common mistakes so that translators can fix |
12 | 13 | * them quickly. To implement your own checks, extend this class and add a |
13 | 14 | * method of the following type: |
Index: trunk/extensions/Translate/SpecialFirstSteps.php |
— | — | @@ -1,13 +1,19 @@ |
2 | 2 | <?php |
| 3 | +/** |
| 4 | + * Contains logic for special page Special:FirstSteps to guide users through |
| 5 | + * the process of becoming a translator. |
| 6 | + * |
| 7 | + * @file |
| 8 | + * @author Niklas Laxström |
| 9 | + * @copyright Copyright © 2010, Niklas Laxström |
| 10 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 11 | + */ |
3 | 12 | |
4 | 13 | /** |
5 | 14 | * Implements a special page which assists users to become translators. |
6 | 15 | * Currently it is tailored for the needs of translatewiki.net |
7 | 16 | * |
8 | 17 | * @ingroup SpecialPage |
9 | | - * @author Niklas Laxström |
10 | | - * @copyright Copyright © 2010, Niklas Laxström |
11 | | - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
12 | 18 | */ |
13 | 19 | class SpecialFirstSteps extends UnlistedSpecialPage { |
14 | 20 | protected $skin, $user, $out; |
— | — | @@ -44,6 +50,7 @@ |
45 | 51 | $this->out->addHtml( $header ); |
46 | 52 | return $step; |
47 | 53 | } |
| 54 | + |
48 | 55 | if ( $this->user->isLoggedIn() ) { |
49 | 56 | $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
50 | 57 | $this->out->addHtml( $header ); |
— | — | @@ -66,6 +73,7 @@ |
67 | 74 | list( $su_before, $su_after ) = explode( '|||', $tag, 2 ); |
68 | 75 | |
69 | 76 | $this->out->addWikiMsg( 'translate-fs-signup-text', $li_before, $li_after, $su_before, $su_after ); |
| 77 | + |
70 | 78 | return $step_message; |
71 | 79 | } |
72 | 80 | |
— | — | @@ -80,6 +88,7 @@ |
81 | 89 | $this->out->addHtml( $header ); |
82 | 90 | return $step; |
83 | 91 | } |
| 92 | + |
84 | 93 | if ( $this->user->getOption( 'language' ) !== 'en' || $wgRequest->getText( 'step' ) === 'settings' ) { |
85 | 94 | $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
86 | 95 | $this->out->addHtml( $header ); |
— | — | @@ -88,6 +97,7 @@ |
89 | 98 | |
90 | 99 | $this->out->addHtml( $header->style( 'opacity', false ) ); |
91 | 100 | $this->out->addWikiMsg( 'translate-fs-settings-text' ); |
| 101 | + |
92 | 102 | $form = new HtmlTag( 'form' ); |
93 | 103 | $items = new TagContainer(); |
94 | 104 | $form->param( 'method', 'post' )->content( $items ); |
— | — | @@ -122,10 +132,12 @@ |
123 | 133 | { |
124 | 134 | $article = new Article( $userpage ); |
125 | 135 | $status = $article->doEdit( $wgRequest->getText( $textareaId ), $this->getTitle() ); |
| 136 | + |
126 | 137 | if ( $status->isOK() ) { |
127 | 138 | $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
128 | 139 | $this->out->addHtml( $header ); |
129 | 140 | $this->out->addWikiMsg( 'translate-fs-userpage-done' ); |
| 141 | + |
130 | 142 | return false; |
131 | 143 | } else { |
132 | 144 | $this->out->addWikiText( $status->getWikiText() ); |
— | — | @@ -137,9 +149,11 @@ |
138 | 150 | $revision = Revision::newFromTitle( $userpage ); |
139 | 151 | $text = $revision->getText(); |
140 | 152 | $preload = $text; |
| 153 | + |
141 | 154 | if ( preg_match( '/{{#babel:/i', $text ) ) { |
142 | 155 | $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
143 | 156 | $this->out->addHtml( $header ); |
| 157 | + |
144 | 158 | return false; |
145 | 159 | } |
146 | 160 | } |
— | — | @@ -164,6 +178,7 @@ |
165 | 179 | $items[] = new RawHtml( Xml::submitButton( wfMsg( 'translate-fs-userpage-submit' ) ) ); |
166 | 180 | |
167 | 181 | $this->out->addHtml( $form ); |
| 182 | + |
168 | 183 | return $step_message; |
169 | 184 | } |
170 | 185 | |
— | — | @@ -182,6 +197,7 @@ |
183 | 198 | $this->out->addHtml( $header ); |
184 | 199 | return $step; |
185 | 200 | } |
| 201 | + |
186 | 202 | $this->out->addHtml( $header->style( 'opacity', false ) ); |
187 | 203 | $this->out->addWikiMsg( 'translate-fs-permissions-text' ); |
188 | 204 | |
— | — | @@ -196,6 +212,7 @@ |
197 | 213 | if ( $step ) { |
198 | 214 | $header->style( 'opacity', 0.4 ); |
199 | 215 | $this->out->addHtml( $header ); |
| 216 | + |
200 | 217 | return $step; |
201 | 218 | } |
202 | 219 | |
— | — | @@ -219,6 +236,7 @@ |
220 | 237 | if ( $this->user->isEmailConfirmed() ) { |
221 | 238 | $header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) ); |
222 | 239 | $this->out->addHtml( $header ); |
| 240 | + |
223 | 241 | return $step; // Start translating step |
224 | 242 | } |
225 | 243 | |
Index: trunk/extensions/Translate/SpecialSupportedLanguages.php |
— | — | @@ -1,13 +1,24 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * @todo Needs documentation |
5 | | - * @ingroup SpecialPage |
| 4 | + * Contains logic for special page Special:SupportedLanguages |
| 5 | + * |
| 6 | + * @file |
6 | 7 | * @author Niklas Laxström |
7 | 8 | * @author Siebrand Mazeland |
8 | 9 | * @copyright Copyright © 2010, Niklas Laxström, Siebrand Mazeland |
9 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
10 | 11 | */ |
11 | 12 | |
| 13 | +/** |
| 14 | + * Implements unlisted special page Special:SupportedLanguages. The wiki |
| 15 | + * administrator must define NS_PORTAL, otherwise this page does not work. |
| 16 | + * This page displays a list of language portals for all portals corresponding |
| 17 | + * with a language code defined for MediaWiki and a subpage called |
| 18 | + * "translators". The subpage "translators" must contain the template |
| 19 | + * [[:{{ns:template}}:User|User]], taking a user name as parameter. |
| 20 | + * |
| 21 | + * @ingroup SpecialPage |
| 22 | + */ |
12 | 23 | class SpecialSupportedLanguages extends UnlistedSpecialPage { |
13 | 24 | public function __construct() { |
14 | 25 | parent::__construct( 'SupportedLanguages' ); |
— | — | @@ -66,6 +77,7 @@ |
67 | 78 | $rev = new Revision( $row ); |
68 | 79 | $text = $rev->getText(); |
69 | 80 | $code = strtolower( preg_replace( '!/translators$!', '', $row->page_title ) ); |
| 81 | + |
70 | 82 | preg_match_all( '!{{[Uu]ser\|([^}|]+)!', $text, $matches, PREG_SET_ORDER ); |
71 | 83 | foreach ( $matches as $match ) { |
72 | 84 | $user = Title::capitalize( $match[1], NS_USER ); |
— | — | @@ -76,7 +88,9 @@ |
77 | 89 | } |
78 | 90 | |
79 | 91 | $lb->execute(); |
| 92 | + |
80 | 93 | global $wgUser; |
| 94 | + |
81 | 95 | $skin = $wgUser->getSkin(); |
82 | 96 | $portalBaseText = wfMsg( 'portal' ); |
83 | 97 | |
— | — | @@ -90,7 +104,6 @@ |
91 | 105 | |
92 | 106 | foreach ( array_keys( $users ) as $code ) { |
93 | 107 | $portalTitle = Title::makeTitleSafe( NS_PORTAL, $code ); |
94 | | - |
95 | 108 | $portalText = $portalBaseText; |
96 | 109 | |
97 | 110 | /** |
Index: trunk/extensions/Translate/SpecialImportTranslations.php |
— | — | @@ -1,14 +1,19 @@ |
2 | 2 | <?php |
3 | | - |
4 | 3 | /** |
5 | | - * Special page to import Gettext (.po) files exported using Translate extension. |
6 | | - * Does not support general Gettext files. |
| 4 | + * Contains logic for special page Special:ImportTranslations. |
7 | 5 | * |
8 | | - * @ingroup SpecialPage |
| 6 | + * @file |
9 | 7 | * @author Niklas Laxström |
10 | 8 | * @copyright Copyright © 2009-2010, Niklas Laxström |
11 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
12 | 10 | */ |
| 11 | + |
| 12 | +/** |
| 13 | + * Special page to import Gettext (.po) files exported using Translate extension. |
| 14 | + * Does not support generic Gettext files. |
| 15 | + * |
| 16 | + * @ingroup SpecialPage |
| 17 | + */ |
13 | 18 | class SpecialImportTranslations extends SpecialPage { |
14 | 19 | /** |
15 | 20 | * Set up and fill some dependencies. |
— | — | @@ -87,6 +92,7 @@ |
88 | 93 | |
89 | 94 | $importer = new MessageWebImporter( $this->getTitle(), $group, $code ); |
90 | 95 | $alldone = $importer->execute( $messages ); |
| 96 | + |
91 | 97 | if ( $alldone ) { |
92 | 98 | $this->deleteCachedData(); |
93 | 99 | } |
— | — | @@ -191,18 +197,30 @@ |
192 | 198 | } |
193 | 199 | } elseif ( $source === 'local' ) { |
194 | 200 | $filename = $this->request->getFileTempname( 'upload-local' ); |
195 | | - if ( !is_uploaded_file( $filename ) ) return array( 'ul-failed' ); |
| 201 | + if ( !is_uploaded_file( $filename ) ) { |
| 202 | + return array( 'ul-failed' ); |
| 203 | + } |
| 204 | + |
196 | 205 | $filedata = file_get_contents( $filename ); |
| 206 | + |
197 | 207 | return array( 'ok' ); |
198 | 208 | } elseif ( $source === 'wiki' ) { |
199 | 209 | $filetitle = $this->request->getText( 'upload-wiki' ); |
200 | 210 | $title = Title::newFromText( $filetitle, NS_FILE ); |
201 | | - if ( !$title ) return array( 'invalid-title', $filetitle ); |
| 211 | + |
| 212 | + if ( !$title ) { |
| 213 | + return array( 'invalid-title', $filetitle ); |
| 214 | + } |
| 215 | + |
202 | 216 | $file = wfLocalFile( $title ); |
203 | | - if ( !$file || !$file->exists() ) return array( 'no-such-file', $title->getPrefixedText() ); |
204 | 217 | |
| 218 | + if ( !$file || !$file->exists() ) { |
| 219 | + return array( 'no-such-file', $title->getPrefixedText() ); |
| 220 | + } |
| 221 | + |
205 | 222 | $filename = $file->getPath(); |
206 | 223 | $filedata = file_get_contents( $filename ); |
| 224 | + |
207 | 225 | return array( 'ok' ); |
208 | 226 | } else { |
209 | 227 | return array( 'type-not-supported', $source ); |
— | — | @@ -256,22 +274,28 @@ |
257 | 275 | |
258 | 276 | protected function setCachedData( $data ) { |
259 | 277 | global $wgMemc; |
| 278 | + |
260 | 279 | $key = wfMemcKey( 'translate', 'webimport', $this->user->getId() ); |
| 280 | + |
261 | 281 | /** |
262 | | - * 15 minutes. |
| 282 | + * Cache 15 minutes. |
263 | 283 | */ |
264 | 284 | $wgMemc->set( $key, $data, 60 * 15 ); |
265 | 285 | } |
266 | 286 | |
267 | 287 | protected function getCachedData() { |
268 | 288 | global $wgMemc; |
| 289 | + |
269 | 290 | $key = wfMemcKey( 'translate', 'webimport', $this->user->getId() ); |
| 291 | + |
270 | 292 | return $wgMemc->get( $key ); |
271 | 293 | } |
272 | 294 | |
273 | 295 | protected function deleteCachedData() { |
274 | 296 | global $wgMemc; |
| 297 | + |
275 | 298 | $key = wfMemcKey( 'translate', 'webimport', $this->user->getId() ); |
| 299 | + |
276 | 300 | return $wgMemc->delete( $key ); |
277 | 301 | } |
278 | 302 | } |
Index: trunk/extensions/Translate/check-blacklist.php |
— | — | @@ -2,17 +2,19 @@ |
3 | 3 | /** |
4 | 4 | * List of checks that should not be performed. |
5 | 5 | * |
6 | | - * The array takes input of arrays which define constraints. Checks which match |
7 | | - * those constrains are skipped. Possible constrains are <tt>group</tt>, |
8 | | - * <tt>check</tt>, <tt>code</tt> and <tt>message</tt>. |
9 | 6 | * @todo Use YAML? |
10 | | - * |
| 7 | + * @file |
11 | 8 | * @author Niklas Laxström |
12 | 9 | * @copyright Copyright © 2008-2010, Niklas Laxström |
13 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
14 | 11 | */ |
| 12 | + |
| 13 | +/** |
| 14 | + * The array takes input of arrays which define constraints. Checks which match |
| 15 | + * those constrains are skipped. Possible constrains are <tt>group</tt>, |
| 16 | + * <tt>check</tt>, <tt>code</tt> and <tt>message</tt>. |
| 17 | + */ |
15 | 18 | $checkBlacklist = array( |
16 | | - |
17 | 19 | array( |
18 | 20 | 'check' => 'plural', |
19 | 21 | 'code' => array( 'az', 'bo', 'dz', 'id', 'fa', 'gan', 'gan-hans', |
Index: trunk/extensions/Translate/MessageGroups.php |
— | — | @@ -1,7 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | /** |
| 4 | + * Message groups |
| 5 | + * |
4 | 6 | * @todo: needs documentation |
5 | | - * |
6 | 7 | * @file |
7 | 8 | * @author Niklas Laxström |
8 | 9 | * @copyright Copyright © 2008-2010, Niklas Laxström |
— | — | @@ -249,6 +250,7 @@ |
250 | 251 | |
251 | 252 | /** |
252 | 253 | * @todo: needs documentation |
| 254 | + * @deprecated |
253 | 255 | */ |
254 | 256 | class CoreMessageGroup extends MessageGroupOld { |
255 | 257 | protected $label = 'MediaWiki'; |
— | — | @@ -369,6 +371,7 @@ |
370 | 372 | |
371 | 373 | /** |
372 | 374 | * @todo: needs documentation |
| 375 | + * @deprecated |
373 | 376 | */ |
374 | 377 | class ExtensionMessageGroup extends MessageGroupOld { |
375 | 378 | protected $magicFile, $aliasFile; |
— | — | @@ -531,6 +534,7 @@ |
532 | 535 | |
533 | 536 | /** |
534 | 537 | * @todo: needs documentation |
| 538 | + * @deprecated |
535 | 539 | */ |
536 | 540 | class AliasMessageGroup extends ExtensionMessageGroup { |
537 | 541 | protected $dataSource; |
— | — | @@ -611,6 +615,7 @@ |
612 | 616 | |
613 | 617 | /** |
614 | 618 | * @todo: needs documentation |
| 619 | + * @deprecated |
615 | 620 | */ |
616 | 621 | class CoreMostUsedMessageGroup extends CoreMessageGroup { |
617 | 622 | protected $label = 'MediaWiki (most used)'; |
— | — | @@ -641,6 +646,7 @@ |
642 | 647 | |
643 | 648 | /** |
644 | 649 | * @todo: needs documentation |
| 650 | + * @deprecated |
645 | 651 | */ |
646 | 652 | class GettextMessageGroup extends MessageGroupOld { |
647 | 653 | protected $type = 'gettext'; |
— | — | @@ -719,6 +725,7 @@ |
720 | 726 | |
721 | 727 | /** |
722 | 728 | * @todo: needs documentation |
| 729 | + * @deprecated |
723 | 730 | */ |
724 | 731 | class WikiMessageGroup extends MessageGroupOld { |
725 | 732 | protected $source = null; |
— | — | @@ -780,6 +787,7 @@ |
781 | 788 | |
782 | 789 | /** |
783 | 790 | * @todo: needs documentation |
| 791 | + * @deprecated |
784 | 792 | */ |
785 | 793 | class WikiPageMessageGroup extends WikiMessageGroup { |
786 | 794 | protected $title; |
Index: trunk/extensions/Translate/Message.php |
— | — | @@ -1,12 +1,16 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * @todo Needs documentation. |
| 4 | + * Classes for message objects. |
| 5 | + * |
5 | 6 | * @file |
6 | 7 | * @author Niklas Laxström |
7 | 8 | * @copyright Copyright © 2008-2010, Niklas Laxström |
8 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
9 | 10 | */ |
10 | 11 | |
| 12 | +/** |
| 13 | + * @todo Needs documentation. |
| 14 | + */ |
11 | 15 | abstract class TMessage { |
12 | 16 | protected $key; |
13 | 17 | protected $definition; |
— | — | @@ -48,24 +52,34 @@ |
49 | 53 | $this->tags[] = $tag; |
50 | 54 | } |
51 | 55 | |
52 | | - |
53 | 56 | public function key() { |
54 | 57 | return $this->key; |
55 | 58 | } |
| 59 | + |
56 | 60 | public function definition() { |
57 | 61 | return $this->definition; |
58 | 62 | } |
| 63 | + |
59 | 64 | public function translation() { |
60 | | - if ( !isset( $this->row ) ) return $this->infile(); |
| 65 | + if ( !isset( $this->row ) ) { |
| 66 | + return $this->infile(); |
| 67 | + } |
| 68 | + |
61 | 69 | return Revision::getRevisionText( $this->row ); |
62 | 70 | } |
63 | 71 | public function author() { |
64 | | - if ( !isset( $this->row ) ) return null; |
| 72 | + if ( !isset( $this->row ) ) { |
| 73 | + return null; |
| 74 | + } |
| 75 | + |
65 | 76 | return $this->row->rev_user_text; |
66 | 77 | } |
67 | 78 | |
68 | 79 | public function infile() { |
69 | | - if ( !isset( $this->infile ) ) return null; |
| 80 | + if ( !isset( $this->infile ) ) { |
| 81 | + return null; |
| 82 | + } |
| 83 | + |
70 | 84 | return $this->infile; |
71 | 85 | } |
72 | 86 | |
— | — | @@ -80,12 +94,16 @@ |
81 | 95 | class FatMessage extends TMessage { |
82 | 96 | protected $translation = null; |
83 | 97 | protected $infile = null; |
| 98 | + |
84 | 99 | public function setTranslation( $text ) { |
85 | 100 | $this->translation = $text; |
86 | 101 | } |
87 | 102 | |
88 | 103 | public function translation() { |
89 | | - if ( $this->translation === null ) return $this->infile; |
| 104 | + if ( $this->translation === null ) { |
| 105 | + return $this->infile; |
| 106 | + } |
| 107 | + |
90 | 108 | return $this->translation; |
91 | 109 | } |
92 | 110 | |
Index: trunk/extensions/Translate/TranslateTasks.php |
— | — | @@ -3,10 +3,10 @@ |
4 | 4 | * Different tasks which encapsulate the processing of messages to requested |
5 | 5 | * format for the web interface. |
6 | 6 | * |
| 7 | + * @file |
7 | 8 | * @author Niklas Laxström |
8 | 9 | * @copyright Copyright © 2007-2008 Niklas Laxström |
9 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
10 | | - * @file |
11 | 11 | */ |
12 | 12 | |
13 | 13 | /** |
Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Translations of Translate extension. |
| 4 | + * Translations for the core of the Translate extension. |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
Index: trunk/extensions/Translate/TranslateUtils.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * This class contains some static helper functions for other classes. |
| 4 | + * This file contains classes with static helper functions for other classes. |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @author Niklas Laxström |
— | — | @@ -8,6 +8,9 @@ |
9 | 9 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
10 | 10 | */ |
11 | 11 | |
| 12 | +/** |
| 13 | + * @todo Needs documentation. |
| 14 | + */ |
12 | 15 | class TranslateUtils { |
13 | 16 | const MSG = 'translate-'; |
14 | 17 | |
— | — | @@ -337,6 +340,9 @@ |
338 | 341 | } |
339 | 342 | } |
340 | 343 | |
| 344 | +/** |
| 345 | + * @todo Needs documentation. |
| 346 | + */ |
341 | 347 | class HTMLSelector { |
342 | 348 | private $options = array(); |
343 | 349 | private $selected = false; |