jenkins-bot has submitted this change and it was merged.

Change subject: Bug 46181: Coordinate value in dec format does not work on 
de,da,is
......................................................................


Bug 46181: Coordinate value in dec format does not work on de,da,is

Change-Id: I99de46fce2d6d0f23a36c3e2bfbdc4b9ecb86b4f
---
M GeoData.body.php
M tests/TagTest.php
2 files changed, 22 insertions(+), 2 deletions(-)

Approvals:
  awjrichards: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/GeoData.body.php b/GeoData.body.php
index fb4a2a3..71747e9 100644
--- a/GeoData.body.php
+++ b/GeoData.body.php
@@ -116,7 +116,9 @@
                                        return false;
                                }
                        }
-                       $part = $wgContLang->parseFormattedNumber( $part );
+                       if ( !is_numeric( $part ) ) {
+                               $part = $wgContLang->parseFormattedNumber( 
$part );
+                       }
                        $min = $i == 0 ? $coordInfo['min'] : 0;
                        $max = $i == 0 ? $coordInfo['max'] : 59.999999;
                        if ( !is_numeric( $part )
diff --git a/tests/TagTest.php b/tests/TagTest.php
index 95ccbb7..1f9bb2c 100644
--- a/tests/TagTest.php
+++ b/tests/TagTest.php
@@ -4,9 +4,17 @@
  * @group GeoData
  */
 class TagTest extends MediaWikiTestCase {
+       private $contLang;
+
        public function setUp() {
                $GLOBALS['wgDefaultDim'] = 1000; // reset to default
+               $this->contLang = $GLOBALS['wgContLang'];
                parent::setUp();
+       }
+
+       public function tearDown() {
+               $GLOBALS['wgContLang'] = $this->contLang;
+               parent::tearDown();
        }
 
        private function setWarnings( $level ) {
@@ -38,7 +46,11 @@
        /**
         * @dataProvider getLooseData
         */
-       public function testLooseTagParsing( $input, $expected ) {
+       public function testLooseTagParsing( $input, $expected, $langCode = 
false ) {
+               if ( $langCode ) {
+                       global $wgContLang;
+                       $wgContLang = Language::factory( $langCode );
+               }
                $this->setWarnings( 'none' );
                $this->assertParse( $input, $expected );
        }
@@ -137,6 +149,12 @@
                                '{{#coordinates: 10|20|scale:50000}}', 
                                array( 'lat' => 10, 'lon' => 20, 'globe' => 
'earth', 'dim' => 5000 ),
                        ),
+                       // https://bugzilla.wikimedia.org/show_bug.cgi?id=46181
+                       array(
+                               '{{#coordinates: 2.5|3,5}}',
+                               array( 'lat' => 2.5, 'lon' => 3.5 ),
+                               'de',
+                       ),
                );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/59087
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I99de46fce2d6d0f23a36c3e2bfbdc4b9ecb86b4f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GeoData
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to