Class: NumbersAndWords::Translations::Fr

Inherits:
Base
  • Object
show all
Includes:
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 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



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

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

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



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

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

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



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

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