Anomie has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59364


Change subject: (bug 47268) lang:parseFormattedNumber should return a number, 
not a string
......................................................................

(bug 47268) lang:parseFormattedNumber should return a number, not a string

The documentation, and the expectation of users, is that
lang:parseFormattedNumber() should actually return a number, not a
string.

Bug: 47268
Change-Id: Ieabddd0d9192f1fd8ef7e890d5d6268be9636f38
---
M engines/LuaCommon/lualib/mw.language.lua
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/64/59364/1

diff --git a/engines/LuaCommon/lualib/mw.language.lua 
b/engines/LuaCommon/lualib/mw.language.lua
index 69a6cf7..cc19db9 100644
--- a/engines/LuaCommon/lualib/mw.language.lua
+++ b/engines/LuaCommon/lualib/mw.language.lua
@@ -68,7 +68,6 @@
                caseFold = 1,
                formatNum = 1,
                formatDate = 1,
-               parseFormattedNumber = 1,
                formatDuration = 1,
                getDurationIntervals = 1,
                convertPlural = 2,
@@ -96,6 +95,15 @@
                return rtl
        end
 
+       -- Fix semantics
+       function lang:parseFormattedNumber( ... )
+               checkSelf( self, 'parseFormattedNumber' )
+               if select( '#', ... ) < 1 then
+                       error( "too few arguments to 
mw.language:parseFormattedNumber", 2 )
+               end
+               return tonumber( php.parseFormattedNumber( self.code, ... ) )
+       end
+
        -- Alias
        lang.plural = lang.convertPlural
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieabddd0d9192f1fd8ef7e890d5d6268be9636f38
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>

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

Reply via email to