Class: R18n::Locales::Hu

Inherits:
R18n::Locale show all
Defined in:
lib/r18n-core/locales/hu.rb

Overview

Hungarian locale

Instance Attribute Summary

Attributes inherited from R18n::Locale

#code, #downcased_code, #language, #parent, #region

Instance Method Summary collapse

Methods inherited from R18n::Locale

#==, capitalize, exists?, #format_date_full, #format_date_human, #format_date_standard, #format_float, #format_time, #format_time_full, #format_time_human, #format_time_standard, #initialize, #inspect, load, #localize, #ltr?, #month_abbrs, #month_standalone, sanitize_code, set, #strftime, #supported?, #wday_abbrs

Constructor Details

This class inherits a constructor from R18n::Locale

Instance Method Details

#format_integer(integer) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/r18n-core/locales/hu.rb', line 34

def format_integer(integer)
  str = integer.to_s
  str[0] = '' if integer.negative? # Real typographic minus
  group = number_group

  # only group numbers if it has at least 5 digits
  # http://hu.wikisource.org/wiki/A_magyar_helyes%C3%ADr%C3%A1s_szab%C3%A1lyai/Az_%C3%ADr%C3%A1sjelek#274.
  if integer.abs >= 10_000
    str.gsub(/(\d)(?=(\d\d\d)+(?!\d))/) do |match|
      match + group
    end
  else
    str
  end
end

#pluralize(_number) ⇒ Object



30
31
32
# File 'lib/r18n-core/locales/hu.rb', line 30

def pluralize(_number)
  'n'
end