Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#50194 closed enhancement (fixed)

Add i18n to size_format

Reported by: rahe's profile Rahe Owned by: audrasjb's profile audrasjb
Milestone: 5.5 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch commit
Focuses: Cc:



The units of the size_format function aren't translatable.
They are already translated on the network settings pages for the size of the upload folder or the size of the uploadable files.


Change History (12)

This ticket was mentioned in PR #275 on WordPress/wordpress-develop by Rahe.

4 years ago

Change the size_format and wp_convert_bytes_to_hr to add translatable strings for the units

Trac ticket:

#2 @audrasjb
4 years ago

  • Keywords has-patch added


This change makes sense to me.
I’d just suggest to add an additional translator comment when the file size is null, as the translation may be different for some locales in this specific case.

Maybe something like /* translators: File size in bytes, when the file size is null. */ ?

#3 @audrasjb
4 years ago

  • Milestone changed from Awaiting Review to 5.5

Let's move this ticket to milestone 5.5.

#4 @Rahe
4 years ago

Pull request updated

Rahe commented on PR #275:

4 years ago

Thank you for the review, everything is modified according to the comments

#6 @Rahe
4 years ago

PR updated :)

#7 @Rahe
4 years ago

Deprecated wp_convert_bytes_to_hr function restored to it's original state :)

#8 @audrasjb
4 years ago

  • Keywords commit added
  • Owner set to audrasjb
  • Status changed from new to accepted

Patch looks good to go, marking this for commit.

#9 @whyisjake
4 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 48054:

I18N: Add i18n to size_format().

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

Props Rahe, audrasjb, ocean90.

Fixes #50194.

#11 @johnbillion
4 years ago

We could go a step further here and implement _nx() with a placeholder for the numeric value instead of always appending the unit to the end.

Question: Are there actually any languages where the unit for the size of a value differs depending on the plurality of the number? (eg. is KB/KBS a thing?) I don't know, maybe this would be an unnecessary change.

#12 @Rahe
4 years ago


I think that unit symbols are not sensitive to plural, we say 10 milliseconds and write 10ms, or 10 meters but write 10m.

According to this answer

"Symbols for units are always written in roman (upright) type, irrespective of the type used in the rest of the text. The unit symbol shall remain unaltered in the plural and is not followed by a full stop except for normal punctuation, e.g. at the end of a sentence."

Note: See TracTickets for help on using tickets.