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



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

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



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

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



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
    separator = numbers[0] == 1 ? " #{union} " : '-'
    [tens(numbers[1], alone: false), ones(numbers[0])].join(separator)
  end
end