Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for IEC standard prefixes and suffix translation #63

Closed
zebratrois opened this issue Nov 19, 2015 · 5 comments
Closed

Support for IEC standard prefixes and suffix translation #63

zebratrois opened this issue Nov 19, 2015 · 5 comments

Comments

@zebratrois
Copy link

I would also being able to use the standard IEC binary prefixes such as "Mi" and "Gi" instead of "M" and "G" in BinarySuffix functions and to use a localized suffix as in french we commonly use "o" instead of "B" (we use "octet(s)" instead of "byte(s)").
I can understand that replacing "GB" by "GiB" by default is counterintuitive as it's not the most commonly used spelling so it could be achieved adding another parameter or usng a "tweaked" locale.
The result could be something like this:

echo Number::binarySuffix(1073741824 * 2); // "2 GiB"
echo Number::binarySuffix(1073741824 * 2, 'en-iec'); // "2 GiB"
echo Number::binarySuffix(1073741824 * 2, 'fr'); // "2 Go"
echo Number::binarySuffix(1073741824 * 2, 'fr-iec'); // "2 Gio"
@norberttech
Copy link
Member

Hi @zebratrois sorry for my late response, I didnt have enough time to take care of this issue.
Idea sounds cool too me, we can do it adding third parameter into binarySuffix which gonna be

 NumberHumanizer::binarySuffix(1073741824 * 2, 'fr', false); // "2 Go" last parameter gonna be false by default
 NumberHumanizer::binarySuffix(1073741824 * 2, 'fr', true); // "2 Gio"

what do you think about that?

@zebratrois
Copy link
Author

Hi @norzechowicz, sounds good to me :)

@norberttech
Copy link
Member

are you able to work on that?

@zebratrois
Copy link
Author

Yes i'll work on that but that'll take some time as i'm unplugging my computer this evening for a 2-weeks vacation ;-)

@norberttech
Copy link
Member

hah sure, have fun!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants