i18n 0.9.5 → 1.8.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +70 -32
  3. data/lib/i18n.rb +95 -36
  4. data/lib/i18n/backend.rb +3 -0
  5. data/lib/i18n/backend/base.rb +53 -23
  6. data/lib/i18n/backend/cache.rb +10 -11
  7. data/lib/i18n/backend/cache_file.rb +36 -0
  8. data/lib/i18n/backend/cascade.rb +3 -1
  9. data/lib/i18n/backend/chain.rb +38 -5
  10. data/lib/i18n/backend/fallbacks.rb +25 -14
  11. data/lib/i18n/backend/flatten.rb +10 -5
  12. data/lib/i18n/backend/gettext.rb +4 -0
  13. data/lib/i18n/backend/interpolation_compiler.rb +3 -1
  14. data/lib/i18n/backend/key_value.rb +31 -2
  15. data/lib/i18n/backend/memoize.rb +10 -2
  16. data/lib/i18n/backend/metadata.rb +5 -3
  17. data/lib/i18n/backend/pluralization.rb +3 -1
  18. data/lib/i18n/backend/simple.rb +26 -10
  19. data/lib/i18n/backend/transliterator.rb +2 -0
  20. data/lib/i18n/config.rb +20 -2
  21. data/lib/i18n/core_ext/hash.rb +54 -24
  22. data/lib/i18n/exceptions.rb +23 -16
  23. data/lib/i18n/gettext.rb +2 -0
  24. data/lib/i18n/gettext/helpers.rb +4 -2
  25. data/lib/i18n/gettext/po_parser.rb +7 -7
  26. data/lib/i18n/interpolate/ruby.rb +6 -4
  27. data/lib/i18n/locale.rb +2 -0
  28. data/lib/i18n/locale/fallbacks.rb +9 -6
  29. data/lib/i18n/locale/tag/parents.rb +8 -6
  30. data/lib/i18n/locale/tag/simple.rb +1 -1
  31. data/lib/i18n/middleware.rb +2 -0
  32. data/lib/i18n/tests.rb +2 -0
  33. data/lib/i18n/tests/interpolation.rb +9 -4
  34. data/lib/i18n/tests/link.rb +11 -1
  35. data/lib/i18n/tests/localization/date.rb +29 -7
  36. data/lib/i18n/tests/localization/date_time.rb +27 -6
  37. data/lib/i18n/tests/localization/procs.rb +6 -5
  38. data/lib/i18n/tests/localization/time.rb +26 -4
  39. data/lib/i18n/tests/lookup.rb +2 -2
  40. data/lib/i18n/tests/procs.rb +5 -0
  41. data/lib/i18n/version.rb +3 -1
  42. metadata +14 -60
  43. data/gemfiles/Gemfile.rails-3.2.x +0 -10
  44. data/gemfiles/Gemfile.rails-4.0.x +0 -10
  45. data/gemfiles/Gemfile.rails-4.1.x +0 -10
  46. data/gemfiles/Gemfile.rails-4.2.x +0 -10
  47. data/gemfiles/Gemfile.rails-5.0.x +0 -10
  48. data/gemfiles/Gemfile.rails-5.1.x +0 -10
  49. data/gemfiles/Gemfile.rails-master +0 -10
  50. data/lib/i18n/core_ext/kernel/suppress_warnings.rb +0 -8
  51. data/lib/i18n/core_ext/string/interpolate.rb +0 -9
  52. data/test/api/all_features_test.rb +0 -58
  53. data/test/api/cascade_test.rb +0 -28
  54. data/test/api/chain_test.rb +0 -24
  55. data/test/api/fallbacks_test.rb +0 -30
  56. data/test/api/key_value_test.rb +0 -24
  57. data/test/api/memoize_test.rb +0 -56
  58. data/test/api/override_test.rb +0 -42
  59. data/test/api/pluralization_test.rb +0 -30
  60. data/test/api/simple_test.rb +0 -28
  61. data/test/backend/cache_test.rb +0 -109
  62. data/test/backend/cascade_test.rb +0 -86
  63. data/test/backend/chain_test.rb +0 -122
  64. data/test/backend/exceptions_test.rb +0 -36
  65. data/test/backend/fallbacks_test.rb +0 -219
  66. data/test/backend/interpolation_compiler_test.rb +0 -118
  67. data/test/backend/key_value_test.rb +0 -61
  68. data/test/backend/memoize_test.rb +0 -79
  69. data/test/backend/metadata_test.rb +0 -48
  70. data/test/backend/pluralization_test.rb +0 -45
  71. data/test/backend/simple_test.rb +0 -103
  72. data/test/backend/transliterator_test.rb +0 -84
  73. data/test/core_ext/hash_test.rb +0 -36
  74. data/test/gettext/api_test.rb +0 -214
  75. data/test/gettext/backend_test.rb +0 -92
  76. data/test/i18n/exceptions_test.rb +0 -117
  77. data/test/i18n/gettext_plural_keys_test.rb +0 -20
  78. data/test/i18n/interpolate_test.rb +0 -91
  79. data/test/i18n/load_path_test.rb +0 -34
  80. data/test/i18n/middleware_test.rb +0 -24
  81. data/test/i18n_test.rb +0 -462
  82. data/test/locale/fallbacks_test.rb +0 -133
  83. data/test/locale/tag/rfc4646_test.rb +0 -143
  84. data/test/locale/tag/simple_test.rb +0 -32
  85. data/test/run_all.rb +0 -20
  86. data/test/test_data/locales/de.po +0 -82
  87. data/test/test_data/locales/en.rb +0 -3
  88. data/test/test_data/locales/en.yml +0 -3
  89. data/test/test_data/locales/invalid/empty.yml +0 -0
  90. data/test/test_data/locales/invalid/syntax.yml +0 -4
  91. data/test/test_data/locales/plurals.rb +0 -113
  92. data/test/test_helper.rb +0 -61
data/test/test_helper.rb DELETED
@@ -1,61 +0,0 @@
1
- $KCODE = 'u' if RUBY_VERSION <= '1.9'
2
-
3
- require 'minitest/autorun'
4
- TEST_CASE = defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase
5
-
6
- # TODO: Remove these aliases and update tests accordingly.
7
- class TEST_CASE
8
- alias :assert_raise :assert_raises
9
- alias :assert_not_equal :refute_equal
10
-
11
- def assert_nothing_raised(*args)
12
- yield
13
- end
14
- end
15
-
16
- require 'bundler/setup'
17
- require 'i18n'
18
- require 'mocha/setup'
19
- require 'test_declarative'
20
-
21
- class I18n::TestCase < TEST_CASE
22
- def self.key_value?
23
- defined?(ActiveSupport)
24
- end
25
-
26
- def setup
27
- super
28
- I18n.enforce_available_locales = false
29
- end
30
-
31
- def teardown
32
- I18n.locale = nil
33
- I18n.default_locale = nil
34
- I18n.load_path = nil
35
- I18n.available_locales = nil
36
- I18n.backend = nil
37
- I18n.default_separator = nil
38
- I18n.enforce_available_locales = true
39
- super
40
- end
41
-
42
- protected
43
-
44
- def translations
45
- I18n.backend.instance_variable_get(:@translations)
46
- end
47
-
48
- def store_translations(locale, data)
49
- I18n.backend.store_translations(locale, data)
50
- end
51
-
52
- def locales_dir
53
- File.dirname(__FILE__) + '/test_data/locales'
54
- end
55
- end
56
-
57
- class DummyRackApp
58
- def call(env)
59
- I18n.locale = :es
60
- end
61
- end