kslazarev / numbers_and_words Goto Github PK
View Code? Open in Web Editor NEWConvert numbers to words using I18N.
License: MIT License
Convert numbers to words using I18N.
License: MIT License
The repo's name is still number_to_words_ru, when development is merged to master and released, it should be renamed to numbers_and_words via Admin.
Remove hyphen between tens and ones:
remove_hyphen: [true || false]
I18n.with_locale(:en) { 21.to_words remove_hyphen: true }
=> "one hundred and eleven"
Thank you for your important and correct contribution to the project. I have already added @jaambros to repo. So close this issue in development branch.
Any questions you could ask here or by email.
[0.1, 0.31, 0.12].to_words remove_zero: true
=> ["one tenth", "thirty-one hundredths", "twelve hundredths"]
We could support scientific/exponential notation, if every languages roughly uses the integer_with_fractinal_in_words exponential_separator exponent_in_words
form. All we need is support ordinals for exponent_in_words
. I created a proof-of-concept implementation on the feature/exponential branch (which in turn uses the feature/ordinals branch).
Remove duplication code. To test new language just add two fixture examples files:
"array/fixture_examples/#{new_language}.yml"
"integer/fixture_examples/#{new_language}.yml"
21.to_words #=> "двадцать один"
возможно ли получить число в виде "двадцать одна"?
Remove unnecessary file Gemfile.lock.
NameError: uninitialized constant NumbersAndWords::Translations::EnUs
NameError: uninitialized constant NumbersAndWords::Strategies::FiguresConverter::Languages::EnUs
When 'wording' multiples of 100, a trailing 'and' is added improperly when using 'to_words(hundreds_with_union: true)'.
Some examples will make it clearer:
900 -> "nine hundred and" (instead of just "nine hundred")
600 -> "six hundred and" (instead of just "six hundred")
Cheers, and thanks for the gem!
User 'dblock' must add contacts to README, as he made a good contribution to the project.
ruby-1.9.3-p0-fast :001 > require 'numbers_and_words'
=> true
ruby-1.9.3-p0-fast :002 > 177.to_words
NoMethodError: undefined method `capacity_count' for [7, 7, 1]:Array
Thank you for your contribution to the project. I have already added @martinsspringis to repo. So close this issue in development branch.
Any questions you could ask here or by email.
English uses and
as the union_separator
(when separating integral and fractional part) and also uses that when separating hundreds, e.g.
irb(main):006:0> I18n.with_locale('en') { 0.115.to_words(hundreds_with_union: true) }
=> "zero and one hundred and fifteen thousandths"
irb(main):009:0> I18n.with_locale('en') { 115.to_words(hundreds_with_union: true) }
=> "one hundred and fifteen"
British uses point
for the union_separator
and that's ok, but it also uses point
for separating hundreds, and that is wrong, e.g.:
irb(main):011:0> I18n.with_locale('en-GB') { 0.115.to_words(hundreds_with_union: true) }
=> "zero point one one five"
irb(main):004:0> I18n.with_locale('en-GB') { 115.to_words(hundreds_with_union: true) }
=> "one hundred point fifteen"
I think we need a separate translation for the hundreds_union and union_separator (that happens to be the same word in english), @kslazarev what do you think?
Refactoring strategies. Remove duplication by Families::Cyrillic and Families::Latin sub modules in Strategies and TranslationsHelpers.
Add 'and' between hundreds and tens:
I18n.with_locale(:en) { 111.to_words hundreds_with_union: true }
=> "one hundred and eleven"
Add gem 'rake' to Gemfile. Fix correct interaction with bundle and rake.
Add changelog file.
Example: https://github.com/rails/rails/blob/master/actionpack/CHANGELOG.md
For exponential notation (#49) this is a dependency. Apart from that this would be a nice addition to the api. A proof-of concept is on feature/ordinals branch.
It's really nice that all code, examples exist and located in right place for Hungarian language. Great contribution to project. I have already added @eLod to repo.
Thank you/Köszönöm, @eLod
Any questions you could ask here or by email.
This issue is blocking release right now, so please, close this task as fast, as possible.
config/locales/ru.yml
ru:
items:
one: '%{count} товар'
few: '%{count} товара'
many: '%{count} товаров'
rails c:
> I18n.t :items, :count => 101
=> "101 товаров"
Должно быть:
> I18n.t :items, :count => 101
=> "101 товар"
Problem: It looks like a mess when there are more than 3 languages in README headings.
Maybe someone @dblock , @Shk-Serji, @sorich87, @eLod could generate an idea with this deal.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.