Module: MagickColumns::I18n

Defined in:
lib/magick_columns/i18n.rb

Class Method Summary collapse

Class Method Details

.load_pathObject



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

def self.load_path
  Dir["#{locale_dir}/*.{rb,yml}"]
end

.locale_dirObject



3
4
5
# File 'lib/magick_columns/i18n.rb', line 3

def self.locale_dir
  File.expand_path('../locales', __FILE__)
end

.magick_translate(keys, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/magick_columns/i18n.rb', line 11

def self.magick_translate(keys, options = {})
  if defined? ::I18n
    defaults = Array(keys).dup
    defaults << Proc.new if block_given?
    ::I18n.translate(
      defaults.shift,
      options.merge(default: defaults, scope: :magick_columns, raise: true)
    )
  else
    key = Array === keys ? keys.first : keys
    yield key, options
  end
end