「モジュール:Formatnum」の版間の差分

ナビゲーションに移動 検索に移動
(1版)
 
bsd>Jarekt
(Changed protection level for "Module:Formatnum": High traffic page ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
9行目: 9行目:
     local lang    = args[2] or args.lang or ''
     local lang    = args[2] or args.lang or ''
     -- validate the language parameter within MediaWiki's caller frame
     -- validate the language parameter within MediaWiki's caller frame
     if lang == "arabic-indic" then -- only for compatibility ("arabic-indic" is not a SupportedLanguage)
     if lang == "arabic-indic" then -- only for back-compatibility ("arabic-indic" is not a SupportedLanguage)
         lang = "fa" -- better support than "ks"
         lang = "fa" -- better support than "ks"
     elseif lang == '' or not mw.language.isSupportedLanguage(lang) then
     elseif lang == '' or not mw.language.isSupportedLanguage(lang) then
19行目: 19行目:
         -- Empty/unspecified and unsupported languages are treated here in Commons using the user's language,
         -- Empty/unspecified and unsupported languages are treated here in Commons using the user's language,
         -- instead of the local 'ContentLanguage' of the Wiki.
         -- instead of the local 'ContentLanguage' of the Wiki.
         lang = frame:preprocess("{{int:lang}}") or ''
         lang = frame:callParserFunction( "int", "lang" ) -- get user's chosen language
     end
     end
     return p.formatNum(number, lang, prec, sep ~= '')
     return p.formatNum(number, lang, prec, sep ~= '')
97行目: 97行目:
         -- Append the localized base-10 exponent without grouping separators (there's no reliable way to detect a localized leading symbol 'E')
         -- Append the localized base-10 exponent without grouping separators (there's no reliable way to detect a localized leading symbol 'E')
         if exponent ~= '' then
         if exponent ~= '' then
             number = number .. 'E' .. mw.ustring.gsub(language:formatNum(tonumber(exponent)), groupsep, '')
             number = number .. 'E' .. language:formatNum(tonumber(exponent),{noCommafy=true})
         end
         end
     else -- not localized, ASCII only
     else -- not localized, ASCII only