This project is archived and is in readonly mode.
number_to_human_size helper: fix/introduce pluralization, add 'format' property
Reported by Yaroslav Markin | December 25th, 2008 @ 08:39 PM
number_to_human_size I18n:
FIXES
Now using pluralization properly (actually I18n did not work at all for Byte/Bytes). Had to move I18n key in translations table (number.human.storage_units.units).
FEATURES
Added number.human.storage_units.format for languages like Japanese where unit formatting is not "{{number}} {{unit}}" but rather "{{number}}{{unit}}".
NOTES
People will need to change translations for their language when using number_to_human_size. I'll try to update Sven's rails-i18n repo right after this gets commited.
Comments and changes to this ticket
-
Yaroslav Markin December 26th, 2008 @ 12:22 PM
Needs more discussion.
Since it fixes a bug anyway, in case we don't come up with a better solution, we should apply this to 2.3.
-
Yaroslav Markin January 1st, 2009 @ 06:32 PM
Sven suggested that translations table should look different, so here we are.
This way we don't do "random" lookups to translation table for getting max_exp, but a number of possible units is limited by a constant and values in translation table.
-
Yaroslav Markin January 2nd, 2009 @ 08:57 AM
- Assigned user changed from Jeremy Kemper to Sven Fuchs
-
Yaroslav Markin January 18th, 2009 @ 12:30 PM
- Tag changed from actionview, helpers, i18n, patch to 2.3, actionview, bug, helpers, i18n, patch
Sven: ping
-
Pratik January 18th, 2009 @ 09:19 PM
- Milestone cleared.
-
Sven Fuchs January 18th, 2009 @ 10:31 PM
Haven't run the tests, but yeah, I think this is the way to go (using pluralization, i.e. the second approach).
Yaroslav, looking at the translation data - Byte/Bytes is the only pluralized bit. Will the code still work when one adds Kilobyte/Kilobytes?
Also, should the key be renamed to : storage_units_abbrevations?
-
Yaroslav Markin January 19th, 2009 @ 05:34 PM
Sven, yes, all keys are ready for pluralization, I pass
:count
all the time.Regarding @:storage_units_abbreviations@, that is exactly the reason I don't like to name the key "abbreviations" -- you actually may change "KB" to "Kilobyte"/"Kilobytes" anytime :)
-
Sven Fuchs January 21st, 2009 @ 11:03 PM
Alright, cool. Yeah, then I think we should go with this solution.
+1 from me
-
Sven Fuchs January 21st, 2009 @ 11:08 PM
- Assigned user changed from Sven Fuchs to Jeremy Kemper
Jeremy, I'll assign this to you, so you know there's something to apply :)
-
Repository January 27th, 2009 @ 05:24 PM
- State changed from new to committed
(from [17db28f1ca0597fa1e9abdcacd934ca27d589fb9]) Improve i18n support for number_to_human_size helper: * now using pluralization properly * storage unit translations moved to number.human.storage_units.units * introduced number.human.storage_units.format for languages that do not follow "{{number}} {{unit}}" format (Japanese)
NOTE: I18n table changed, you will need to update your translations.
[#1634 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 1634 number_to_human_size helper: fix/introduce pluralization, add 'format' property [#1634 state:committed]