i18n 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of i18n might be problematic. Click here for more details.

Files changed (77) hide show
  1. data/README.textile +44 -9
  2. data/Rakefile +2 -1
  3. data/VERSION +1 -1
  4. data/lib/i18n.rb +60 -15
  5. data/lib/i18n/backend.rb +14 -0
  6. data/lib/i18n/backend/active_record.rb +69 -0
  7. data/lib/i18n/backend/active_record/store_procs.rb +37 -0
  8. data/lib/i18n/backend/active_record/translation.rb +82 -0
  9. data/lib/i18n/backend/active_record_missing.rb +55 -0
  10. data/lib/i18n/backend/base.rb +235 -0
  11. data/lib/i18n/backend/cache.rb +71 -0
  12. data/lib/i18n/backend/chain.rb +74 -0
  13. data/lib/i18n/backend/fallbacks.rb +51 -0
  14. data/lib/i18n/backend/gettext.rb +75 -0
  15. data/lib/i18n/backend/helpers.rb +53 -0
  16. data/lib/i18n/backend/metadata.rb +73 -0
  17. data/lib/i18n/backend/pluralization.rb +57 -0
  18. data/lib/i18n/backend/simple.rb +15 -227
  19. data/lib/i18n/core_ext/object/meta_class.rb +5 -0
  20. data/lib/i18n/{string.rb → core_ext/string/interpolate.rb} +2 -0
  21. data/lib/i18n/exceptions.rb +2 -0
  22. data/lib/i18n/gettext.rb +25 -0
  23. data/lib/i18n/helpers.rb +5 -0
  24. data/lib/i18n/helpers/gettext.rb +64 -0
  25. data/lib/i18n/locale.rb +6 -0
  26. data/lib/i18n/locale/fallbacks.rb +98 -0
  27. data/lib/i18n/locale/tag.rb +28 -0
  28. data/lib/i18n/locale/tag/parents.rb +24 -0
  29. data/lib/i18n/locale/tag/rfc4646.rb +76 -0
  30. data/lib/i18n/locale/tag/simple.rb +41 -0
  31. data/test/all.rb +7 -2
  32. data/test/api/basics.rb +3 -1
  33. data/test/api/interpolation.rb +35 -4
  34. data/test/api/lambda.rb +5 -3
  35. data/test/api/link.rb +4 -2
  36. data/test/api/localization/date.rb +2 -0
  37. data/test/api/localization/date_time.rb +3 -1
  38. data/test/api/localization/lambda.rb +4 -2
  39. data/test/api/localization/time.rb +3 -1
  40. data/test/api/pluralization.rb +12 -15
  41. data/test/api/translation.rb +5 -3
  42. data/test/backend/active_record/active_record_test.rb +40 -0
  43. data/test/backend/active_record/all.rb +3 -0
  44. data/test/backend/active_record/api_test.rb +54 -0
  45. data/test/backend/active_record/setup.rb +166 -0
  46. data/test/backend/active_record_missing/active_record_missing_test.rb +63 -0
  47. data/test/backend/all/api_test.rb +88 -0
  48. data/test/backend/cache/cache_test.rb +69 -0
  49. data/test/backend/chain/api_test.rb +80 -0
  50. data/test/backend/chain/chain_test.rb +64 -0
  51. data/test/backend/fallbacks/api_test.rb +84 -0
  52. data/test/backend/fallbacks/fallbacks_test.rb +57 -0
  53. data/test/backend/metadata/metadata_test.rb +65 -0
  54. data/test/backend/pluralization/api_test.rb +86 -0
  55. data/test/backend/pluralization/pluralization_test.rb +43 -0
  56. data/test/backend/simple/all.rb +2 -0
  57. data/test/backend/simple/api_test.rb +27 -20
  58. data/test/backend/simple/helpers_test.rb +26 -0
  59. data/test/backend/simple/lookup_test.rb +2 -1
  60. data/test/backend/simple/{setup/localization.rb → setup.rb} +29 -11
  61. data/test/backend/simple/translations_test.rb +1 -6
  62. data/test/{string_test.rb → core_ext/string/interpolate_test.rb} +4 -2
  63. data/test/fixtures/locales/de.po +67 -0
  64. data/test/fixtures/locales/en.rb +2 -0
  65. data/test/fixtures/locales/plurals.rb +113 -0
  66. data/test/gettext/api_test.rb +204 -0
  67. data/test/gettext/backend_test.rb +84 -0
  68. data/test/i18n_exceptions_test.rb +3 -1
  69. data/test/i18n_load_path_test.rb +8 -1
  70. data/test/i18n_test.rb +30 -7
  71. data/test/locale/fallbacks_test.rb +128 -0
  72. data/test/locale/tag/rfc4646_test.rb +145 -0
  73. data/test/locale/tag/simple_test.rb +35 -0
  74. data/test/test_helper.rb +11 -5
  75. data/test/with_options.rb +2 -0
  76. metadata +75 -11
  77. data/test/backend/simple/setup/base.rb +0 -21
@@ -0,0 +1,65 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
4
+ require 'i18n/backend/metadata'
5
+
6
+ class I18nTranslationMetadataTest < Test::Unit::TestCase
7
+ class Backend
8
+ include I18n::Backend::Base
9
+ include I18n::Backend::Metadata
10
+ end
11
+
12
+ def setup
13
+ I18n.backend = Backend.new
14
+ backend_store_translations(:en, :foo => 'Hi {{name}}')
15
+ end
16
+
17
+ def translations
18
+ I18n.backend.instance_variable_get(:@translations)
19
+ end
20
+
21
+ def store_metadata(key, name, value)
22
+ translations[:en][key].translation_metadata[name] = value
23
+ end
24
+
25
+ define_method "test: translation strings carry metadata" do
26
+ translation = I18n.t(:foo)
27
+ assert translation.respond_to?(:translation_metadata)
28
+ assert translation.translation_metadata.is_a?(Hash)
29
+ end
30
+
31
+ define_method "test: translate preserves metadata stored on original Strings" do
32
+ store_metadata(:foo, :bar, 'bar')
33
+ assert_equal 'bar', I18n.t(:foo).translation_metadata[:bar]
34
+ end
35
+
36
+ define_method "test: translate preserves metadata stored on original Strings (when interpolated)" do
37
+ store_metadata(:foo, :bar, 'bar')
38
+ assert_equal 'bar', I18n.t(:foo, :name => 'David').translation_metadata[:bar]
39
+ end
40
+
41
+ define_method "test: translate adds the locale to metadata on Strings" do
42
+ assert_equal :en, I18n.t(:foo, :locale => :en).translation_metadata[:locale]
43
+ end
44
+
45
+ define_method "test: translate adds the key to metadata on Strings" do
46
+ assert_equal :foo, I18n.t(:foo).translation_metadata[:key]
47
+ end
48
+
49
+ define_method "test: translate adds the default to metadata on Strings" do
50
+ assert_equal 'bar', I18n.t(:foo, :default => 'bar').translation_metadata[:default]
51
+ end
52
+
53
+ define_method "test: translation adds the interpolation values to metadata on Strings" do
54
+ assert_equal({:name => 'David'}, I18n.t(:foo, :name => 'David').translation_metadata[:values])
55
+ end
56
+
57
+ define_method "test: interpolation adds the original string to metadata on Strings" do
58
+ assert_equal('Hi {{name}}', I18n.t(:foo, :name => 'David').translation_metadata[:original])
59
+ end
60
+
61
+ define_method "test: pluralizatoin adds the count to metadata on Strings" do
62
+ assert_equal(1, I18n.t(:missing, :count => 1, :default => { :one => 'foo' }).translation_metadata[:count])
63
+ end
64
+ end
65
+
@@ -0,0 +1,86 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
4
+ require 'i18n/backend/pluralization'
5
+
6
+ module PluralizationSetup
7
+ class Backend
8
+ include I18n::Backend::Base
9
+ include I18n::Backend::Pluralization
10
+ end
11
+
12
+ def setup
13
+ I18n.backend = Backend.new
14
+ super
15
+ I18n.load_path << locales_dir + '/plurals.rb'
16
+ end
17
+
18
+ def test_uses_pluralization
19
+ assert I18n.backend.class.included_modules.include?(I18n::Backend::Pluralization)
20
+ end
21
+ end
22
+
23
+ class I18nPluralizationBackendApiBasicsTest < Test::Unit::TestCase
24
+ include PluralizationSetup
25
+ include Tests::Backend::Api::Basics
26
+ end
27
+
28
+ class I18nPluralizationBackendApiTranslateTest < Test::Unit::TestCase
29
+ include Tests::Backend::Simple::Setup::Base
30
+ include PluralizationSetup
31
+ include Tests::Backend::Api::Translation
32
+ end
33
+
34
+ class I18nPluralizationBackendApiInterpolateTest < Test::Unit::TestCase
35
+ include Tests::Backend::Simple::Setup::Base
36
+ include PluralizationSetup
37
+ include Tests::Backend::Api::Interpolation
38
+ end
39
+
40
+ class I18nPluralizationBackendApiLambdaTest < Test::Unit::TestCase
41
+ include Tests::Backend::Simple::Setup::Base
42
+ include PluralizationSetup
43
+ include Tests::Backend::Api::Lambda
44
+ end
45
+
46
+ class I18nPluralizationBackendApiTranslateLinkedTest < Test::Unit::TestCase
47
+ include Tests::Backend::Simple::Setup::Base
48
+ include PluralizationSetup
49
+ include Tests::Backend::Api::Link
50
+ end
51
+
52
+ class I18nPluralizationBackendApiPluralizeTest < Test::Unit::TestCase
53
+ include Tests::Backend::Simple::Setup::Base
54
+ include Tests::Backend::Simple::Setup::Localization
55
+ include PluralizationSetup
56
+ include Tests::Backend::Api::Pluralization
57
+ end
58
+
59
+ class I18nPluralizationBackendApiLocalizeDateTest < Test::Unit::TestCase
60
+ include Tests::Backend::Simple::Setup::Base
61
+ include Tests::Backend::Simple::Setup::Localization
62
+ include PluralizationSetup
63
+ include Tests::Backend::Api::Localization::Date
64
+ end
65
+
66
+ class I18nPluralizationBackendApiLocalizeDateTimeTest < Test::Unit::TestCase
67
+ include Tests::Backend::Simple::Setup::Base
68
+ include Tests::Backend::Simple::Setup::Localization
69
+ include PluralizationSetup
70
+ include Tests::Backend::Api::Localization::DateTime
71
+ end
72
+
73
+ class I18nPluralizationBackendApiLocalizeTimeTest < Test::Unit::TestCase
74
+ include Tests::Backend::Simple::Setup::Base
75
+ include Tests::Backend::Simple::Setup::Localization
76
+ include PluralizationSetup
77
+ include Tests::Backend::Api::Localization::Time
78
+ end
79
+
80
+ class I18nPluralizationBackendApiLocalizeLambdaTest < Test::Unit::TestCase
81
+ include Tests::Backend::Simple::Setup::Base
82
+ include Tests::Backend::Simple::Setup::Localization
83
+ include PluralizationSetup
84
+ include Tests::Backend::Api::Localization::Lambda
85
+ end
86
+
@@ -0,0 +1,43 @@
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
4
+ require 'i18n/backend/pluralization'
5
+
6
+ class I18nPluralizationBackendTest < Test::Unit::TestCase
7
+ class Backend
8
+ include I18n::Backend::Base
9
+ include I18n::Backend::Pluralization
10
+ end
11
+
12
+ def setup
13
+ I18n.backend = Backend.new
14
+ @pluralizer = lambda { |n| n == 1 ? :one : n == 0 || (2..10).include?(n % 100) ? :few : (11..19).include?(n % 100) ? :many : :other }
15
+ backend_store_translations(:foo, :i18n => { :plural => { :rule => @pluralizer } })
16
+ @entry = { :zero => 'zero', :one => 'one', :few => 'few', :many => 'many', :other => 'other' }
17
+ end
18
+
19
+ define_method :"test: pluralization picks a pluralizer from :'i18n.pluralize'" do
20
+ assert_equal @pluralizer, I18n.backend.send(:pluralizer, :foo)
21
+ end
22
+
23
+ define_method :"test: pluralization picks :one for 1" do
24
+ assert_equal 'one', I18n.t(:count => 1, :default => @entry, :locale => :foo)
25
+ end
26
+
27
+ define_method :"test: pluralization picks :few for 2" do
28
+ assert_equal 'few', I18n.t(:count => 2, :default => @entry, :locale => :foo)
29
+ end
30
+
31
+ define_method :"test: pluralization picks :many for 11" do
32
+ assert_equal 'many', I18n.t(:count => 11, :default => @entry, :locale => :foo)
33
+ end
34
+
35
+ define_method :"test: pluralization picks zero for 0 if the key is contained in the data" do
36
+ assert_equal 'zero', I18n.t(:count => 0, :default => @entry, :locale => :foo)
37
+ end
38
+
39
+ define_method :"test: pluralization picks few for 0 if the key is not contained in the data" do
40
+ @entry.delete(:zero)
41
+ assert_equal 'few', I18n.t(:count => 0, :default => @entry, :locale => :foo)
42
+ end
43
+ end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  Dir[File.dirname(__FILE__) + '/*_test.rb'].each do |file|
2
4
  require file
3
5
  end
@@ -1,44 +1,51 @@
1
1
  # encoding: utf-8
2
+
2
3
  require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
3
4
 
4
- class I18nSimpleBackendApiTest < Test::Unit::TestCase
5
+ class I18nSimpleBackendApiBasicsTest < Test::Unit::TestCase
5
6
  include Tests::Backend::Simple::Setup::Base
6
7
  include Tests::Backend::Api::Basics
8
+
9
+ def test_uses_simple_backend
10
+ assert_equal I18n::Backend::Simple, I18n.backend.class
11
+ end
7
12
  end
8
13
 
9
- class I18nSimpleBackendTranslateTest < Test::Unit::TestCase
14
+ require 'i18n/backend/fallbacks'
15
+
16
+ class I18nSimpleBackendApiTranslateTest < Test::Unit::TestCase
10
17
  include Tests::Backend::Simple::Setup::Base
11
18
  include Tests::Backend::Api::Translation
12
19
 
13
20
  # implementation specific tests
14
-
21
+
15
22
  def test_translate_calls_lookup_with_locale_given
16
- I18n.backend.expects(:lookup).with('de', :bar, [:foo], nil).returns 'bar'
17
- I18n.backend.translate 'de', :bar, :scope => [:foo]
23
+ I18n.backend.expects(:lookup).with(:de, :bar, [:foo], nil).returns 'bar'
24
+ I18n.backend.translate :de, :bar, :scope => [:foo]
18
25
  end
19
26
 
20
27
  def test_translate_calls_pluralize
21
- I18n.backend.expects(:pluralize).with 'en', 'bar', 1
22
- I18n.backend.translate 'en', :bar, :scope => [:foo], :count => 1
28
+ I18n.backend.expects(:pluralize).with(:en, 'bar', 1).returns 'bar'
29
+ I18n.backend.translate :en, :bar, :scope => [:foo], :count => 1
23
30
  end
24
31
 
25
32
  def test_translate_calls_interpolate
26
- I18n.backend.expects(:interpolate).with 'en', 'bar', {}
27
- I18n.backend.translate 'en', :bar, :scope => [:foo]
33
+ I18n.backend.expects(:interpolate).with(:en, 'bar', {}).returns 'bar'
34
+ I18n.backend.translate :en, :bar, :scope => [:foo]
28
35
  end
29
36
 
30
37
  def test_translate_calls_interpolate_including_count_as_a_value
31
- I18n.backend.expects(:interpolate).with 'en', 'bar', {:count => 1}
32
- I18n.backend.translate 'en', :bar, :scope => [:foo], :count => 1
38
+ I18n.backend.expects(:interpolate).with(:en, 'bar', {:count => 1}).returns 'bar'
39
+ I18n.backend.translate :en, :bar, :scope => [:foo], :count => 1
33
40
  end
34
41
  end
35
42
 
36
- class I18nSimpleBackendInterpolateTest < Test::Unit::TestCase
43
+ class I18nSimpleBackendApiInterpolateTest < Test::Unit::TestCase
37
44
  include Tests::Backend::Simple::Setup::Base
38
45
  include Tests::Backend::Api::Interpolation
39
46
 
40
47
  # implementation specific tests
41
-
48
+
42
49
  def test_interpolate_given_nil_as_a_string_returns_nil
43
50
  assert_nil I18n.backend.send(:interpolate, nil, nil, :name => 'David')
44
51
  end
@@ -48,37 +55,37 @@ class I18nSimpleBackendInterpolateTest < Test::Unit::TestCase
48
55
  end
49
56
  end
50
57
 
51
- class I18nSimpleBackendLambdaTest < Test::Unit::TestCase
58
+ class I18nSimpleBackendApiLambdaTest < Test::Unit::TestCase
52
59
  include Tests::Backend::Simple::Setup::Base
53
60
  include Tests::Backend::Api::Lambda
54
61
  end
55
62
 
56
- class I18nSimpleBackendTranslateLinkedTest < Test::Unit::TestCase
63
+ class I18nSimpleBackendApiTranslateLinkedTest < Test::Unit::TestCase
57
64
  include Tests::Backend::Simple::Setup::Base
58
65
  include Tests::Backend::Api::Link
59
66
  end
60
67
 
61
- class I18nSimpleBackendPluralizationTest < Test::Unit::TestCase
68
+ class I18nSimpleBackendApiPluralizationTest < Test::Unit::TestCase
62
69
  include Tests::Backend::Simple::Setup::Base
63
70
  include Tests::Backend::Api::Pluralization
64
71
  end
65
72
 
66
- class I18nSimpleBackendLocalizeDateTest < Test::Unit::TestCase
73
+ class I18nSimpleBackendApiLocalizeDateTest < Test::Unit::TestCase
67
74
  include Tests::Backend::Simple::Setup::Localization
68
75
  include Tests::Backend::Api::Localization::Date
69
76
  end
70
77
 
71
- class I18nSimpleBackendLocalizeDateTimeTest < Test::Unit::TestCase
78
+ class I18nSimpleBackendApiLocalizeDateTimeTest < Test::Unit::TestCase
72
79
  include Tests::Backend::Simple::Setup::Localization
73
80
  include Tests::Backend::Api::Localization::DateTime
74
81
  end
75
82
 
76
- class I18nSimpleBackendLocalizeTimeTest < Test::Unit::TestCase
83
+ class I18nSimpleBackendApiLocalizeTimeTest < Test::Unit::TestCase
77
84
  include Tests::Backend::Simple::Setup::Localization
78
85
  include Tests::Backend::Api::Localization::Time
79
86
  end
80
87
 
81
- class I18nSimpleBackendLocalizeLambdaTest < Test::Unit::TestCase
88
+ class I18nSimpleBackendApiLocalizeLambdaTest < Test::Unit::TestCase
82
89
  include Tests::Backend::Simple::Setup::Localization
83
90
  include Tests::Backend::Api::Localization::Lambda
84
91
  end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
3
+
4
+ class I18nBackendHelpersHashWindKeysTest < Test::Unit::TestCase
5
+ def setup
6
+ @backend = I18n::Backend::Simple.new
7
+ end
8
+
9
+ def test_wind_keys
10
+ hash = { "a" => { "b" => { "c" => "d", "e" => "f" }, "g" => "h" }, "i" => "j"}
11
+ expected = { "a.b.c" => "d", "a.b.e" => "f", "a.g" => "h", "i" => "j" }
12
+ assert_equal expected, @backend.wind_keys(hash)
13
+ end
14
+
15
+ def test_unwind_keys
16
+ hash = { "a.b.c" => "d", "a.b.e" => "f", "a.g" => "h", "i" => "j" }
17
+ expected = { "a" => { "b" => { "c" => "d", "e" => "f" }, "g" => "h" }, "i" => "j"}
18
+ assert_equal expected, @backend.unwind_keys(hash)
19
+ end
20
+
21
+ def test_deep_symbolize_keys
22
+ result = @backend.deep_symbolize_keys('foo' => { 'bar' => { 'baz' => 'bar' } })
23
+ expected = {:foo => {:bar => {:baz => 'bar'}}}
24
+ assert_equal expected, result
25
+ end
26
+ end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
3
4
 
4
5
  class I18nSimpleBackendLookupTest < Test::Unit::TestCase
@@ -20,4 +21,4 @@ class I18nSimpleBackendLookupTest < Test::Unit::TestCase
20
21
  def test_default_using_a_custom_separator
21
22
  assert_equal 'bar', I18n.backend.send(:default, :en, :'does_not_exist', :'foo|bar', :separator => '|')
22
23
  end
23
- end
24
+ end
@@ -1,7 +1,25 @@
1
+ # encoding: utf-8
2
+
1
3
  module Tests
2
4
  module Backend
3
5
  module Simple
4
6
  module Setup
7
+ module Base
8
+ def setup
9
+ super
10
+ I18n.backend ||= I18n::Backend::Simple.new
11
+ backend_store_translations(:en, :foo => { :bar => 'bar', :baz => 'baz' })
12
+ end
13
+
14
+ def teardown
15
+ super
16
+ I18n.locale = nil
17
+ I18n.default_locale = :en
18
+ I18n.load_path = []
19
+ I18n.backend = nil
20
+ end
21
+ end
22
+
5
23
  module Localization
6
24
  include Base
7
25
 
@@ -11,12 +29,12 @@ module Tests
11
29
  setup_datetime_lambda_translations
12
30
  @old_timezone, ENV['TZ'] = ENV['TZ'], 'UTC'
13
31
  end
14
-
32
+
15
33
  def teardown
16
34
  super
17
35
  @old_timezone ? ENV['TZ'] = @old_timezone : ENV.delete('TZ')
18
36
  end
19
-
37
+
20
38
  def setup_datetime_translations
21
39
  backend_store_translations :de, {
22
40
  :date => {
@@ -99,19 +117,19 @@ module Tests
99
117
  def setup_datetime_lambda_translations
100
118
  backend_store_translations 'ru', {
101
119
  :date => {
102
- :'day_names' => lambda { |key, options|
103
- (options[:format] =~ /^%A/) ?
104
- %w(Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота) :
120
+ :'day_names' => lambda { |key, options|
121
+ (options[:format] =~ /^%A/) ?
122
+ %w(Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота) :
105
123
  %w(воскресенье понедельник вторник среда четверг пятница суббота)
106
124
  },
107
125
  :'abbr_day_names' => %w(Вс Пн Вт Ср Чт Пт Сб),
108
- :'month_names' => lambda { |key, options|
109
- (options[:format] =~ /(%d|%e)(\s*)?(%B)/) ?
126
+ :'month_names' => lambda { |key, options|
127
+ (options[:format] =~ /(%d|%e)(\s*)?(%B)/) ?
110
128
  %w(января февраля марта апреля мая июня июля августа сентября октября ноября декабря).unshift(nil) :
111
- %w(Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь).unshift(nil)
129
+ %w(Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь).unshift(nil)
112
130
  },
113
- :'abbr_month_names' => lambda { |key, options|
114
- (options[:format] =~ /(%d|%e)(\s*)(%b)/) ?
131
+ :'abbr_month_names' => lambda { |key, options|
132
+ (options[:format] =~ /(%d|%e)(\s*)(%b)/) ?
115
133
  %w(янв. февр. марта апр. мая июня июля авг. сент. окт. нояб. дек.).unshift(nil) :
116
134
  %w(янв. февр. март апр. май июнь июль авг. сент. окт. нояб. дек.).unshift(nil)
117
135
  },
@@ -126,4 +144,4 @@ module Tests
126
144
  end
127
145
  end
128
146
  end
129
- end
147
+ end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+
2
3
  require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
3
4
 
4
5
  class I18nSimpleBackendLoadTranslationsTest < Test::Unit::TestCase
@@ -54,12 +55,6 @@ class I18nSimpleBackendStoreTranslationsTest < Test::Unit::TestCase
54
55
  I18n.backend.store_translations 'en', 'foo' => {'bar' => 'bar', 'baz' => 'baz'}
55
56
  assert_equal Hash[:'en', {:foo => {:bar => 'bar', :baz => 'baz'}}], backend_get_translations
56
57
  end
57
-
58
- def test_deep_symbolize_keys_works
59
- result = I18n.backend.send :deep_symbolize_keys, 'foo' => {'bar' => {'baz' => 'bar'}}
60
- expected = {:foo => {:bar => {:baz => 'bar'}}}
61
- assert_equal expected, result
62
- end
63
58
  end
64
59
 
65
60
  class I18nSimpleBackendReloadTranslationsTest < Test::Unit::TestCase
@@ -1,11 +1,13 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/test_helper')
1
+ # encoding: utf-8
2
+
3
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
4
 
3
5
  # thanks to Masao's String extensions these should work the same in
4
6
  # Ruby 1.8 (patched) and Ruby 1.9 (native)
5
7
  # some tests taken from Masao's tests
6
8
  # http://github.com/mutoh/gettext/blob/edbbe1fa8238fa12c7f26f2418403015f0270e47/test/test_string.rb
7
9
 
8
- class I18nStringTest < Test::Unit::TestCase
10
+ class I18nCoreExtStringInterpolationTest < Test::Unit::TestCase
9
11
  define_method :"test: String interpolates a single argument" do
10
12
  assert_equal "Masao", "%s" % "Masao"
11
13
  end