Sha256: e1ad54ba9d51d9820d609872d2b4dd3d51c0faec0a5ff72ee7e53a5344dc8866

Contents?: true

Size: 600 Bytes

Versions: 2

Compression:

Stored size: 600 Bytes

Contents

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

    def self.load_path
      Dir["#{locale_dir}/*.{rb,yml}"]
    end
    
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
magick_columns-0.0.4 lib/magick_columns/i18n.rb
magick_columns-0.0.3 lib/magick_columns/i18n.rb