~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n/exceptions.rb

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
module I18n
2
 
  class ArgumentError < ::ArgumentError; end
3
 
 
4
 
  class InvalidLocale < ArgumentError
5
 
    attr_reader :locale
6
 
    def initialize(locale)
7
 
      @locale = locale
8
 
      super "#{locale.inspect} is not a valid locale"
9
 
    end
10
 
  end
11
 
 
12
 
  class MissingTranslationData < ArgumentError
13
 
    attr_reader :locale, :key, :options
14
 
    def initialize(locale, key, options)
15
 
      @key, @locale, @options = key, locale, options
16
 
      keys = I18n.send(:normalize_translation_keys, locale, key, options[:scope])
17
 
      keys << 'no key' if keys.size < 2
18
 
      super "translation missing: #{keys.join(', ')}"
19
 
    end
20
 
  end
21
 
 
22
 
  class InvalidPluralizationData < ArgumentError
23
 
    attr_reader :entry, :count
24
 
    def initialize(entry, count)
25
 
      @entry, @count = entry, count
26
 
      super "translation data #{entry.inspect} can not be used with :count => #{count}"
27
 
    end
28
 
  end
29
 
 
30
 
  class MissingInterpolationArgument < ArgumentError
31
 
    attr_reader :key, :string
32
 
    def initialize(key, string)
33
 
      @key, @string = key, string
34
 
      super "interpolation argument #{key} missing in #{string.inspect}"
35
 
    end
36
 
  end
37
 
 
38
 
  class ReservedInterpolationKey < ArgumentError
39
 
    attr_reader :key, :string
40
 
    def initialize(key, string)
41
 
      @key, @string = key, string
42
 
      super "reserved key #{key.inspect} used in #{string.inspect}"
43
 
    end
44
 
  end
45
 
 
46
 
  class UnknownFileType < ArgumentError
47
 
    attr_reader :type, :filename
48
 
    def initialize(type, filename)
49
 
      @type, @filename = type, filename
50
 
      super "can not load translations from #{filename}, the file type #{type} is not known"
51
 
    end
52
 
  end
53
 
end
 
 
b'\\ No newline at end of file'