I18N: Add i18n to `size_format()`.
Add translatable strings to the units of the `size_format()` function. Props Rahe, audrasjb, ocean90. Fixes #50194. Built from https://develop.svn.wordpress.org/trunk@48054 git-svn-id: http://core.svn.wordpress.org/trunk@47821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ea8331f00d
commit
28c6339400
|
@ -450,15 +450,21 @@ function number_format_i18n( $number, $decimals = 0 ) {
|
||||||
*/
|
*/
|
||||||
function size_format( $bytes, $decimals = 0 ) {
|
function size_format( $bytes, $decimals = 0 ) {
|
||||||
$quant = array(
|
$quant = array(
|
||||||
'TB' => TB_IN_BYTES,
|
/* translators: Unit symbol for terabyte. */
|
||||||
'GB' => GB_IN_BYTES,
|
_x( 'TB', 'unit symbol' ) => TB_IN_BYTES,
|
||||||
'MB' => MB_IN_BYTES,
|
/* translators: Unit symbol for gigabyte. */
|
||||||
'KB' => KB_IN_BYTES,
|
_x( 'GB', 'unit symbol' ) => GB_IN_BYTES,
|
||||||
'B' => 1,
|
/* 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 ) {
|
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 ) {
|
foreach ( $quant as $unit => $mag ) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-48053';
|
$wp_version = '5.5-alpha-48054';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue