Yoan Blanc writes:
> Or please, don't put things that are local only (and won't work for
> any other languages) in web.py:
>
> http://github.com/aaronsw/watchdog/tree/master/webapp.py#L120
>
> nth_string is nice, but I don't care at all about it if my website is
> in french or german. l10n/i18n functions must go in an appropriate
> package like Babel (http://babel.edgewall.org/)
Just to be clear, it's not Aaron's idea that nth_string should go
somewhere besides watchdog/webapp.py; it was mine. Don't blame him for
it. I think web.py would be a better place for it than watchdog, but
you're right that there may be even better places.
Thanks for the pointer to Babel! It seems to already have `commify`
(another recent addition to web.py), in the form of
babel.numbers.format_number(foo, locale='en_US'), along with its
inverse. It doesn't seem to have any of the usual English-language
formatting niceties, though, e.g.
list(['eggs']) => 'eggs'
list(['eggs', 'ham']) => 'eggs and ham'
list(['spam', 'eggs', 'ham']) => 'spam, eggs, and ham'
nth_string(12) => '12th'
nth_string(1102) => '1102nd'
sing_pl(1, 'file', 'files') => '1 file'
sing_pl(2, 'file', 'files') => '2 files'
sing_pl(2, 'file') => '2 files' # default English plural
sing_pl(2, 'net') => '2 nets' # which is a little tricky
I'm sure these must exist somewhere; do you know where?
Kragen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---