-
Notifications
You must be signed in to change notification settings - Fork 115
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
Numeric Fallback #128
Comments
I am not sure. I think if the library can't convert something you'd probably want to get an error. At the very least that would be a change in behavior so we'd want a way to turn it off. |
Oh, I'm so sorry, it looks like Github ate my description. I was suggesting it as an opt-in option. For instance, you're trying to render a page in the |
👍 give it a shot |
@alethea Something like this? require 'numbers_and_words'
number = 42
locales = %i(aa en es fr ru zh)
locales.each do |locale|
begin
I18n.with_locale(locale) { p number.to_words }
rescue I18n::InvalidLocale
p number
end
end
# => 42
# => "forty-two"
# => "cuarenta y dos"
# => "quarante-deux"
# => "сорок два"
# => 42 |
Would it be in scope of this project to include an option to allow,
Numeric#to_words
to fallback to returningNumeric#to_s
for locales that aren't supported?The text was updated successfully, but these errors were encountered: