F. Senault
12/21/2007 9:04:00 PM
Le 21 décembre 2007 à 15:30, Matthew Harris a écrit :
> The default English localization can be used as a sample reference to
> building your own. Currently there are two localizations, English and
> Korean.
French is quite straightforward :
class Duration
module Localizations
# French localization
module French
LOCALE = :french
PLURALS = %w(secondes minutes heures jours semaines)
SINGULARS = %w(seconde minute heure jour semaine )
FORMAT = proc do |duration|
str = duration.format('%w %~w, %d %~d, %h %~h, %m %~m, %s %~s')
str.sub(/^0 [a-z]+,?/i, '').gsub(/ 0 [a-z]+,?/i, '').chomp(',').sub(/, (\d+ [a-z]+)$/i, ' et \1').strip
# Produit un message du genre :
# 10 semaines, 2 jours, 3 heures, 4 minutes et 5 secondes
end
end
end
end
Fred
--
I'd like to stay But every day
Everything pushes me farther away If you could show
Help me to know How it's supposed to be
Where did it go ? (Nine Inch Nails, Where Is Everybody)