Module: IceCube::I18n

Defined in:
lib/ice_cube/i18n.rb

Constant Summary collapse

LOCALES_PATH =
File.expand_path(File.join("..", "..", "..", "config", "locales"), __FILE__)

Class Method Summary collapse

Class Method Details

.backendObject



15
16
17
# File 'lib/ice_cube/i18n.rb', line 15

def self.backend
  @backend ||= detect_backend!
end

.detect_backend!Object



19
20
21
22
23
24
# File 'lib/ice_cube/i18n.rb', line 19

def self.detect_backend!
  ::I18n.load_path += Dir[File.join(LOCALES_PATH, "*.yml")]
  ::I18n
rescue NameError
  NullI18n
end

.l(*args, **kwargs) ⇒ Object



11
12
13
# File 'lib/ice_cube/i18n.rb', line 11

def self.l(*args, **kwargs)
  backend.l(*args, **kwargs)
end

.t(*args, **kwargs) ⇒ Object



7
8
9
# File 'lib/ice_cube/i18n.rb', line 7

def self.t(*args, **kwargs)
  backend.t(*args, **kwargs)
end