WordPress.org

Ready to get started?Download WordPress

Forums

Digit Localization/Translation (5 posts)

  1. kambiz.k
    Member
    Posted 5 years ago #

    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
    }
  2. tazme
    Member
    Posted 5 years ago #

    That's the thing I was looking for for a while.

    It means till now there's no way to translate numbers/digits in own languuage. :(

  3. bluebird2
    Member
    Posted 5 years ago #

    This is a necessary change. It makes WP more available to the users who do not write in European languages.

  4. kambiz.k
    Member
    Posted 5 years ago #

    Here is the ticket on the WordPress Trac, including the patch:
    http://trac.wordpress.org/ticket/7753

  5. manchumahara
    Member
    Posted 5 years ago #

    Hi, this is really a big issue who wants to use wordpress in his own language not only translating common string but dates and number in his own.

    @kambiz.k
    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic