Skip to content

Commit

Permalink
Merge branch 'release/0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
kslazarev committed Mar 25, 2013
2 parents 61bd2e0 + 9816ae4 commit 8270a2e
Show file tree
Hide file tree
Showing 133 changed files with 2,416 additions and 605 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
## Next Release
## 0.6.0 (March 25, 2013)

### Features
* Add Hungarian language. \[[#40](https://github.com/kslazarev/numbers_and_words/pull/40)\] \([@eLod](https://github.com/eLod)\)
* Support fractional form for Ukranian. \[[#54](https://github.com/kslazarev/numbers_and_words/issues/54)\] \([@Shk-Serji](https://github.com/Shk-Serji)\)
* Support fractional form for Russian. \[[#53](https://github.com/kslazarev/numbers_and_words/issues/53)\] \([@kslazarev](https://github.com/kslazarev)\)
* Added functionality for spanish . \[[#51](https://github.com/kslazarev/numbers_and_words/issues/51)\] \([@jaambros](https://github.com/jaambros)\)
* Support ordinal form for English and Hungarian. \[[#50](https://github.com/kslazarev/numbers_and_words/issues/50)\] \([@eLod](https://github.com/eLod)\)
* Add option :remove_hyphen for English language. \[[#45](https://github.com/kslazarev/numbers_and_words/issues/45)\] \([@kslazarev](https://github.com/kslazarev)\)
* Add option :hundreds_with_union for English language. \[[#44](https://github.com/kslazarev/numbers_and_words/issues/44)\] \([@kslazarev](https://github.com/kslazarev)\)
* Add Spanish language. (experimental). \[[#42](https://github.com/kslazarev/numbers_and_words/issues/42)\] \([@kslazarev](https://github.com/kslazarev)\)
* Add Swedish language. (experimental). \[[#41](https://github.com/kslazarev/numbers_and_words/issues/41)\] \([@kslazarev](https://github.com/kslazarev)\)
* Add Hungarian language. \[[#40](https://github.com/kslazarev/numbers_and_words/issues/40)\] \([@eLod](https://github.com/eLod)\)
* Add option :gender for Russian language. \[[#39](https://github.com/kslazarev/numbers_and_words/issues/39)\] \([@kslazarev](https://github.com/kslazarev)\)
* Gem numbers_and_words not working for decimal values. \[[#38](https://github.com/kslazarev/numbers_and_words/issues/38)\] \([@eLod](https://github.com/eLod)\)

### Supports
* Update 'code climate' badge. \[[#47](https://github.com/kslazarev/numbers_and_words/issues/47)\] \([@kslazarev](https://github.com/kslazarev)\)
* Add @eLog contacts and project description on Hungarian language to README. \[[#46](https://github.com/kslazarev/numbers_and_words/issues/46)\] \([@eLod](https://github.com/eLod)\)
* Add language specific options. \[[#43](https://github.com/kslazarev/numbers_and_words/issues/43)\] \([@kslazarev](https://github.com/kslazarev)\)

## 0.5.0 (October 19, 2012)

Expand Down
91 changes: 83 additions & 8 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
== numbers_and_words {<img src="https://secure.travis-ci.org/kslazarev/numbers_and_words.png" />}[http://travis-ci.org/kslazarev/numbers_and_words] {<img src="https://codeclimate.com/badge.png" />}[https://codeclimate.com/github/kslazarev/numbers_and_words]
== numbers_and_words {<img src="https://codeclimate.com/github/kslazarev/numbers_and_words.png" />}[https://codeclimate.com/github/kslazarev/numbers_and_words] {<img src="https://secure.travis-ci.org/kslazarev/numbers_and_words.png" />}[http://travis-ci.org/kslazarev/numbers_and_words]

Convert numbers to words using the I18n library.

Перевод чисел в слова при помощи библиотеки I18n.

Converti les nombres en lettres en utilisant la librairie I18n.

Számok betűvel írva az I18n könyvtár segítségével.

== Supported Languages / Языки / Langues Supportées

* English
* Spanish
* Русский
* Français
* Українська
* Magyar
* Türkçe**
* Italiano**
* Nederlands**
* Hungarian
* Swedish**

** Experimental

Expand All @@ -24,77 +28,147 @@ Converti les nombres en lettres en utilisant la librairie I18n.
I18n.with_locale(:en) { 42.to_words }
=> "forty-two"

I18n.with_locale(:es) { 42.to_words }
=> "cuarenta y dos"

I18n.with_locale(:ru) { 42.to_words }
=> "сорок два"

I18n.with_locale(:fr) { 42.to_words }
=> "quarante-deux"

I18n.with_locale(:hu) { 42.to_words }
=> "negyvenkettő"

21.to_words
=> "twenty-one"
=> "veintiuno"
=> "двадцать один"
=> "vingt et un"
=> "двадцять один"
=> "huszonegy"
=> "yirmi bir"
=> "ventiuno"
=> "éénentwintig"
=> "huszonegy"
=> "tjugo-en"

231.to_words
=> "two hundred thirty-one"
=> "doscientos treinta y uno"
=> "двести тридцать один"
=> "deux cent trente-trois"
=> "двiстi тридцять один"
=> "kettőszázharmincegy"
=> "iki yüz otuz bir"
=> "2 cento trentauno"
=> "tweehonderdéénendertig"
=> "kettőszázharmincegy"
=> "två hundra trettio-en"

4030.to_words
=> "four thousand thirty"
=> "cuatro mil treinta"
=> "четыре тысячи тридцать"
=> "quatre mille trente"
=> "чотири тисячi тридцять"
=> "négyezer-harminc"
=> "dört bin otuz"
=> "quattro mille trenta"
=> "vierthousanddertig"
=> "négyezer-harminc"
=> "fyra tusen trettio"

1000100.to_words
=> "one million one hundred"
=> "un millón cien"
=> "один миллион сто"
=> "un million cent"
=> "один мiльйон сто"
=> "egymillió-egyszáz"
=> "bir milyon bir yüz"
=> "uno milione 1 cento"
=> "één miljoen honderd"
=> "egymillió-egyszáz"
=> "en miljoner en hundra"

1000000000000000000000000000000000.to_words
=> "one decillion"
=> "un quintillardo"
=> "один дециллион"
=> "un quintilliard"
=> "один децильйон"
=> "egykvintilliárd"
=> "bir desilyon"
=> "uno decillion"
=> "één decillion"
=> "egykvintilliárd"
=> "en decillion"

[1, 2, 3].to_words
=> ["one", "two", "three"]
=> ["uno", "dos", "tres"]
=> ["один", "два", "три"]
=> ["un", "deux", "trois"]
=> ["egy", "kettő", "három"]

[11, 22, 133].to_words
=> ["eleven", "twenty-two", "one hundred thirty-three"]
=> ["once", "veintidos", "ciento treinta y tres"]
=> ["одиннадцать", "двадцать два", "сто тридцать три"]
=> ["onze", "vingt-deux", "cent trente-trois"]
=> ["одинадцять", "двадцять два", "сто тридцять три"]
=> ["tizenegy", "huszonkettő", "egyszázharminchárom"]
=> ["on bir", "yirmi iki", "bir yüz otuz üç"]
=> ["undici", "ventidue", "1 cento trentatre"]
=> ["elf", "tweeentwintig", "honderddrieendertig"]
=> ["tizenegy", "huszonkettő", "egyszázharminchárom"]
=> ["elva", "tjugo-två", "en hundra trettio-tre"]

21.77.to_words
=> "twenty-one and seventy-seven hundredths"
=> "двадцать одна целая и семьдесят семь сотых"
=> "двадцять одна цiла i сiмдесят сiм сотих"
=> "huszonegy egész hetvenhét század"

== Language options / Языковые опции

* English

Ordinal form: (ordinal: [true || false])

I18n.with_locale(:en) { 21.to_words ordinal: true }
=> "twenty-first"

Remove hyphen between tens and ones: (remove_hyphen: [true || false])

I18n.with_locale(:en) { 21.to_words remove_hyphen: true }
=> "twenty one"

Add 'and' between hundreds and tens: (hundreds_with_union: [true || false])

I18n.with_locale(:en) { 111.to_words hundreds_with_union: true }
=> "one hundred and eleven"

Remove 'zero' from integral part of float: (remove_zero: [true || false])

I18n.with_locale(:en) { 0.7.to_words remove_zero: true }
=> "seven tenths"

* Russian

Change gender form: (gender: [:female || :male || :neuter])

I18n.with_locale(:ru) { 1001.to_words gender: :neuter }
=> "одна тысяча одно"

* Ukranian

Change gender form: (gender: [:female || :male || :neuter])

I18n.with_locale(:ru) { 1001.to_words gender: :neuter }
=> "одна тисяча одне"

* Hungarian

Ordinal form: (ordinal: [true || false])

I18n.with_locale(:hu) { 21.to_words ordinal: true }
=> "huszonegyedik"

== Requirements / Требования / Configuration Requise

Expand Down Expand Up @@ -123,3 +197,4 @@ Send a pull request. Bonus points for topic branches.
* Daniel Doubrovkine (link:http://github.com/dblock)
* Sergey Shkirando (mailto:[email protected])
* Ulrich Sossou (Github[http://github.com/sorich87], {Personal Page}[http://ulrichsossou.com/])
* eLod (link:http://github.com/eLod)
7 changes: 4 additions & 3 deletions lib/numbers_and_words.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
require 'i18n'
require 'i18n/backend/pluralization'
require 'active_support/inflector'
require 'active_support/core_ext/object'

require 'numbers_and_words/translations_helpers'
require 'numbers_and_words/translations'
require 'numbers_and_words/strategies'
require 'numbers_and_words/array_additions'
require 'numbers_and_words/figures_array'
require 'numbers_and_words/helper_classes'
require 'numbers_and_words/core_ext'
require 'numbers_and_words/wrappers'
require 'numbers_and_words/i18n'
require 'numbers_and_words/version'

Expand Down
2 changes: 0 additions & 2 deletions lib/numbers_and_words/array_additions.rb

This file was deleted.

44 changes: 0 additions & 44 deletions lib/numbers_and_words/array_additions/helpers.rb

This file was deleted.

9 changes: 0 additions & 9 deletions lib/numbers_and_words/array_additions/validations.rb

This file was deleted.

1 change: 1 addition & 0 deletions lib/numbers_and_words/core_ext.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
require 'numbers_and_words/core_ext/integer'
require 'numbers_and_words/core_ext/float'
require 'numbers_and_words/core_ext/array'
2 changes: 1 addition & 1 deletion lib/numbers_and_words/core_ext/array.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Array
def to_words
def to_words options = {}
map &:to_words
end

Expand Down
5 changes: 5 additions & 0 deletions lib/numbers_and_words/core_ext/float.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Float
def to_words options = {}
NumbersAndWords::Wrappers::Float.new(self).to_words options
end
end
11 changes: 2 additions & 9 deletions lib/numbers_and_words/core_ext/integer.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
class Integer

def to_words
to_figures_array.to_words NumbersAndWords::Strategies::Base.factory
end

private

def to_figures_array
to_s.split(//).map(&:to_i).to_figures
def to_words options = {}
NumbersAndWords::Wrappers::Integer.new(self).to_words options
end
end
15 changes: 0 additions & 15 deletions lib/numbers_and_words/figures_array.rb

This file was deleted.

2 changes: 2 additions & 0 deletions lib/numbers_and_words/helper_classes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'numbers_and_words/helper_classes/figures_array'
require 'numbers_and_words/helper_classes/words_array'
Loading

0 comments on commit 8270a2e

Please sign in to comment.