Class: NumbersAndWords::Translations::Fr

Inherits:
Base
  • Object
show all
Includes:
Extensions::FractionSignificance, NumbersAndWords::Translations::Families::Latin
Defined in:
lib/numbers_and_words/translations/fr.rb

Constant Summary collapse

SPECIAL_TENS_CASE =
8

Constants inherited from Base

Base::I18N_NAMESPACE

Instance Method Summary collapse

Methods included from Extensions::FractionSignificance

#micro, #micro_prefix, #micros

Methods included from NumbersAndWords::Translations::Families::Latin

#ones, #zero

Methods included from NumbersAndWords::Translations::Families::Base

#mega, #megs, #micro_separator, #teens, #union

Methods inherited from Base

#t

Instance Method Details

#hundreds(number, options = {}) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/numbers_and_words/translations/fr.rb', line 24

def hundreds(number, options = {})
  count = options[:pluralize] ? number : 1
  hundreds = t(:hundreds, count: count)

  return hundreds if number == 1

  [t(:ones)[number], hundreds].join(' ')
end

#tens(number, options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/numbers_and_words/translations/fr.rb', line 11

def tens(number, options = {})
  return t(:eighty) if number == SPECIAL_TENS_CASE && options[:alone].nil?

  super number, options
end

#tens_with_ones(numbers, options = {}) ⇒ Object



17
18
19
20
21
22
# File 'lib/numbers_and_words/translations/fr.rb', line 17

def tens_with_ones(numbers, options = {})
  return [tens(numbers[1] - 1, alone: false), teens(numbers)].join('-') if [7, 9].include? numbers[1]

  separator = numbers[0] == 1 ? " #{union} " : '-'
  super numbers, options.merge(separator: separator)
end