Index: trunk/extensions/Translate/utils/TranslationEditPage.php |
— | — | @@ -1,10 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Contains classes doe the AJAX translation page. |
| 4 | + * Contains classes that imeplement the server side component of AJAX |
| 5 | + * translation page. |
5 | 6 | * |
6 | 7 | * @file |
7 | 8 | * @author Niklas Laxström |
8 | | - * @copyright Copyright © 2009 Niklas Laxström |
| 9 | + * @copyright Copyright © 2009-2010 Niklas Laxström |
9 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
10 | 11 | */ |
11 | 12 | |
— | — | @@ -25,6 +26,12 @@ |
26 | 27 | $this->setTitle( $title ); |
27 | 28 | } |
28 | 29 | |
| 30 | + /** |
| 31 | + * Constructs a page from WebRequest. |
| 32 | + * This interface is a big klunky. |
| 33 | + * @param $request WebRequest |
| 34 | + * @return TranslationEditPage |
| 35 | + */ |
29 | 36 | public static function newFromRequest( WebRequest $request ) { |
30 | 37 | $title = Title::newFromText( $request->getText( 'page' ) ); |
31 | 38 | |
— | — | @@ -37,7 +44,14 @@ |
38 | 45 | return $obj; |
39 | 46 | } |
40 | 47 | |
| 48 | + /** |
| 49 | + * Change the title of the page we are working on. |
| 50 | + */ |
41 | 51 | public function setTitle( Title $title ) { $this->title = $title; } |
| 52 | + /** |
| 53 | + * Get the title of the page we are working on. |
| 54 | + * @return Title |
| 55 | + */ |
42 | 56 | public function getTitle() { return $this->title; } |
43 | 57 | |
44 | 58 | /** |
— | — | @@ -138,6 +152,15 @@ |
139 | 153 | return $data; |
140 | 154 | } |
141 | 155 | |
| 156 | + /** |
| 157 | + * Returns link attributes that enable javascript translation dialog. |
| 158 | + * Will degrade gracefully if user does not have permissions or JavaScript |
| 159 | + * is not enabled. |
| 160 | + * @param $title Title Title object for the translatable message. |
| 161 | + * @param $group \string The group in which this message belongs to. |
| 162 | + * Optional, but avoids a lookup later if provided. |
| 163 | + * @return \array |
| 164 | + */ |
142 | 165 | public static function jsEdit( Title $title, $group = "" ) { |
143 | 166 | global $wgUser; |
144 | 167 | |
Index: trunk/extensions/Translate/utils/UserToggles.php |
— | — | @@ -15,6 +15,7 @@ |
16 | 16 | class TranslatePreferences { |
17 | 17 | /** |
18 | 18 | * Add 'translate-pref-nonewsletter' preference. |
| 19 | + * This is actually specific to translatewiki.net |
19 | 20 | * |
20 | 21 | * @return \bool true |
21 | 22 | */ |
— | — | @@ -43,6 +44,7 @@ |
44 | 45 | |
45 | 46 | /** |
46 | 47 | * Add 'translate-editlangs' preference. |
| 48 | + * These are the languages also shown when translating. |
47 | 49 | * |
48 | 50 | * @return \bool true |
49 | 51 | */ |
— | — | @@ -68,6 +70,7 @@ |
69 | 71 | |
70 | 72 | /** |
71 | 73 | * Add 'translate-jsedit' preference. |
| 74 | + * An option to disable the javascript edit interface. |
72 | 75 | * |
73 | 76 | * @return \bool true |
74 | 77 | */ |
— | — | @@ -84,7 +87,7 @@ |
85 | 88 | /** |
86 | 89 | * JavsScript selector for language codes. |
87 | 90 | */ |
88 | | - protected static function languageSelector() { |
| 91 | + protected static function languageSelector() { |
89 | 92 | global $wgLang; |
90 | 93 | |
91 | 94 | if ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) { |
Index: trunk/extensions/Translate/utils/TranslationMemoryUpdater.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Contains classes for updating the Translation Memory. |
| 4 | + * Contains classes for updating the local translation memory. |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @author Niklas Laxström |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | */ |
11 | 11 | |
12 | 12 | /** |
13 | | - * Class for updating the Translation Memory runtime. |
| 13 | + * Class for updating the tmserver from translate toolkit during runtime. |
14 | 14 | */ |
15 | 15 | class TranslationMemoryUpdater { |
16 | 16 | public static function update( $article, $user, $text, $summary, $minor, $_, $_, $flags, $revision ) { |
— | — | @@ -85,6 +85,12 @@ |
86 | 86 | return true; |
87 | 87 | } |
88 | 88 | |
| 89 | + /** |
| 90 | + * Return a handle to tmserver database. |
| 91 | + * Tmserver uses a sqlite database, which we access trough MediaWiki's |
| 92 | + * SQLite database handler. |
| 93 | + * @return DatabaseSqlite or null |
| 94 | + */ |
89 | 95 | public static function getDatabaseHandle() { |
90 | 96 | global $wgTranslateTM; |
91 | 97 | |
Index: trunk/extensions/Translate/utils/ResourceLoader.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * @todo Needs documentation. |
| 4 | + * Stuff for handling configuration files in PHP format. |
5 | 5 | * @file |
6 | 6 | * @author Niklas Laxström |
7 | 7 | * @copyright Copyright © 2010 Niklas Laxström |
— | — | @@ -8,15 +8,20 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | /** |
12 | | - * @todo Needs documentation. |
| 12 | + * Stuff for handling configuration files in PHP format. |
13 | 13 | */ |
14 | 14 | class ResourceLoader { |
| 15 | + /** |
| 16 | + * Returns a global variable from PHP file by executing the file. |
| 17 | + * @param $_filename \string Path to the file. |
| 18 | + * @param $_variable \string Name of the variable. |
| 19 | + * @return \mixed The variable contents or null. |
| 20 | + */ |
15 | 21 | public static function loadVariableFromPHPFile( $_filename, $_variable ) { |
16 | 22 | if ( !file_exists( $_filename ) ) { |
17 | 23 | return null; |
18 | 24 | } else { |
19 | 25 | require( $_filename ); |
20 | | - |
21 | 26 | return isset( $$_variable ) ? $$_variable : null; |
22 | 27 | } |
23 | 28 | } |