Skip to content

Commit

Permalink
Merge branch 'release/0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
kslazarev committed Sep 2, 2013
2 parents 57539de + 69e3493 commit c5172bb
Show file tree
Hide file tree
Showing 22 changed files with 431 additions and 31 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 0.10.0 (September 02, 2013)

### Features
* Add Estonian language. \[[#82](https://github.com/kslazarev/numbers_and_words/issues/82)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)
* Add Lithuanian language. \[[#77](https://github.com/kslazarev/numbers_and_words/issues/77)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)

### Bugs
* Fix latvian one hundread cases. \[[#81](https://github.com/kslazarev/numbers_and_words/issues/81)\] \([@miks](https://github.com/miks)\) \(assignee: [@miks](https://github.com/miks)\)

### Supports
* Added @miks contacts to contributors list in README. \[[#79](https://github.com/kslazarev/numbers_and_words/issues/79)\] \([@kslazarev](https://github.com/kslazarev)\) \(assignee: [@miks](https://github.com/miks)\)

## 0.9.0 (May 19, 2013)

### Features
Expand Down
37 changes: 30 additions & 7 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ Számok betűvel írva az I18n könyvtár segítségével.
* Français [fr]
* Українська [ua]
* Magyar [hu]
* Lietuvių [lt]
* Latviešu [lv]
* Eesti [et]
* Türkçe** [tr]
* Deutsch** [de]
* Italiano** [it]
Expand Down Expand Up @@ -57,22 +59,30 @@ Számok betűvel írva az I18n könyvtár segítségével.
I18n.with_locale(:hu) { 42.to_words }
=> "negyvenkettő"

I18n.with_locale(:lt) { 42.to_words }
=> "keturiasdešimt du"

I18n.with_locale(:lv) { 42.to_words }
=> "četrdesmit divi"

I18n.with_locale(:et) { 42.to_words }
=> "nelikümmend kaks"

21.to_words
=> "twenty-one"
=> "veintiuno"
=> "двадцать один"
=> "vingt et un"
=> "двадцять один"
=> "huszonegy"
=> "dvidešimt vienas"
=> "divdesmit viens"
=> "kakskümmend üks"
=> "yirmi bir"
=> "einundzwanzig"
=> "ventiuno"
=> "éénentwintig"
=> "tjugo-en"
=> "divdesmit viens"

231.to_words
=> "two hundred thirty-one"
Expand All @@ -81,12 +91,14 @@ Számok betűvel írva az I18n könyvtár segítségével.
=> "deux cent trente-trois"
=> "двiстi тридцять один"
=> "kettőszázharmincegy"
=> "du šimtai trisdešimt vienas"
=> "divi simti trīsdesmit viens"
=> "kakssada kolmkümmend üks"
=> "iki yüz otuz bir"
=> "zweihunderteinunddreißig"
=> "2 cento trentauno"
=> "tweehonderdéénendertig"
=> "två hundra trettio-en"
=> "divi simti trīsdesmit viens"

4030.to_words
=> "four thousand thirty"
Expand All @@ -95,12 +107,14 @@ Számok betűvel írva az I18n könyvtár segítségével.
=> "quatre mille trente"
=> "чотири тисячi тридцять"
=> "négyezer-harminc"
=> "keturi tūkstančiai trisdešimt"
=> "četri tūkstoši trīsdesmit"
=> "neli tuhat kolmkümmend"
=> "dört bin otuz"
=> "viertausenddreißig"
=> "quattro mille trenta"
=> "vierthousanddertig"
=> "fyra tusen trettio"
=> "četri tūkstoši simts trīsdesmit"

1000100.to_words
=> "one million one hundred"
Expand All @@ -109,12 +123,14 @@ Számok betűvel írva az I18n könyvtár segítségével.
=> "un million cent"
=> "один мiльйон сто"
=> "egymillió-egyszáz"
=> "milijonas šimtas"
=> "viens miljons simts"
=> "üks miljon ükssada"
=> "bir milyon bir yüz"
=> "eine Million einhundert"
=> "uno milione 1 cento"
=> "één miljoen honderd"
=> "en miljoner en hundra"
=> "viens miljons simts"

1000000000000000000000000000000000.to_words
=> "one decillion"
Expand All @@ -123,34 +139,40 @@ Számok betűvel írva az I18n könyvtár segítségével.
=> "un quintilliard"
=> "один децильйон"
=> "egykvintilliárd"
=> "vienas decilijonas"
=> "viens deciljons"
=> "üks dekiljon"
=> "bir desilyon"
=> "eine Quintilliarde"
=> "uno decillion"
=> "één decillion"
=> "en decillion"
=> "viens deciljons"

[1, 2, 3].to_words
=> ["one", "two", "three"]
=> ["uno", "dos", "tres"]
=> ["один", "два", "три"]
=> ["un", "deux", "trois"]
=> ["egy", "kettő", "három"]
=> ["vienas", "du", "trys"]
=> ["viens", "divi", "trīs"]
=> ["üks", "kaks", "kolm"]

[11, 22, 133].to_words
=> ["eleven", "twenty-two", "one hundred thirty-three"]
=> ["eleven", "twenty-two", "one hundred thirty-three"]
=> ["once", "veintidos", "ciento treinta y tres"]
=> ["одиннадцать", "двадцать два", "сто тридцать три"]
=> ["onze", "vingt-deux", "cent trente-trois"]
=> ["одинадцять", "двадцять два", "сто тридцять три"]
=> ["tizenegy", "huszonkettő", "egyszázharminchárom"]
=> ["vienuolika", "dvidešimt du", "šimtas trisdešimt trys"]
=> ["vienpadsmit", "divdesmit divi", "simtu trīsdesmit trīs"]
=> ["üksteist", "kakskümmend kaks", "ükssada kolmkümmend kolm"]
=> ["on bir", "yirmi iki", "bir yüz otuz üç"]
=> ["elf", "zweiundzwanzig", "einhundertdreiunddreißig"]
=> ["undici", "ventidue", "1 cento trentatre"]
=> ["elf", "tweeentwintig", "honderddrieendertig"]
=> ["elva", "tjugo-två", "en hundra trettio-tre"]
=> ["vienpadsmit", "divdesmit divi", "simts trīsdesmit trīs"]

21.77.to_words
=> "twenty-one and seventy-seven hundredths"
Expand Down Expand Up @@ -236,3 +258,4 @@ Send a pull request. Bonus points for topic branches.
* Ulrich Sossou (Github[http://github.com/sorich87], {Personal Page}[http://ulrichsossou.com/])
* eLod (link:http://github.com/eLod)
* Mārtiņš Spriņģis (mailto:mspringis@gmail.com)
* Miks Miķelsons (link:http://github.com/miks)
8 changes: 4 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ end

Jeweler::RubygemsDotOrgTasks.new

require 'rspec/core'
require 'rspec/core/rake_task'
#require 'rspec/core'
#require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec) { |spec| spec.pattern = FileList['spec/**/*_spec.rb'] }
#RSpec::Core::RakeTask.new(:spec) { |spec| spec.pattern = FileList['spec/**/*_spec.rb'] }

task :default => :spec
#task :default => :spec

require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
Expand Down
38 changes: 38 additions & 0 deletions lib/numbers_and_words/i18n/locales/numbers.et.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
et:
numbers:
ones: ["null", üks, kaks, kolm, neli, viis, kuus, seitse, kaheksa, üheksa]
teens: [kümme, üksteist, kaksteist, kolmteist, neliteist, viisteist, kuusteist, seitseteist, kaheksateist, üheksateist]
tens: ["null", kümme, kakskümmend, kolmkümmend, nelikümmend, viiskümmend, kuuskümmend, seitsekümmend, kaheksakümmend, üheksakümmend]
mega: [ones, thousands, millions, billions, trillions, quadrillions, quintillion, sextillions, septillions, octillions, nonillions, decillions]
hundreds: sada
thousands: tuhat
millions:
one: miljon
other: miljonit
billions:
one: miljard
other: miljardit
trillions:
one: triljon
other: triljonit
quadrillions:
one: kvadriljon
other: kvadriljonit
quintillions:
one: kvintiljon
other: kvintiljonit
sextillions:
one: sekstiljon
other: sekstiljonit
septillions:
one: septiljon
other: septiljonit
octillions:
one: oktiljon
other: oktiljonit
nonillions:
one: noniljon
other: noniljonit
decillions:
one: dekiljon
other: dekiljonit
52 changes: 52 additions & 0 deletions lib/numbers_and_words/i18n/locales/numbers.lt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
lt:
numbers:
ones: [nulis, vienas, du, trys, keturi, penki, šeši, septyni, aštuoni, devyni]
teens: [dešimt, vienuolika, dvylika, trylika, keturiolika, penkiolika, šešiolika, septyniolika, aštuoniolika, devyniolika]
tens: [nulis, dešimt, dvidešimt, trisdešimt, keturiasdešimt, penkiasdešimt, šešiasdešimt, septyniasdešimt, aštuoniasdešimt, devyniasdešimt]
mega: [ones, thousands, millions, billions, trillions, quadrillions, quintillion, sextillions, septillions, octillions, nonillions, decillions]
hundreds: [šimtas, du šimtai, trys šimtai, keturi šimtai, penki šimtai, šeši šimtai, septyni šimtai, aštuoni šimtai, devyni šimtai]
one_hundred: šimtas
thousands:
one: tūkstantis
ones: tūkstančiai
other: tūkstančių
millions:
one: milijonas
ones: milijonai
other: milijonø
billions:
one: bilijonas
ones: bilijonai
other: bilijonø
trillions:
one: trilijonas
ones: trilijonai
other: trilijonø
quadrillions:
one: kvadrilijonas
ones: kvadrilijonai
other: kvadrilijonø
quintillions:
one: kvintilijonas
ones: kvadrilijonai
other: kvadrilijonø
sextillions:
one: sekstilijonas
ones: sekstilijonai
other: sekstilijonø
septillions:
one: septilijonas
ones: septilijonai
other: septilijonø
octillions:
one: oktilijonas
ones: oktilijonai
other: oktilijonø
nonillions:
one: nonilijonas
ones: nonilijonai
other: nonilijonø
decillions:
one: decilijonas
ones: decilijonai
other: decilijonø
4 changes: 2 additions & 2 deletions lib/numbers_and_words/i18n/locales/numbers.lv.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
lv:
numbers:
ones: [nulle, viens, divi, trīs, četri, pieci, seši, septiņi, astoņi, deviņi]
teens: [desmit, vienpadsmit, divpadsmit, trīspadsmit, čatrpadsmit, piecpadsmit, sešpadsmit, septiņpadsmit, astoņpadsmit, deviņpadsmit]
teens: [desmit, vienpadsmit, divpadsmit, trīspadsmit, četrpadsmit, piecpadsmit, sešpadsmit, septiņpadsmit, astoņpadsmit, deviņpadsmit]
tens: [nulle, desmit, divdesmit, trīsdesmit, četrdesmit, piecdesmit, sešdesmit, septiņdesmit, astoņdesmit, deviņdesmit]
mega: [ones, thousands, millions, billions, trillions, quadrillions, quintillion, sextillions, septillions, octillions, nonillions, decillions]
hundreds: [simts, divi simti, trīs simti, četri simti, pieci simti, seši simti, septiņi simti, astoņi simti, deviņi simti]
hundreds: [simtu, divi simti, trīs simti, četri simti, pieci simti, seši simti, septiņi simti, astoņi simti, deviņi simti]
one_hundred: simts
thousands:
one: tūkstots
Expand Down
1 change: 1 addition & 0 deletions lib/numbers_and_words/i18n/pluralization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'numbers_and_words/i18n/plurals/fr'
require 'numbers_and_words/i18n/plurals/es'
require 'numbers_and_words/i18n/plurals/lv'
require 'numbers_and_words/i18n/plurals/lt'

module NumbersAndWords
module I18n
Expand Down
24 changes: 24 additions & 0 deletions lib/numbers_and_words/i18n/plurals/lt.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module NumbersAndWords
module I18n
module Plurals
module Lt
RULE = lambda do |n|
one_conditions(n) ?
:one : ones_conditions(n) ?
:ones : :other
end

extend self

def one_conditions n
n % 10 == 1 && n % 100 != 11
end

def ones_conditions n
[2, 3, 4, 5, 6, 7, 8, 9].include?(n % 10) && ![12, 13, 14, 15, 16, 17, 18, 19].include?(n % 100)
end
end
end
end
end

Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
require 'numbers_and_words/strategies/figures_converter/languages/en_gb'
require 'numbers_and_words/strategies/figures_converter/languages/fr'
require 'numbers_and_words/strategies/figures_converter/languages/hu'
require 'numbers_and_words/strategies/figures_converter/languages/et'
require 'numbers_and_words/strategies/figures_converter/languages/se'
require 'numbers_and_words/strategies/figures_converter/languages/it'
require 'numbers_and_words/strategies/figures_converter/languages/nl'
require 'numbers_and_words/strategies/figures_converter/languages/tr'
require 'numbers_and_words/strategies/figures_converter/languages/es'
require 'numbers_and_words/strategies/figures_converter/languages/lv'
require 'numbers_and_words/strategies/figures_converter/languages/lt'
require 'numbers_and_words/strategies/figures_converter/languages/de'

require 'numbers_and_words/strategies/figures_converter/languages/families/cyrillic'
Expand All @@ -35,4 +37,4 @@ def factory strategy
end
end
end
end
end
16 changes: 16 additions & 0 deletions lib/numbers_and_words/strategies/figures_converter/languages/et.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module NumbersAndWords
module Strategies
module FiguresConverter
module Languages
class Et < Base
include Families::Latin

def megs
super({:number => @figures.number_in_capacity(@current_capacity)})
end

end
end
end
end
end
37 changes: 37 additions & 0 deletions lib/numbers_and_words/strategies/figures_converter/languages/lt.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module NumbersAndWords
module Strategies
module FiguresConverter
module Languages
class Lt < Base
include Families::Latin

private

def capacity_iteration
words = []
capacity_words = words_in_capacity(@current_capacity)
words.push(megs) unless capacity_words.empty?
words += capacity_words unless is_a_thousand? and is_a_one?
words
end

def is_a_one?
[translations.ones(1)] == words_in_capacity(@current_capacity)
end

def is_a_thousand?
FiguresArray::THOUSAND_CAPACITY == @current_capacity
end

def hundreds
super({:is_hundred => (figures[1,2] == [0,1] && simple_number_to_words.empty?)})
end

def megs
super({:number => @figures.number_in_capacity(@current_capacity)})
end
end
end
end
end
end
Loading

0 comments on commit c5172bb

Please sign in to comment.