Module: FatFreeCRM::I18n

Defined in:
lib/fat_free_crm/i18n.rb

Instance Method Summary collapse

Instance Method Details

#languagesObject

Return a hash where the key is locale name, and the value is language name as defined in the locale_fat_free_crm.yml file.




44
45
46
# File 'lib/fat_free_crm/i18n.rb', line 44

def languages
  @@languages ||= Hash[ locales.map{ |locale| [ locale, t(:language, :locale => locale) ] } ]
end

#localesObject

Scan config/locales directory for Fat Free CRM localization files (i.e. *_fat_free_crm.yml) and return locale part of the file name.




37
38
39
# File 'lib/fat_free_crm/i18n.rb', line 37

def locales
  @@locales ||= Dir.entries("#{Rails.root}/config/locales").grep(/_fat_free_crm\.yml$/) { |f| f.sub("_fat_free_crm.yml", "") }
end

#t(*args) ⇒ Object




22
23
24
25
26
27
28
29
30
31
32
# File 'lib/fat_free_crm/i18n.rb', line 22

def t(*args)
  if args.size == 1
    super(args.first, :default => args.first.to_s)
  elsif args.second.is_a?(Hash)
    super(*args)
  elsif args.second.is_a?(Fixnum)
    super(args.first, :count => args.second)
  else
    super(args.first, :value => args.second)
  end
end