Notifications
Clear all

Limited Support

Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed.
We appreciate your patience and understanding, and we’ll resume our usual support by the end of August.

 

[Solved] Thousands separator

6 Posts
3 Users
2 Reactions
406 Views
Posts: 3
Topic starter
(@malouk)
Active Member
Joined: 3 years ago

Hello,

Is it possible to change the thousands separator ?

By a space or a punt ?

Tanks

5 Replies
Sofy
Posts: 5483
 Sofy
Admin
(@sofy)
Support Team
Joined: 8 years ago

Hi,

Could you please provide us with a full-page screenshot to help us better understand the issue?

Reply
Posts: 3
Topic starter
(@malouk)
Active Member
Joined: 3 years ago

Hello,

In the French, Belgian, and Swiss systems, the decimal separator is represented by a comma and the thousands separator by a space.

Reply
2 Replies
Sofy
 Sofy
Admin
(@sofy)
Joined: 8 years ago

Support Team
Posts: 5483

@malouk 

You can customize the wpForo theme files.

Please read attentively this doc:   https://wpforo.com/docs/wpforo-v2/forum-themes/theme-files/   You'll find more information about wpForo theme files here

For an update-safe way of customization, please refer to this documentation:   https://wpforo.com/docs/wpforo-v2/forum-themes/theme-customization/

Reply
(@golabs)
Joined: 4 years ago

Trusted Member
Posts: 47

@malouk in pretty much all of Europe and many other countries around the world 🙂

So it would be great to have the choice as a wpForo setting.

Reply
Posts: 3
Topic starter
(@malouk)
Active Member
Joined: 3 years ago

Hello,

The problem stems from the fact that WordPress uses the PHP number_format function instead of the WordPress number_format_i18n function (in the functions.php file).

function wpforo_print_number( $n, $echo = false ) {
	$x      = str_replace( ",", "", $n );
	$x      = intval( $x );
	$n      = 0 + $x;
	$number = 0;
	if( ! is_numeric( $n ) ) return false;
	if( $n > 1000000000000 ) {
		$number = round( ( $n / 1000000000000 ), 1 ) . ' ' . str_replace( '{number}', '', wpforo_phrase( '{number}T', false ) );
	} else if( $n > 1000000000 ) {
		$number = round( ( $n / 1000000000 ), 1 ) . ' ' . str_replace( '{number}', '', wpforo_phrase( '{number}B', false ) );
	} else if( $n > 1000000 ) {
		$number = round( ( $n / 1000000 ), 1 ) . ' ' . str_replace( '{number}', '', wpforo_phrase( '{number}M', false ) );
	} else if( $n > 10000 ) $number = round( ( $n / 1000 ), 1 ) . ' ' . str_replace( '{number}', '', wpforo_phrase( '{number}K', false ) );
	
	$number = ( $number ) ? $number : number_format( $n );
	
	if( $echo ) {
		echo $number;
	} else {
		return $number;
	}
}

this should be

function wpforo_print_number( $n, $echo = false ) {
	$x      = str_replace( ",", "", $n );
	$x      = intval( $x );
	$n      = 0 + $x;
	$number = 0;
	if( ! is_numeric( $n ) ) return false;
	if( $n > 1000000000000 ) {
		$number = round( ( $n / 1000000000000 ), 1 ) . ' ' . str_replace( '{number}', '', wpforo_phrase( '{number}T', false ) );
	} else if( $n > 1000000000 ) {
		$number = round( ( $n / 1000000000 ), 1 ) . ' ' . str_replace( '{number}', '', wpforo_phrase( '{number}B', false ) );
	} else if( $n > 1000000 ) {
		$number = round( ( $n / 1000000 ), 1 ) . ' ' . str_replace( '{number}', '', wpforo_phrase( '{number}M', false ) );
	} else if( $n > 10000 ) $number = round( ( $n / 1000 ), 1 ) . ' ' . str_replace( '{number}', '', wpforo_phrase( '{number}K', false ) );
	
	$number = ( $number ) ? $number : number_format_i18n( $n );
	
	if( $echo ) {
		echo $number;
	} else {
		return $number;
	}
}
Reply