Remove unnecessary translations of decimal point character and number of decimal places. Fixes #10555 props nbachiyski.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2010-04-21 21:41:20 +00:00
parent 82bfcfcdff
commit da93a92714
4 changed files with 12 additions and 24 deletions

View File

@ -43,8 +43,7 @@ var userSettings = {
pagenow = '<?php echo $current_screen->id; ?>',
typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
adminpage = '<?php echo $admin_body_class; ?>',
thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>';
thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>';
//]]>
</script>
<?php

View File

@ -126,23 +126,20 @@ function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
}
/**
* Convert number to format based on the locale.
* Convert integer number to format based on the locale.
*
* @since 2.3.0
*
* @param mixed $number The number to convert based on locale.
* @param int $decimals Precision of the number of decimal places.
* @param int $number The number to convert based on locale.
* @param int $decimals Precision of the number of decimal places. Deprectated.
* @return string Converted number in string format.
*/
function number_format_i18n( $number, $decimals = null ) {
global $wp_locale;
// let the user override the precision only
$decimals = ( is_null( $decimals ) ) ? $wp_locale->number_format['decimals'] : intval( $decimals );
$num = number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
// let the user translate digits from latin to localized language
return apply_filters( 'number_format_i18n', $num );
$number = (int)$number;
if ( !is_null( $decimals ) ) _deprecated_argument( __FUNCTION__, '3.0' );
$formatted = number_format( $number, 0, null, $wp_locale->number_format['thousands_sep'] );
return apply_filters( 'number_format_i18n', $formatted );
}
/**
@ -163,7 +160,7 @@ function number_format_i18n( $number, $decimals = null ) {
* @since 2.3.0
*
* @param int|string $bytes Number of bytes. Note max integer size for integers.
* @param int $decimals Precision of number of decimal places.
* @param int $decimals Precision of number of decimal places. Deprecated.
* @return bool|string False on failure. Number string on success.
*/
function size_format( $bytes, $decimals = null ) {
@ -175,10 +172,10 @@ function size_format( $bytes, $decimals = null ) {
'kB' => 1024, // pow( 1024, 1)
'B ' => 1, // pow( 1024, 0)
);
if ( !is_null( $decimals ) ) _deprecated_argument( __FUNCTION__, '3.0' );
foreach ( $quant as $unit => $mag )
if ( doubleval($bytes) >= $mag )
return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
return number_format_i18n( round( $bytes / $mag ) ) . ' ' . $unit;
return false;
}

View File

@ -219,7 +219,7 @@ function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_st
$mtime = explode( ' ', $mtime );
$timeend = $mtime[1] + $mtime[0];
$timetotal = $timeend - $timestart;
$r = ( function_exists( 'number_format_i18n' ) ) ? number_format_i18n( $timetotal, $precision ) : number_format( $timetotal, $precision );
$r = number_format( $timetotal, $precision );
if ( $display )
echo $r;
return $r;

View File

@ -178,14 +178,6 @@ class WP_Locale {
// Numbers formatting
// See http://php.net/number_format
/* translators: $decimals argument for http://php.net/number_format, default is 0 */
$trans = __('number_format_decimals');
$this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans;
/* translators: $dec_point argument for http://php.net/number_format, default is . */
$trans = __('number_format_decimal_point');
$this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
/* translators: $thousands_sep argument for http://php.net/number_format, default is , */
$trans = __('number_format_thousands_sep');
$this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;