Skip to content

Commit

Permalink
Add handling of special orthographic case for twenties in spanish
Browse files Browse the repository at this point in the history
  • Loading branch information
jlduran committed Oct 21, 2013
1 parent 9a51a4b commit 96f6e74
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/numbers_and_words/translations/es.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ def ones number, options = {}
t(:ones)[number]
end

def ones_twenties number, options = {}
t(:ones_twenties)[number]
end

def tens numbers, options = {}
options[:alone] = true if options[:alone].nil?
(numbers == TENS_CASE && options[:alone]) ? t(:twenty) : super(numbers)
end

def tens_with_ones numbers, options = {}
inter = numbers[1] == TENS_CASE ? "" : " y "
[tens(numbers[1], :alone => false), ones(numbers[0])].join inter
ones_number = numbers[1] == TENS_CASE ? ones_twenties(numbers[0]) : ones(numbers[0])
[tens(numbers[1], :alone => false), ones_number].join inter
end

def hundreds number, options = {}
Expand Down

0 comments on commit 96f6e74

Please sign in to comment.