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, #micros

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

#ones, #zero

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

#mega, #megs, #teens, #union, #union_separator

Methods inherited from Base

#t

Instance Method Details

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



23
24
25
26
27
# File 'lib/numbers_and_words/translations/fr.rb', line 23

def hundreds(number, options = {})
  options[:pluralize] = false if options[:pluralize].nil?
  hundreds = t(:hundreds, count: options[:pluralize] ? number : 1)
  number == 1 ? hundreds : [t(:ones)[number], hundreds].join(' ')
end

#micro_prefix(capacity) ⇒ Object



29
30
31
32
33
34
# File 'lib/numbers_and_words/translations/fr.rb', line 29

def micro_prefix(capacity)
  case capacity
  when 2 then t(:hundreds, count: 1)
  when 1 then tens(1)
  end
end

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



9
10
11
12
# File 'lib/numbers_and_words/translations/fr.rb', line 9

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

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



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

def tens_with_ones(numbers, _options = {})
  if [7, 9].include? numbers[1]
    [tens(numbers[1] - 1, alone: false), teens(numbers)].join '-'
  else
    union = numbers[0] == 1 ? ' et ' : '-'
    [tens(numbers[1], alone: false), ones(numbers[0])].join union
  end
end