diff --git a/lib/numbers_and_words/i18n/locales/numbers.es.yml b/lib/numbers_and_words/i18n/locales/numbers.es.yml index 3f5522c6..f3542ddf 100644 --- a/lib/numbers_and_words/i18n/locales/numbers.es.yml +++ b/lib/numbers_and_words/i18n/locales/numbers.es.yml @@ -44,7 +44,7 @@ es: one: septillón other: septillones quattuordecillions: mil septillones - union_separator: con + union: y micro: [_, tenths, hundredths, thousandths, millionths, billionths, trillionths, quadrillionths, quintillionths, sextillionths, septillionths, octillionths, nonillionths, decillionths, undecillionths, duodecillionths, tredecillionths, quattuordecillionths] micro_prefix: tens: diez @@ -100,4 +100,4 @@ es: quattuordecillionths: one: milseptillonésima other: milseptillonésimas - union: y + union_separator: con diff --git a/lib/numbers_and_words/strategies/figures_converter/languages/es.rb b/lib/numbers_and_words/strategies/figures_converter/languages/es.rb index 9cf2e5a7..9a1ebbf9 100644 --- a/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +++ b/lib/numbers_and_words/strategies/figures_converter/languages/es.rb @@ -66,7 +66,7 @@ def hundred_apocopated? def gender @current_capacity ||= 0 - return 'male'.to_sym if @current_capacity >= 2 + return :male if @current_capacity >= 2 @options.gender.result end diff --git a/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb b/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb index 8ff6621b..e4ed3265 100644 --- a/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +++ b/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb @@ -34,7 +34,8 @@ def check_megs_numbers def simple_numbers_condition current_capacity.nil? && - (HUNDRED_TYPE != @type || (HUNDRED_TYPE == @type && simple_number_to_words.empty?)) + (HUNDRED_TYPE != @type || + HUNDRED_TYPE == @type && simple_number_to_words.empty?) end def megs_numbers_condition diff --git a/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb b/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb index 63600efa..01aa0e5c 100644 --- a/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb +++ b/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb @@ -34,7 +34,8 @@ def check_megs_numbers def simple_numbers_condition current_capacity.nil? && - (HUNDRED_TYPE != @type || (HUNDRED_TYPE == @type && simple_number_to_words.empty?)) + (HUNDRED_TYPE != @type || + HUNDRED_TYPE == @type && simple_number_to_words.empty?) end def megs_numbers_condition diff --git a/lib/numbers_and_words/translations/es.rb b/lib/numbers_and_words/translations/es.rb index 6ba99028..28b0572b 100644 --- a/lib/numbers_and_words/translations/es.rb +++ b/lib/numbers_and_words/translations/es.rb @@ -10,7 +10,8 @@ def zero(_options = {}) def ones(number, options = {}) return if options[:is_one_thousand] - return t(%i[ones apocopated].join('.')) if options[:is_apocopated] + return t(%i[ones apocopated].join('.')) if number == 1 && + options[:is_apocopated] t([:ones, options[:gender]].join('.'))[number] end @@ -20,12 +21,9 @@ def twenties_with_ones(numbers, options = {}) end def tens_with_ones(numbers, options = {}) - ones_number = if options[:is_apocopated] && numbers[0] == 1 - t(%i[ones apocopated].join('.')) - else - t([:ones, options[:gender]].join('.'))[numbers[0]] - end - [tens(numbers[1], alone: false), t(:union), ones_number].join(' ') + [tens(numbers[1], alone: false), + t(:union), + ones(numbers[0], options)].join(' ') end def hundreds(number, options = {}) diff --git a/spec/numbers_and_words/integer/fixture_examples/es.yml b/spec/numbers_and_words/integer/fixture_examples/es.yml index 0a6fe1c2..94b2d3c4 100644 --- a/spec/numbers_and_words/integer/fixture_examples/es.yml +++ b/spec/numbers_and_words/integer/fixture_examples/es.yml @@ -97,6 +97,7 @@ to_words: :gender: female 1: una 21: veintiuna + 31: treinta y una 101: ciento una 900: novecientas 999: novecientas noventa y nueve @@ -112,3 +113,8 @@ to_words: 31: treinta y un 100: cien 101: ciento un + female and apocopated form: + options: + :gender: female + :apocopated: true + 901: novecientas un