WordPress.org

Make WordPress Core

Changeset 48054


Ignore:
Timestamp:
06/16/2020 06:08:07 AM (15 months ago)
Author:
whyisjake
Message:

I18N: Add i18n to size_format().

Add translatable strings to the units of the size_format() function.

Props Rahe, audrasjb, ocean90.

Fixes #50194.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r47902 r48054  
    451451function size_format( $bytes, $decimals = 0 ) {
    452452    $quant = array(
    453         'TB' => TB_IN_BYTES,
    454         'GB' => GB_IN_BYTES,
    455         'MB' => MB_IN_BYTES,
    456         'KB' => KB_IN_BYTES,
    457         'B'  => 1,
     453        /* translators: Unit symbol for terabyte. */
     454        _x( 'TB', 'unit symbol' ) => TB_IN_BYTES,
     455        /* translators: Unit symbol for gigabyte. */
     456        _x( 'GB', 'unit symbol' ) => GB_IN_BYTES,
     457        /* translators: Unit symbol for megabyte. */
     458        _x( 'MB', 'unit symbol' ) => MB_IN_BYTES,
     459        /* translators: Unit symbol for kilobyte. */
     460        _x( 'KB', 'unit symbol' ) => KB_IN_BYTES,
     461        /* translators: Unit symbol for byte. */
     462        _x( 'B', 'unit symbol' )  => 1,
    458463    );
    459464
    460465    if ( 0 === $bytes ) {
    461         return number_format_i18n( 0, $decimals ) . ' B';
     466        /* translators: Unit symbol for byte. */
     467        return number_format_i18n( 0, $decimals ) . ' ' . _x( 'B', 'unit symbol' );
    462468    }
    463469
Note: See TracChangeset for help on using the changeset viewer.