Skip to content

Commit

Permalink
Parse the population as int before formatting it.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdnunca committed Jul 3, 2024
1 parent 074091d commit 409899a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/WPCLDRTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Performs unit tests against the wp-cldr plugin.
*/
final class WPCLDRTests extends TestCase {

protected $cldr;
protected function setup() : void {
// The second parameter, false, tells the class to not use caching which means we can avoid loading WordPress for these tests.
$this->cldr = new WP_CLDR( 'en', false );
Expand Down
4 changes: 2 additions & 2 deletions wp-cldr.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Plugin URI: https://github.com/Automattic/wp-cldr
* Author: Automattic
* Author URI: https://automattic.com
* Version: 1.2
* Version: 1.2.1
* Text Domain: wp-cldr
* Domain Path: /languages
* License: GPLv2 or later
Expand Down Expand Up @@ -235,7 +235,7 @@ function wp_cldr_settings() {
esc_html_e( 'Population', 'wp-cldr' );
echo '</i> — ';
$territory_info = $cldr->get_territory_info( $country );
$population = $territory_info['_population'];
$population = (int) $territory_info['_population'];
if ( class_exists( 'NumberFormatter' ) ) {
// Use locale formatting rules.
$fmt = new NumberFormatter( $locale, NumberFormatter::DECIMAL );
Expand Down

0 comments on commit 409899a

Please sign in to comment.