r85396 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85395‎ | r85396 | r85397 >
Date:23:24, 4 April 2011
Author:krinkle
Status:deferred
Tags:
Comment:
* Translation of titles should not be ignored. "OrphanTalk" and "SVG Translate" make more sense in a native language as well, why not ?
* Put domain registration in a seperate Domains.php file instead of a static array
* constant TS_INTUITION represents local base path to the Intuition directory (eg. "/home/p_i18n/TsIntuition")
* Add support for tool: Recent Anonymous Activity
Modified paths:
  • /trunk/tools/ToolserverI18N/ToolStart.php (modified) (history)
  • /trunk/tools/ToolserverI18N/TsIntuition.php (modified) (history)
  • /trunk/tools/ToolserverI18N/language/Domains.php (added) (history)
  • /trunk/tools/ToolserverI18N/language/messages/Getwikiapi.i18n.php (modified) (history)
  • /trunk/tools/ToolserverI18N/language/messages/Jarry.i18n.php (modified) (history)
  • /trunk/tools/ToolserverI18N/language/messages/Orphantalk2.i18n.php (modified) (history)
  • /trunk/tools/ToolserverI18N/language/messages/Recentanonymousactivity.i18n.php (added) (history)
  • /trunk/tools/ToolserverI18N/language/messages/Svgtranslate.i18n.php (modified) (history)

Diff [purge]

Index: trunk/tools/ToolserverI18N/TsIntuition.php
@@ -29,15 +29,7 @@
3030
3131 private $localBaseDir = __DIR__; // to be moved to p_i18n
3232
33 - private static $registeredTextdomains = array(
34 - 'General' => 'General.i18n.php',
35 - 'Getwikiapi' => 'Getwikiapi.i18n.php',
36 - 'Jarry' => 'Jarry.i18n.php',
37 - 'Monumentsapi' => 'Monumentsapi.i18n.php',
38 - 'Orphantalk2' => 'Orphantalk2.i18n.php',
39 - 'Svgtranslate' => 'Svgtranslate.i18n.php',
40 - 'Tsintuition' => 'Tsintuition.i18n.php',
41 - );
 33+ private $registeredTextdomains = null;
4234
4335 private $suppresserrors = false;
4436 private $suppressnotices = true;
@@ -110,6 +102,8 @@
111103 if ( is_string( $options) ) {
112104 $options = array( 'domain' => $options );
113105 }
 106+
 107+ $this->loadDomains();
114108
115109 // Allow a tool to suppress errors, which will prevent TsIntuition from showing fatal errors
116110 if ( isset( $options['suppresserrors'] ) && $options['suppresserrors'] == true ) {
@@ -232,7 +226,7 @@
233227 * @return array
234228 */
235229 public function getAllRegisteredDomains(){
236 - return self::$registeredTextdomains;
 230+ return $this->registeredTextdomains;
237231 }
238232
239233 /**
@@ -584,12 +578,12 @@
585579 $domain = ucfirst( strtolower( $domain ) );
586580
587581 // Don't load if already loaded or unregistered
588 - if ( isset( $this->loadedTextdomains[$domain] ) || !isset( self::$registeredTextdomains[$domain] ) ) {
 582+ if ( isset( $this->loadedTextdomains[$domain] ) || !isset( $this->registeredTextdomains[$domain] ) ) {
589583 return false;
590584 }
591585
592586 // File exists ?
593 - $path = $this->localBaseDir . "/language/messages/" . self::$registeredTextdomains[$domain];
 587+ $path = $this->localBaseDir . "/language/messages/" . $this->registeredTextdomains[$domain];
594588 if ( !file_exists( $path ) ) {
595589 $this->errTrigger( "Textdomain file not found for \"$domain\" at $path. Ignoring",
596590 __METHOD__, E_NOTICE, __FILE__, __LINE__ );
@@ -795,6 +789,35 @@
796790
797791
798792 /**
 793+ * Load domains
 794+ *
 795+ * @private
 796+ *
 797+ * @return true
 798+ */
 799+ private function loadDomains(){
 800+
 801+ // Don't load twice
 802+ if ( is_array( $this->registeredTextdomains ) ) {
 803+ return false;
 804+ }
 805+
 806+ $path = $this->localBaseDir . '/language/Domains.php';
 807+ if ( !file_exists( $path ) ) {
 808+ $this->errTrigger( 'Domains.php is missing', __METHOD__, E_NOTICE, __FILE__, __LINE__ );
 809+ return false;
 810+ }
 811+
 812+ // Load it
 813+ $domains = array();
 814+ include( $path );
 815+ $this->registeredTextdomains = $domains;
 816+
 817+ return true;
 818+ }
 819+
 820+
 821+ /**
799822 * Load fallbacks
800823 *
801824 * @private
Index: trunk/tools/ToolserverI18N/ToolStart.php
@@ -11,7 +11,7 @@
1212 */
1313
1414 // This is a valid entry, define true
15 -define( 'TS_INTUITION', true );
 15+define( 'TS_INTUITION', __DIR__ );
1616
1717 // Files
1818 require_once( __DIR__ . '/TsIntuitionUtil.php' );
Index: trunk/tools/ToolserverI18N/language/Domains.php
@@ -0,0 +1,11 @@
 2+<?php
 3+$domains = array(
 4+ 'General' => 'General.i18n.php',
 5+ 'Getwikiapi' => 'Getwikiapi.i18n.php',
 6+ 'Jarry' => 'Jarry.i18n.php',
 7+ 'Monumentsapi' => 'Monumentsapi.i18n.php',
 8+ 'Orphantalk2' => 'Orphantalk2.i18n.php',
 9+ 'Recentanonymousactivity' => 'Recentanonymousactivity.i18n.php',
 10+ 'Svgtranslate' => 'Svgtranslate.i18n.php',
 11+ 'Tsintuition' => 'Tsintuition.i18n.php',
 12+);
\ No newline at end of file
Property changes on: trunk/tools/ToolserverI18N/language/Domains.php
___________________________________________________________________
Added: svn:eol-style
113 + native
Index: trunk/tools/ToolserverI18N/language/messages/Getwikiapi.i18n.php
@@ -1,6 +1,6 @@
22 <?php
33 /**
4 - * Interface messages for tool "getWikiAPI".
 4+ * Interface messages for tool "Get Wiki API".
55 *
66 * @toolowner krinkle
77 */
@@ -13,7 +13,7 @@
1414 * @author Krinkle
1515 */
1616 $messages['en'] = array(
17 - 'title' => 'getWikiAPI', // Do not translate
 17+ 'title' => 'Get Wiki API', // Ignore, do not translate
1818 'formats-heading' => 'Output formats',
1919 'input' => 'Input',
2020 'label-wikiids' => 'Wiki identifiers',
Index: trunk/tools/ToolserverI18N/language/messages/Svgtranslate.i18n.php
@@ -13,7 +13,7 @@
1414 * @author Jarry
1515 */
1616 $messages['en'] = array(
17 - 'title' => 'SVG Translate', // Do not translate
 17+ 'title' => 'SVG Translate', // Optional
1818 'error-tryagain' => '$1 Hit your browser\'s back button to retry.',
1919 'error-nothing' => 'Nothing to translate.',
2020 'error-notsvg' => 'Not an SVG file.',
@@ -39,7 +39,7 @@
4040 * @author Jarry
4141 */
4242 $messages['qqq'] = array(
43 - 'title' => "{{Notranslate}}\n\nThe title of the tool.",
 43+ 'title' => "The title of the tool.",
4444 'begin-translation' => 'This is the opening heading on the home page of the tool.',
4545 'th-original' => 'Heading of the "Original"-column.',
4646 'th-translation' => 'Heading of the "Translation"-column.',
@@ -59,6 +59,7 @@
6060 * @author Gerard Meijssen
6161 */
6262 $messages['nl'] = array(
 63+ 'title' => 'SVG Vertaling',
6364 'begin-translation' => 'Start de vertaling',
6465 'th-original' => 'Origineel',
6566 'th-translation' => 'Vertaling',
Index: trunk/tools/ToolserverI18N/language/messages/Orphantalk2.i18n.php
@@ -13,7 +13,7 @@
1414 * @author Krinkle
1515 */
1616 $messages['en'] = array(
17 - 'title' => 'OrphanTalk2', // ignore
 17+ 'title' => 'OrphanTalk2', // optional
1818 'settings-legend' => 'Settings',
1919 'label-wiki' => 'Wiki', // optional
2020 'select-wiki-first' => '(select a wiki first)',
@@ -38,6 +38,7 @@
3939 * @author Krinkle
4040 */
4141 $messages['qqq'] = array(
 42+ 'title' => 'The title of the tool. Note that this is a sequel of an old tool by the same name. "2" is part of the name.',
4243 'settings-legend' => 'This is the title for the settings box in the input form.',
4344 'label-wiki' => 'Label in the input form indicating which wiki searched.',
4445 'update' => 'Clicking this button will update the form to adapt to the new settings. {{Identical|Update}}',
@@ -56,6 +57,7 @@
5758 * @author Krinkle
5859 */
5960 $messages['nl'] = array(
 61+ 'title' => 'WeesOverleg2',
6062 'settings-legend' => 'Instellingen',
6163 'output' => 'Uitvoer',
6264 'update' => 'Bijwerken',
Index: trunk/tools/ToolserverI18N/language/messages/Recentanonymousactivity.i18n.php
@@ -0,0 +1,35 @@
 2+<?php
 3+/**
 4+ * Interface messages for tool "Recent Anonymous Activity".
 5+ *
 6+ * @toolowner krinkle
 7+ */
 8+
 9+$url = '~krinkle/recentAnonymousActivity/';
 10+
 11+/**
 12+ * English
 13+ *
 14+ * @author Krinkle
 15+ */
 16+$messages['en'] = array(
 17+ 'title' => 'Recent Anonymous Activity',
 18+);
 19+
 20+/**
 21+ * Documentation
 22+ *
 23+ * @author Krinkle
 24+ */
 25+$messages['qqq'] = array(
 26+ 'title' => 'This is the title of the tool.',
 27+);
 28+
 29+/**
 30+ * Nederlands
 31+ *
 32+ * @author Krinkle
 33+ */
 34+$messages['nl'] = array(
 35+ 'title' => 'Recente activiteit van anonieme gebruikers',
 36+);
\ No newline at end of file
Property changes on: trunk/tools/ToolserverI18N/language/messages/Recentanonymousactivity.i18n.php
___________________________________________________________________
Added: svn:eol-style
137 + native
Index: trunk/tools/ToolserverI18N/language/messages/Jarry.i18n.php
@@ -13,7 +13,7 @@
1414 * @author Jarry
1515 */
1616 $messages['en'] = array(
17 - 'title' => 'JARRY1250\'S TOOLSERVER TOOLS', // Do not translate
 17+ 'title' => 'Jarry1250\'s Toolserver Tools', // Ignore, do not translate
1818 );
1919
2020 /**
@@ -22,13 +22,5 @@
2323 * @author Krinkle
2424 */
2525 $messages['qqq'] = array(
26 - 'title' => 'The title. This message should not be translated in other languages.',
27 -);
28 -
29 -/**
30 - * Nederlands
31 - *
32 - * @author Krinkle
33 - */
34 -$messages['nl'] = array(
35 -);
 26+ 'title' => 'The head line of Jarry tools. {{Notranslate}}',
 27+);
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r85397notes for r85396krinkle23:27, 4 April 2011

Status & tagging log