Module: I17n

Defined in:
lib/i17n.rb

Defined Under Namespace

Modules: ControllerAdditive

Class Method Summary collapse

Class Method Details

.method_missing(*args) ⇒ Object



17
18
19
# File 'lib/i17n.rb', line 17

def self.method_missing(*args)
  I18n.send(args[0], *args.drop(1))
end

.t(*args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/i17n.rb', line 3

def self.t(*args)
  if args[0].respond_to?(:model_name)
    if args[1] && args[1].is_a?(Symbol)
      args[0].human_attribute_name(*args.drop(1))
    else
      args[0].model_name.human(*args.drop(1))
    end
  elsif args[0].is_a?(Symbol)
    I18n.t("app.#{args[0]}", *args.drop(1))
  else
    I18n.t(*args)
  end
end