From acf0f67a43ce193839b1c82bfcf92c1a17aeefdf Mon Sep 17 00:00:00 2001 From: Jake Spurlock Date: Tue, 16 Jun 2020 06:08:07 +0000 Subject: [PATCH] I18N: Add i18n to `size_format()`. Add translatable strings to the units of the `size_format()` function. Props Rahe, audrasjb, ocean90. Fixes #50194. git-svn-id: https://develop.svn.wordpress.org/trunk@48054 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 35c1e2e2f3..46a9db42bf 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -450,15 +450,21 @@ function number_format_i18n( $number, $decimals = 0 ) { */ function size_format( $bytes, $decimals = 0 ) { $quant = array( - 'TB' => TB_IN_BYTES, - 'GB' => GB_IN_BYTES, - 'MB' => MB_IN_BYTES, - 'KB' => KB_IN_BYTES, - 'B' => 1, + /* translators: Unit symbol for terabyte. */ + _x( 'TB', 'unit symbol' ) => TB_IN_BYTES, + /* translators: Unit symbol for gigabyte. */ + _x( 'GB', 'unit symbol' ) => GB_IN_BYTES, + /* translators: Unit symbol for megabyte. */ + _x( 'MB', 'unit symbol' ) => MB_IN_BYTES, + /* translators: Unit symbol for kilobyte. */ + _x( 'KB', 'unit symbol' ) => KB_IN_BYTES, + /* translators: Unit symbol for byte. */ + _x( 'B', 'unit symbol' ) => 1, ); if ( 0 === $bytes ) { - return number_format_i18n( 0, $decimals ) . ' B'; + /* translators: Unit symbol for byte. */ + return number_format_i18n( 0, $decimals ) . ' ' . _x( 'B', 'unit symbol' ); } foreach ( $quant as $unit => $mag ) {