https://bugzilla.wikimedia.org/show_bug.cgi?id=29495

Akshay Agarwal <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #9 from Akshay Agarwal <[email protected]> 2011-09-01 
17:59:53 UTC ---
Santhosh's solution can be implemented by modifying the specific language
localization file in Glibc. For example, if we wanted to fix this issue for
Hindi Wikipedia, then we would edit the hi_IN localization file & modify the
LC_NUMERIC field value to 3;2 , recompile PHP & set the current locale of Hindi
Wikipedia to hi_IN

An alternate solution is to use built in NumberFormatter class of PHP & specify
the the language specific formatting as the pattern
http://www.php.net/manual/en/numberformatter.setpattern.php
http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
This class offers a wide range of options for formatting & can be implemented
with just a few lines of code. 

Continuing with example of Hindi Wikipedia, this can be done as

Add to LocalSettings.php
$wgNumberPattern = "##,##,###";

Modify the commafy() in Language.php
function commafy( $_ ) {
                global $wgNumberPattern;
        $currentLocale = setlocale( LC_NUMERIC, "0" );
                $numberFormat = new NumberFormatter( $currentLocale,
NumberFormatter::DEFAULT_STYLE );
                $numberFormat->setPattern( $wgNumberPattern );
                return $numberFormat->format( $_ );
    }

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to