Module: Snippr::I18n

Defined in:
lib/snippr/i18n.rb

Class Method Summary collapse

Class Method Details

.enabled=(enabled) ⇒ Object

Sets whether to use I18n snippr files.



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

def self.enabled=(enabled)
  @@enabled = enabled
end

.enabled?Boolean

Returns whether to use I18n snippr files.

Returns:

  • (Boolean)


10
11
12
# File 'lib/snippr/i18n.rb', line 10

def self.enabled?
  !!@@enabled
end

.locale(enabled = nil) ⇒ Object

Returns the current locale prefixed with a “_” from I18n if I18n is enabled. Otherwise defaults to an empty String.



21
22
23
# File 'lib/snippr/i18n.rb', line 21

def self.locale(enabled=nil)
  (enabled.nil? ? enabled? : enabled) ? "_#{::I18n.locale}" : ''
end