WordPress.org

Support

Support » Requests and Feedback » Digit Localization/Translation

Digit Localization/Translation

  • WordPress has provided number_format_i18n for formating numbers based on locale, but there is no method for traslating digits of numbers.

    What we need is only on filter for applying to the output of number_format_i18n function.

    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'] );
      return apply_filters( 'number_format_i18n', $num );  // here a filter can translate the digits
    }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Digit Localization/Translation’ is closed to new replies.
Skip to toolbar