Comments (5)
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.
from numbers_and_words.
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 zh
locale, it would fall back to numbers, but in en
it would use words.
from numbers_and_words.
👍 give it a shot
from numbers_and_words.
@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
from numbers_and_words.
@jlduran Yes, that's exactly the behavior I was proposing.
@dblock I'll see if I can put a PR together over the weekend.
from numbers_and_words.
Related Issues (20)
- Fork? HOT 12
- Finish German support
- Wrong dependencies management makes the gem require activesupport 5.0 thus Ruby 2.2.2 HOT 8
- Drop EOL'ed Rubies in Travis CI HOT 1
- Configure I18n.available_locales
- Support for Arabic HOT 3
- Crashing Spanish Translations HOT 2
- Support for Chinese? HOT 1
- Support for float numbers in french HOT 1
- Floating-point numbers with five or more digits after decimal separator
- Move this gem into a github org?
- Ability to add units
- Why included .yml languages as internal instead of document them and let user customize? HOT 2
- Wrong precision 2 for spanish HOT 1
- I18n::InvalidPluralizationData (translation data {:one=>"tenth", :other=>"tenths"} HOT 7
- Incorrect joiner for some Dutch examples HOT 3
- Problem with hundreds as array HOT 1
- Does this gem work with Ruby 3.2.0 ? HOT 1
- When the numbers start with 0 it showing incorrect string value. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from numbers_and_words.