From 409899afd0efcff1296375db3f93295c4475a397 Mon Sep 17 00:00:00 2001 From: sdnunca Date: Wed, 3 Jul 2024 17:17:48 +0300 Subject: [PATCH] Parse the population as int before formatting it. --- tests/WPCLDRTests.php | 2 +- wp-cldr.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/WPCLDRTests.php b/tests/WPCLDRTests.php index 35a60167..93205eca 100644 --- a/tests/WPCLDRTests.php +++ b/tests/WPCLDRTests.php @@ -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 ); diff --git a/wp-cldr.php b/wp-cldr.php index aa4d890d..db1cbc24 100644 --- a/wp-cldr.php +++ b/wp-cldr.php @@ -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 @@ -235,7 +235,7 @@ function wp_cldr_settings() { esc_html_e( 'Population', 'wp-cldr' ); echo ' — '; $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 );