r108549 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108548‎ | r108549 | r108550 >
Date:21:01, 10 January 2012
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
Added localisation
Modified paths:
  • /trunk/extensions/GeoData/CoordinatesParserFunction.php (modified) (history)
  • /trunk/extensions/GeoData/GeoData.i18n.magic.php (added) (history)
  • /trunk/extensions/GeoData/GeoData.i18n.php (added) (history)
  • /trunk/extensions/GeoData/GeoData.php (modified) (history)
  • /trunk/extensions/GeoData/GeoDataHooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/GeoData/CoordinatesParserFunction.php
@@ -101,14 +101,14 @@
102102 * @return Status: whether save went OK
103103 */
104104 private function applyCoord( Coord $coord ) {
105 - global $wgMaxCoordinatesPerPage;
 105+ global $wgMaxCoordinatesPerPage, $wgContLang;
106106 $geoData = $this->output->geoData;
107107 if ( $geoData->getCount() >= $wgMaxCoordinatesPerPage ) {
108108 if ( $geoData->limitExceeded ) {
109109 return Status::newFatal( '' );
110110 }
111111 $geoData->limitExceeded = true;
112 - return Status::newFatal( 'geodata-limit-exceeded' );
 112+ return Status::newFatal( 'geodata-limit-exceeded', $wgContLang->formatNum( $wgMaxCoordinatesPerPage ) );
113113 }
114114 if ( $coord->primary ) {
115115 if ( $geoData->getPrimary() ) {
Index: trunk/extensions/GeoData/GeoData.i18n.magic.php
@@ -0,0 +1,14 @@
 2+<?php
 3+
 4+$magicWords = array();
 5+
 6+/**
 7+ * English
 8+ */
 9+
 10+$magicWords = array();
 11+
 12+/** English (English) */
 13+$magicWords['en'] = array(
 14+ 'coordinates' => array( 0, 'coordinates' ),
 15+);
Property changes on: trunk/extensions/GeoData/GeoData.i18n.magic.php
___________________________________________________________________
Added: svn:eol-style
116 + native
Index: trunk/extensions/GeoData/GeoData.i18n.php
@@ -0,0 +1,28 @@
 2+<?php
 3+/**
 4+ * Internationalisation file for GeoData extension.
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$messages = array();
 11+
 12+$messages['en'] = array(
 13+ 'geodata-desc' => 'Adds geographical coordinates storage and retrieval functionality.',
 14+ 'geodata-bad-input' => 'Invalid arguments have been passed to the <nowiki>{{#coordinates:}}</nowiki> function',
 15+ 'geodata-bad-latitude' => '<nowiki>{{#coordinates:}}</nowiki>: invalid latitude',
 16+ 'geodata-bad-longitude' => '<nowiki>{{#coordinates:}}</nowiki>: invalid longitude',
 17+ 'geodata-bad-region' => '<nowiki>{{#coordinates:}}</nowiki>: invalid region code format',
 18+ 'geodata-multiple-primary' => '<nowiki>{{#coordinates:}}</nowiki>: cannot have more than one primary tag per page',
 19+ 'geodata-limit-exceeded' => 'The limit of $1 <nowiki>{{#coordinates:}}</nowiki> tags per page has been exceeded',
 20+ 'geodata-broken-tags-category' => 'Pages with malformed coordinate tags',
 21+ 'geodata-primary-coordinate' => 'primary',
 22+);
 23+
 24+$messages['qqq'] = array(
 25+ 'geodata-desc' => '{{desc}}',
 26+ 'geodata-limit-exceeded' => '$1 is a number',
 27+ 'geodata-broken-tags-category' => 'Name of the tracking category',
 28+ 'geodata-primary-coordinate' => 'Localised name of parameter that makes <nowiki>{{#coordinates:}}</nowiki> tag primary',
 29+);
\ No newline at end of file
Property changes on: trunk/extensions/GeoData/GeoData.i18n.php
___________________________________________________________________
Added: svn:eol-style
130 + native
Index: trunk/extensions/GeoData/GeoData.php
@@ -22,13 +22,15 @@
2323 $wgAutoloadClasses['GeoMath'] = "$dir/GeoMath.php";
2424 $wgAutoloadClasses['CoordinatesOutput'] = "$dir/CoordinatesParserFunction.php";
2525
 26+$wgExtensionMessagesFiles['GeoData'] = "$dir/GeoData.i18n.php";
 27+$wgExtensionMessagesFiles['GeoDataMagic'] = "$dir/GeoData.i18n.magic.php";
 28+
2629 $wgAPIListModules['geosearch'] = 'ApiQueryGeoSearch';
2730 $wgAPIPropModules['coordinates'] = 'ApiQueryCoordinates';
2831
2932 $wgHooks['LoadExtensionSchemaUpdates'][] = 'GeoDataHooks::onLoadExtensionSchemaUpdates';
3033 $wgHooks['ParserFirstCallInit'][] = 'GeoDataHooks::onParserFirstCallInit';
3134 $wgHooks['UnitTestsList'][] = 'GeoDataHooks::onUnitTestsList';
32 -$wgHooks['LanguageGetMagic'][] = 'GeoDataHooks::onLanguageGetMagic';
3335 $wgHooks['ArticleDeleteComplete'][] = 'GeoDataHooks::onArticleDeleteComplete';
3436 $wgHooks['LinksUpdate'][] = 'GeoDataHooks::onLinksUpdate';
3537
Index: trunk/extensions/GeoData/GeoDataHooks.php
@@ -41,17 +41,6 @@
4242 }
4343
4444 /**
45 - * LanguageGetMagic hook handler
46 - * @see https://www.mediawiki.org/wiki/Manual:Hooks/LanguageGetMagic
47 - * @param Array $magicWords
48 - * @param String $langCode
49 - */
50 - public static function onLanguageGetMagic( &$magicWords, $langCode ) {
51 - $magicWords['coordinates'] = array( 0, 'coordinates' );
52 - return true;
53 - }
54 -
55 - /**
5645 * ArticleDeleteComplete hook handler
5746 * @see https://www.mediawiki.org/wiki/Manual:Hooks/ArticleDeleteComplete
5847 *

Follow-up revisions

RevisionCommit summaryAuthorDate
r108720Follow-up r108549: {{PLURAL}}maxsem12:51, 12 January 2012
r108722r108549: Register extension for translatewiki.net.raymond13:24, 12 January 2012

Comments

#Comment by Raymond (talk | contribs)   10:25, 12 January 2012

'geodata-limit-exceeded' needs PLURAL. I would do it by myseld but I am unsure if Status::newFatal() supports it.

#Comment by MaxSem (talk | contribs)   12:51, 12 January 2012

Thanks, fixed.

Status & tagging log