Sha256: 40b31356360c445917bfdb6c68408b8f8eab1b4535d3efcc64c4800c19b5883f

Contents?: true

Size: 1.55 KB

Versions: 78

Compression:

Stored size: 1.55 KB

Contents

module I18n
  class ArgumentError < ::ArgumentError; end

  class InvalidLocale < ArgumentError
    attr_reader :locale
    def initialize(locale)
      @locale = locale
      super "#{locale.inspect} is not a valid locale"
    end
  end

  class MissingTranslationData < ArgumentError
    attr_reader :locale, :key, :options
    def initialize(locale, key, options)
      @key, @locale, @options = key, locale, options
      keys = I18n.send(:normalize_translation_keys, locale, key, options[:scope])
      keys << 'no key' if keys.size < 2
      super "translation missing: #{keys.join(', ')}"
    end
  end

  class InvalidPluralizationData < ArgumentError
    attr_reader :entry, :count
    def initialize(entry, count)
      @entry, @count = entry, count
      super "translation data #{entry.inspect} can not be used with :count => #{count}"
    end
  end

  class MissingInterpolationArgument < ArgumentError
    attr_reader :key, :string
    def initialize(key, string)
      @key, @string = key, string
      super "interpolation argument #{key} missing in #{string.inspect}"
    end
  end

  class ReservedInterpolationKey < ArgumentError
    attr_reader :key, :string
    def initialize(key, string)
      @key, @string = key, string
      super "reserved key #{key.inspect} used in #{string.inspect}"
    end
  end

  class UnknownFileType < ArgumentError
    attr_reader :type, :filename
    def initialize(type, filename)
      @type, @filename = type, filename
      super "can not load translations from #{filename}, the file type #{type} is not known"
    end
  end
end

Version data entries

78 entries across 77 versions & 19 rubygems

Version Path
everythingbehind-i18n-0.1.1.1 lib/i18n/exceptions.rb
everythingbehind-i18n-0.1.1 lib/i18n/exceptions.rb
everythingbehind-i18n-0.1.2 lib/i18n/exceptions.rb
everythingbehind-i18n-0.1.3 lib/i18n/exceptions.rb
josevalim-i18n-0.1.2 lib/i18n/exceptions.rb
krasivotokak-russian-0.2.1 lib/vendor/i18n/lib/i18n/exceptions.rb
lawrencepit-i18n-0.1.6 lib/i18n/exceptions.rb
mattetti-i18n-0.1.0 lib/i18n/exceptions.rb
svenfuchs-i18n-0.1.0 lib/i18n/exceptions.rb
svenfuchs-i18n-0.1.1 lib/i18n/exceptions.rb
svenfuchs-i18n-0.1.2 lib/i18n/exceptions.rb
svenfuchs-i18n-0.1.3 lib/i18n/exceptions.rb
yaroslav-russian-0.0.7 lib/vendor/i18n/lib/i18n/exceptions.rb
yaroslav-russian-0.0.8 lib/vendor/i18n/lib/i18n/exceptions.rb
yaroslav-russian-0.0.9 lib/vendor/i18n/lib/i18n/exceptions.rb
yaroslav-russian-0.1.0 lib/vendor/i18n/lib/i18n/exceptions.rb
yaroslav-russian-0.1.1 lib/vendor/i18n/lib/i18n/exceptions.rb
yaroslav-russian-0.1.2 lib/vendor/i18n/lib/i18n/exceptions.rb
yaroslav-russian-0.1.3 lib/vendor/i18n/lib/i18n/exceptions.rb
yaroslav-russian-0.2.0 lib/vendor/i18n/lib/i18n/exceptions.rb