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:
parent
82bfcfcdff
commit
da93a92714
|
@ -43,8 +43,7 @@ var userSettings = {
|
||||||
pagenow = '<?php echo $current_screen->id; ?>',
|
pagenow = '<?php echo $current_screen->id; ?>',
|
||||||
typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
|
typenow = '<?php if ( isset($current_screen->post_type) ) echo $current_screen->post_type; ?>',
|
||||||
adminpage = '<?php echo $admin_body_class; ?>',
|
adminpage = '<?php echo $admin_body_class; ?>',
|
||||||
thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
|
thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>';
|
||||||
decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>';
|
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -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
|
* @since 2.3.0
|
||||||
*
|
*
|
||||||
* @param mixed $number The number to convert based on locale.
|
* @param int $number The number to convert based on locale.
|
||||||
* @param int $decimals Precision of the number of decimal places.
|
* @param int $decimals Precision of the number of decimal places. Deprectated.
|
||||||
* @return string Converted number in string format.
|
* @return string Converted number in string format.
|
||||||
*/
|
*/
|
||||||
function number_format_i18n( $number, $decimals = null ) {
|
function number_format_i18n( $number, $decimals = null ) {
|
||||||
global $wp_locale;
|
global $wp_locale;
|
||||||
// let the user override the precision only
|
$number = (int)$number;
|
||||||
$decimals = ( is_null( $decimals ) ) ? $wp_locale->number_format['decimals'] : intval( $decimals );
|
if ( !is_null( $decimals ) ) _deprecated_argument( __FUNCTION__, '3.0' );
|
||||||
|
$formatted = number_format( $number, 0, null, $wp_locale->number_format['thousands_sep'] );
|
||||||
$num = number_format( $number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
|
return apply_filters( 'number_format_i18n', $formatted );
|
||||||
|
|
||||||
// let the user translate digits from latin to localized language
|
|
||||||
return apply_filters( 'number_format_i18n', $num );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,7 +160,7 @@ function number_format_i18n( $number, $decimals = null ) {
|
||||||
* @since 2.3.0
|
* @since 2.3.0
|
||||||
*
|
*
|
||||||
* @param int|string $bytes Number of bytes. Note max integer size for integers.
|
* @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.
|
* @return bool|string False on failure. Number string on success.
|
||||||
*/
|
*/
|
||||||
function size_format( $bytes, $decimals = null ) {
|
function size_format( $bytes, $decimals = null ) {
|
||||||
|
@ -175,10 +172,10 @@ function size_format( $bytes, $decimals = null ) {
|
||||||
'kB' => 1024, // pow( 1024, 1)
|
'kB' => 1024, // pow( 1024, 1)
|
||||||
'B ' => 1, // pow( 1024, 0)
|
'B ' => 1, // pow( 1024, 0)
|
||||||
);
|
);
|
||||||
|
if ( !is_null( $decimals ) ) _deprecated_argument( __FUNCTION__, '3.0' );
|
||||||
foreach ( $quant as $unit => $mag )
|
foreach ( $quant as $unit => $mag )
|
||||||
if ( doubleval($bytes) >= $mag )
|
if ( doubleval($bytes) >= $mag )
|
||||||
return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
|
return number_format_i18n( round( $bytes / $mag ) ) . ' ' . $unit;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ function timer_stop( $display = 0, $precision = 3 ) { // if called like timer_st
|
||||||
$mtime = explode( ' ', $mtime );
|
$mtime = explode( ' ', $mtime );
|
||||||
$timeend = $mtime[1] + $mtime[0];
|
$timeend = $mtime[1] + $mtime[0];
|
||||||
$timetotal = $timeend - $timestart;
|
$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 )
|
if ( $display )
|
||||||
echo $r;
|
echo $r;
|
||||||
return $r;
|
return $r;
|
||||||
|
|
|
@ -178,14 +178,6 @@ class WP_Locale {
|
||||||
// Numbers formatting
|
// Numbers formatting
|
||||||
// See http://php.net/number_format
|
// 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 , */
|
/* translators: $thousands_sep argument for http://php.net/number_format, default is , */
|
||||||
$trans = __('number_format_thousands_sep');
|
$trans = __('number_format_thousands_sep');
|
||||||
$this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
|
$this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
|
||||||
|
|
Loading…
Reference in New Issue