diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php
index 750ff16a9d..cbed44e700 100644
--- a/wp-admin/admin-functions.php
+++ b/wp-admin/admin-functions.php
@@ -831,8 +831,8 @@ function _cat_row( $category, $level, $name_override = false ) {
$class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
- $category->category_count = number_format( $category->category_count );
- $category->link_count = number_format( $category->link_count );
+ $category->category_count = number_format_i18n( $category->category_count );
+ $category->link_count = number_format_i18n( $category->link_count );
$posts_count = ( $category->category_count > 0 ) ? "$category->category_count" : $category->category_count;
return "
$category->cat_ID |
diff --git a/wp-admin/index.php b/wp-admin/index.php
index 7e70aece5b..a3d3151451 100644
--- a/wp-admin/index.php
+++ b/wp-admin/index.php
@@ -43,7 +43,7 @@ if ( $comments || $numcomments ) :
- »
+ »
@@ -103,9 +103,9 @@ $numposts = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_t
$numcomms = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
$numcats = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
-$post_str = sprintf(__ngettext('%1$s post', '%1$s posts', $numposts), number_format($numposts), 'edit.php');
-$comm_str = sprintf(__ngettext('%1$s comment', '%1$s comments', $numcomms), number_format($numcomms), 'edit-comments.php');
-$cat_str = sprintf(__ngettext('%1$s category', '%1$s categories', $numcats), number_format($numcats), 'categories.php');
+$post_str = sprintf(__ngettext('%1$s post', '%1$s posts', $numposts), number_format_i18n($numposts), 'edit.php');
+$comm_str = sprintf(__ngettext('%1$s comment', '%1$s comments', $numcomms), number_format_i18n($numcomms), 'edit-comments.php');
+$cat_str = sprintf(__ngettext('%1$s category', '%1$s categories', $numcats), number_format_i18n($numcats), 'categories.php');
?>
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index f38dd85428..2273a4932c 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -83,6 +83,14 @@ function date_i18n($dateformatstring, $unixtimestamp) {
return $j;
}
+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);
+
+ return number_format($number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
+}
+
function get_weekstartend($mysqlstring, $start_of_week) {
$my = substr($mysqlstring,0,4);
$mm = substr($mysqlstring,8,2);
diff --git a/wp-includes/locale.php b/wp-includes/locale.php
index c7bd7bcf11..af3fc13686 100644
--- a/wp-includes/locale.php
+++ b/wp-includes/locale.php
@@ -87,6 +87,18 @@ class WP_Locale {
$this->meridiem['AM'] = __('AM');
$this->meridiem['PM'] = __('PM');
+ // Numbers formatting
+ // See http://php.net/number_format
+
+ $trans = __('number_format_decimals');
+ $this->number_format['decimals'] = ('number_format_decimals' == $trans) ? 0 : $trans;
+
+ $trans = __('number_format_decimal_point');
+ $this->number_format['decimal_point'] = ('number_format_decimal_point' == $trans) ? '.' : $trans;
+
+ $trans = __('number_format_thousands_sep');
+ $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans;
+
// Import global locale vars set during inclusion of $locale.php.
foreach ( $this->locale_vars as $var ) {
if ( isset($GLOBALS[$var]) )
@@ -138,4 +150,4 @@ class WP_Locale {
}
}
-?>
\ No newline at end of file
+?>
diff --git a/wp-settings.php b/wp-settings.php
index 980283af76..fb69059757 100644
--- a/wp-settings.php
+++ b/wp-settings.php
@@ -69,7 +69,7 @@ function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(
$mtime = $mtime[1] + $mtime[0];
$timeend = $mtime;
$timetotal = $timeend-$timestart;
- $r = number_format($timetotal, $precision);
+ $r = number_format_i18n($timetotal, $precision);
if ( $display )
echo $r;
return $r;