i18n 0.5.0 → 0.5.2
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.
- data/CHANGELOG.textile +3 -12
- data/README.textile +17 -4
- data/lib/i18n.rb +37 -5
- data/lib/i18n/backend.rb +1 -0
- data/lib/i18n/backend/base.rb +32 -4
- data/lib/i18n/backend/cldr.rb +99 -0
- data/lib/i18n/backend/gettext.rb +3 -3
- data/lib/i18n/backend/interpolation_compiler.rb +1 -1
- data/lib/i18n/backend/metadata.rb +1 -1
- data/lib/i18n/config.rb +13 -1
- data/lib/i18n/core_ext/string/interpolate.rb +0 -9
- data/lib/i18n/exceptions.rb +31 -3
- data/lib/i18n/locale/fallbacks.rb +3 -3
- data/lib/i18n/tests/localization/procs.rb +24 -25
- data/lib/i18n/version.rb +1 -1
- metadata +16 -121
- data/ci/Gemfile.no-rails +0 -5
- data/ci/Gemfile.no-rails.lock +0 -14
- data/ci/Gemfile.rails-2.3.x +0 -9
- data/ci/Gemfile.rails-2.3.x.lock +0 -23
- data/ci/Gemfile.rails-3.x +0 -9
- data/ci/Gemfile.rails-3.x.lock +0 -23
- data/lib/i18n/core_ext/kernel/surpress_warnings.rb +0 -9
- data/lib/i18n/interpolate/ruby.rb +0 -31
- data/test/all.rb +0 -8
- data/test/api/all_features_test.rb +0 -58
- data/test/api/cascade_test.rb +0 -28
- data/test/api/chain_test.rb +0 -24
- data/test/api/fallbacks_test.rb +0 -30
- data/test/api/key_value_test.rb +0 -28
- data/test/api/memoize_test.rb +0 -60
- data/test/api/pluralization_test.rb +0 -30
- data/test/api/simple_test.rb +0 -28
- data/test/backend/cache_test.rb +0 -83
- data/test/backend/cascade_test.rb +0 -85
- data/test/backend/chain_test.rb +0 -67
- data/test/backend/exceptions_test.rb +0 -23
- data/test/backend/fallbacks_test.rb +0 -116
- data/test/backend/interpolation_compiler_test.rb +0 -102
- data/test/backend/key_value_test.rb +0 -46
- data/test/backend/memoize_test.rb +0 -47
- data/test/backend/metadata_test.rb +0 -67
- data/test/backend/pluralization_test.rb +0 -44
- data/test/backend/simple_test.rb +0 -79
- data/test/backend/transliterator_test.rb +0 -81
- data/test/core_ext/hash_test.rb +0 -30
- data/test/core_ext/string/interpolate_test.rb +0 -99
- data/test/gettext/api_test.rb +0 -206
- data/test/gettext/backend_test.rb +0 -93
- data/test/i18n/exceptions_test.rb +0 -116
- data/test/i18n/interpolate_test.rb +0 -61
- data/test/i18n/load_path_test.rb +0 -26
- data/test/i18n_test.rb +0 -236
- data/test/locale/fallbacks_test.rb +0 -124
- data/test/locale/tag/rfc4646_test.rb +0 -142
- data/test/locale/tag/simple_test.rb +0 -32
- data/test/run_all.rb +0 -21
- data/test/test_data/locales/de.po +0 -72
- data/test/test_data/locales/en.rb +0 -3
- data/test/test_data/locales/en.yml +0 -3
- data/test/test_data/locales/invalid/empty.yml +0 -1
- data/test/test_data/locales/plurals.rb +0 -113
- data/test/test_helper.rb +0 -56
data/test/all.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'rubygems'
|
5
|
-
require 'active_support'
|
6
|
-
rescue LoadError
|
7
|
-
puts "not testing with Cache enabled because active_support can not be found"
|
8
|
-
end
|
9
|
-
|
10
|
-
class I18nAllFeaturesApiTest < Test::Unit::TestCase
|
11
|
-
class Backend < I18n::Backend::Simple
|
12
|
-
include I18n::Backend::Metadata
|
13
|
-
include I18n::Backend::Cache
|
14
|
-
include I18n::Backend::Cascade
|
15
|
-
include I18n::Backend::Fallbacks
|
16
|
-
include I18n::Backend::Pluralization
|
17
|
-
include I18n::Backend::Memoize
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup
|
21
|
-
I18n.backend = I18n::Backend::Chain.new(Backend.new, I18n::Backend::Simple.new)
|
22
|
-
I18n.cache_store = cache_store
|
23
|
-
super
|
24
|
-
end
|
25
|
-
|
26
|
-
def teardown
|
27
|
-
I18n.cache_store.clear if I18n.cache_store
|
28
|
-
I18n.cache_store = nil
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
def cache_store
|
33
|
-
ActiveSupport::Cache.lookup_store(:memory_store) if cache_available?
|
34
|
-
end
|
35
|
-
|
36
|
-
def cache_available?
|
37
|
-
defined?(ActiveSupport) && defined?(ActiveSupport::Cache)
|
38
|
-
end
|
39
|
-
|
40
|
-
include I18n::Tests::Basics
|
41
|
-
include I18n::Tests::Defaults
|
42
|
-
include I18n::Tests::Interpolation
|
43
|
-
include I18n::Tests::Link
|
44
|
-
include I18n::Tests::Lookup
|
45
|
-
include I18n::Tests::Pluralization
|
46
|
-
include I18n::Tests::Procs
|
47
|
-
include I18n::Tests::Localization::Date
|
48
|
-
include I18n::Tests::Localization::DateTime
|
49
|
-
include I18n::Tests::Localization::Time
|
50
|
-
include I18n::Tests::Localization::Procs
|
51
|
-
|
52
|
-
test "make sure we use a Chain backend with an all features backend" do
|
53
|
-
assert_equal I18n::Backend::Chain, I18n.backend.class
|
54
|
-
assert_equal Backend, I18n.backend.backends.first.class
|
55
|
-
end
|
56
|
-
|
57
|
-
# links: test that keys stored on one backend can link to keys stored on another backend
|
58
|
-
end
|
data/test/api/cascade_test.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nCascadeApiTest < Test::Unit::TestCase
|
4
|
-
class Backend < I18n::Backend::Simple
|
5
|
-
include I18n::Backend::Cascade
|
6
|
-
end
|
7
|
-
|
8
|
-
def setup
|
9
|
-
I18n.backend = Backend.new
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
include I18n::Tests::Basics
|
14
|
-
include I18n::Tests::Defaults
|
15
|
-
include I18n::Tests::Interpolation
|
16
|
-
include I18n::Tests::Link
|
17
|
-
include I18n::Tests::Lookup
|
18
|
-
include I18n::Tests::Pluralization
|
19
|
-
include I18n::Tests::Procs
|
20
|
-
include I18n::Tests::Localization::Date
|
21
|
-
include I18n::Tests::Localization::DateTime
|
22
|
-
include I18n::Tests::Localization::Time
|
23
|
-
include I18n::Tests::Localization::Procs
|
24
|
-
|
25
|
-
test "make sure we use a backend with Cascade included" do
|
26
|
-
assert_equal Backend, I18n.backend.class
|
27
|
-
end
|
28
|
-
end
|
data/test/api/chain_test.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nApiChainTest < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
super
|
6
|
-
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
|
7
|
-
end
|
8
|
-
|
9
|
-
include I18n::Tests::Basics
|
10
|
-
include I18n::Tests::Defaults
|
11
|
-
include I18n::Tests::Interpolation
|
12
|
-
include I18n::Tests::Link
|
13
|
-
include I18n::Tests::Lookup
|
14
|
-
include I18n::Tests::Pluralization
|
15
|
-
include I18n::Tests::Procs
|
16
|
-
include I18n::Tests::Localization::Date
|
17
|
-
include I18n::Tests::Localization::DateTime
|
18
|
-
include I18n::Tests::Localization::Time
|
19
|
-
include I18n::Tests::Localization::Procs
|
20
|
-
|
21
|
-
test "make sure we use the Chain backend" do
|
22
|
-
assert_equal I18n::Backend::Chain, I18n.backend.class
|
23
|
-
end
|
24
|
-
end
|
data/test/api/fallbacks_test.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nFallbacksApiTest < Test::Unit::TestCase
|
4
|
-
class Backend < I18n::Backend::Simple
|
5
|
-
include I18n::Backend::Fallbacks
|
6
|
-
end
|
7
|
-
|
8
|
-
def setup
|
9
|
-
I18n.backend = Backend.new
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
include I18n::Tests::Basics
|
14
|
-
include I18n::Tests::Defaults
|
15
|
-
include I18n::Tests::Interpolation
|
16
|
-
include I18n::Tests::Link
|
17
|
-
include I18n::Tests::Lookup
|
18
|
-
include I18n::Tests::Pluralization
|
19
|
-
include I18n::Tests::Procs
|
20
|
-
include I18n::Tests::Localization::Date
|
21
|
-
include I18n::Tests::Localization::DateTime
|
22
|
-
include I18n::Tests::Localization::Time
|
23
|
-
include I18n::Tests::Localization::Procs
|
24
|
-
|
25
|
-
test "make sure we use a backend with Fallbacks included" do
|
26
|
-
assert_equal Backend, I18n.backend.class
|
27
|
-
end
|
28
|
-
|
29
|
-
# links: test that keys stored on one backend can link to keys stored on another backend
|
30
|
-
end
|
data/test/api/key_value_test.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
I18n::Tests.setup_rufus_tokyo
|
4
|
-
|
5
|
-
class I18nKeyValueApiTest < Test::Unit::TestCase
|
6
|
-
include I18n::Tests::Basics
|
7
|
-
include I18n::Tests::Defaults
|
8
|
-
include I18n::Tests::Interpolation
|
9
|
-
include I18n::Tests::Link
|
10
|
-
include I18n::Tests::Lookup
|
11
|
-
include I18n::Tests::Pluralization
|
12
|
-
# include Tests::Api::Procs
|
13
|
-
include I18n::Tests::Localization::Date
|
14
|
-
include I18n::Tests::Localization::DateTime
|
15
|
-
include I18n::Tests::Localization::Time
|
16
|
-
# include Tests::Api::Localization::Procs
|
17
|
-
|
18
|
-
STORE = Rufus::Tokyo::Cabinet.new('*')
|
19
|
-
|
20
|
-
def setup
|
21
|
-
I18n.backend = I18n::Backend::KeyValue.new(STORE)
|
22
|
-
super
|
23
|
-
end
|
24
|
-
|
25
|
-
test "make sure we use the KeyValue backend" do
|
26
|
-
assert_equal I18n::Backend::KeyValue, I18n.backend.class
|
27
|
-
end
|
28
|
-
end if defined?(Rufus::Tokyo::Cabinet)
|
data/test/api/memoize_test.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nMemoizeBackendWithSimpleApiTest < Test::Unit::TestCase
|
4
|
-
include I18n::Tests::Basics
|
5
|
-
include I18n::Tests::Defaults
|
6
|
-
include I18n::Tests::Interpolation
|
7
|
-
include I18n::Tests::Link
|
8
|
-
include I18n::Tests::Lookup
|
9
|
-
include I18n::Tests::Pluralization
|
10
|
-
include I18n::Tests::Procs
|
11
|
-
include I18n::Tests::Localization::Date
|
12
|
-
include I18n::Tests::Localization::DateTime
|
13
|
-
include I18n::Tests::Localization::Time
|
14
|
-
include I18n::Tests::Localization::Procs
|
15
|
-
|
16
|
-
class MemoizeBackend < I18n::Backend::Simple
|
17
|
-
include I18n::Backend::Memoize
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup
|
21
|
-
I18n.backend = MemoizeBackend.new
|
22
|
-
super
|
23
|
-
end
|
24
|
-
|
25
|
-
test "make sure we use the MemoizeBackend backend" do
|
26
|
-
assert_equal MemoizeBackend, I18n.backend.class
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
I18n::Tests.setup_rufus_tokyo
|
31
|
-
|
32
|
-
class I18nMemoizeBackendWithKeyValueApiTest < Test::Unit::TestCase
|
33
|
-
include I18n::Tests::Basics
|
34
|
-
include I18n::Tests::Defaults
|
35
|
-
include I18n::Tests::Interpolation
|
36
|
-
include I18n::Tests::Link
|
37
|
-
include I18n::Tests::Lookup
|
38
|
-
include I18n::Tests::Pluralization
|
39
|
-
include I18n::Tests::Localization::Date
|
40
|
-
include I18n::Tests::Localization::DateTime
|
41
|
-
include I18n::Tests::Localization::Time
|
42
|
-
|
43
|
-
# include I18n::Tests::Procs
|
44
|
-
# include I18n::Tests::Localization::Procs
|
45
|
-
|
46
|
-
class MemoizeBackend < I18n::Backend::KeyValue
|
47
|
-
include I18n::Backend::Memoize
|
48
|
-
end
|
49
|
-
|
50
|
-
STORE = Rufus::Tokyo::Cabinet.new('*')
|
51
|
-
|
52
|
-
def setup
|
53
|
-
I18n.backend = MemoizeBackend.new(STORE)
|
54
|
-
super
|
55
|
-
end
|
56
|
-
|
57
|
-
test "make sure we use the MemoizeBackend backend" do
|
58
|
-
assert_equal MemoizeBackend, I18n.backend.class
|
59
|
-
end
|
60
|
-
end if defined?(Rufus::Tokyo::Cabinet)
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nPluralizationApiTest < Test::Unit::TestCase
|
4
|
-
class Backend < I18n::Backend::Simple
|
5
|
-
include I18n::Backend::Pluralization
|
6
|
-
end
|
7
|
-
|
8
|
-
def setup
|
9
|
-
I18n.backend = Backend.new
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
include I18n::Tests::Basics
|
14
|
-
include I18n::Tests::Defaults
|
15
|
-
include I18n::Tests::Interpolation
|
16
|
-
include I18n::Tests::Link
|
17
|
-
include I18n::Tests::Lookup
|
18
|
-
include I18n::Tests::Pluralization
|
19
|
-
include I18n::Tests::Procs
|
20
|
-
include I18n::Tests::Localization::Date
|
21
|
-
include I18n::Tests::Localization::DateTime
|
22
|
-
include I18n::Tests::Localization::Time
|
23
|
-
include I18n::Tests::Localization::Procs
|
24
|
-
|
25
|
-
test "make sure we use a backend with Pluralization included" do
|
26
|
-
assert_equal Backend, I18n.backend.class
|
27
|
-
end
|
28
|
-
|
29
|
-
# links: test that keys stored on one backend can link to keys stored on another backend
|
30
|
-
end
|
data/test/api/simple_test.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nSimpleBackendApiTest < Test::Unit::TestCase
|
4
|
-
class Backend < I18n::Backend::Simple
|
5
|
-
include I18n::Backend::Pluralization
|
6
|
-
end
|
7
|
-
|
8
|
-
def setup
|
9
|
-
I18n.backend = I18n::Backend::Simple.new
|
10
|
-
super
|
11
|
-
end
|
12
|
-
|
13
|
-
include I18n::Tests::Basics
|
14
|
-
include I18n::Tests::Defaults
|
15
|
-
include I18n::Tests::Interpolation
|
16
|
-
include I18n::Tests::Link
|
17
|
-
include I18n::Tests::Lookup
|
18
|
-
include I18n::Tests::Pluralization
|
19
|
-
include I18n::Tests::Procs
|
20
|
-
include I18n::Tests::Localization::Date
|
21
|
-
include I18n::Tests::Localization::DateTime
|
22
|
-
include I18n::Tests::Localization::Time
|
23
|
-
include I18n::Tests::Localization::Procs
|
24
|
-
|
25
|
-
test "make sure we use the Simple backend" do
|
26
|
-
assert_equal I18n::Backend::Simple, I18n.backend.class
|
27
|
-
end
|
28
|
-
end
|
data/test/backend/cache_test.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'active_support'
|
5
|
-
rescue LoadError
|
6
|
-
$stderr.puts "Skipping cache tests using ActiveSupport"
|
7
|
-
else
|
8
|
-
|
9
|
-
class I18nBackendCacheTest < Test::Unit::TestCase
|
10
|
-
class Backend < I18n::Backend::Simple
|
11
|
-
include I18n::Backend::Cache
|
12
|
-
end
|
13
|
-
|
14
|
-
def setup
|
15
|
-
I18n.backend = Backend.new
|
16
|
-
super
|
17
|
-
I18n.cache_store = ActiveSupport::Cache.lookup_store(:memory_store)
|
18
|
-
end
|
19
|
-
|
20
|
-
def teardown
|
21
|
-
I18n.cache_store = nil
|
22
|
-
end
|
23
|
-
|
24
|
-
test "it uses the cache" do
|
25
|
-
assert I18n.cache_store.is_a?(ActiveSupport::Cache::MemoryStore)
|
26
|
-
end
|
27
|
-
|
28
|
-
test "translate hits the backend and caches the response" do
|
29
|
-
I18n.backend.expects(:lookup).returns('Foo')
|
30
|
-
assert_equal 'Foo', I18n.t(:foo)
|
31
|
-
|
32
|
-
I18n.backend.expects(:lookup).never
|
33
|
-
assert_equal 'Foo', I18n.t(:foo)
|
34
|
-
|
35
|
-
I18n.backend.expects(:lookup).returns('Bar')
|
36
|
-
assert_equal 'Bar', I18n.t(:bar)
|
37
|
-
end
|
38
|
-
|
39
|
-
test "still raises MissingTranslationData but also caches it" do
|
40
|
-
I18n.backend.expects(:lookup).returns(nil)
|
41
|
-
assert_raise(I18n::MissingTranslationData) { I18n.t(:missing, :raise => true) }
|
42
|
-
|
43
|
-
I18n.cache_store.expects(:write).never
|
44
|
-
I18n.backend.expects(:lookup).never
|
45
|
-
assert_raise(I18n::MissingTranslationData) { I18n.t(:missing, :raise => true) }
|
46
|
-
end
|
47
|
-
|
48
|
-
test "uses 'i18n' as a cache key namespace by default" do
|
49
|
-
assert_equal 0, I18n.backend.send(:cache_key, :en, :foo, {}).index('i18n')
|
50
|
-
end
|
51
|
-
|
52
|
-
test "adds a custom cache key namespace" do
|
53
|
-
with_cache_namespace('bar') do
|
54
|
-
assert_equal 0, I18n.backend.send(:cache_key, :en, :foo, {}).index('i18n/bar/')
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
test "adds locale and hash of key and hash of options" do
|
59
|
-
options = { :bar=>1 }
|
60
|
-
options_hash = I18n::Backend::Cache::USE_INSPECT_HASH ? options.inspect.hash : options.hash
|
61
|
-
assert_equal "i18n//en/#{:foo.hash}/#{options_hash}", I18n.backend.send(:cache_key, :en, :foo, options)
|
62
|
-
end
|
63
|
-
|
64
|
-
test "keys should not be equal" do
|
65
|
-
interpolation_values1 = { :foo => 1, :bar => 2 }
|
66
|
-
interpolation_values2 = { :foo => 2, :bar => 1 }
|
67
|
-
|
68
|
-
key1 = I18n.backend.send(:cache_key, :en, :some_key, interpolation_values1)
|
69
|
-
key2 = I18n.backend.send(:cache_key, :en, :some_key, interpolation_values2)
|
70
|
-
|
71
|
-
assert key1 != key2
|
72
|
-
end
|
73
|
-
|
74
|
-
protected
|
75
|
-
|
76
|
-
def with_cache_namespace(namespace)
|
77
|
-
I18n.cache_namespace = namespace
|
78
|
-
yield
|
79
|
-
I18n.cache_namespace = nil
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
end # AS cache check
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class I18nBackendCascadeTest < Test::Unit::TestCase
|
4
|
-
class Backend < I18n::Backend::Simple
|
5
|
-
include I18n::Backend::Cascade
|
6
|
-
end
|
7
|
-
|
8
|
-
def setup
|
9
|
-
I18n.backend = Backend.new
|
10
|
-
store_translations(:en, :foo => 'foo', :bar => { :baz => 'baz' })
|
11
|
-
@cascade_options = { :step => 1, :offset => 1, :skip_root => false }
|
12
|
-
end
|
13
|
-
|
14
|
-
def lookup(key, options = {})
|
15
|
-
I18n.t(key, options.merge(:cascade => @cascade_options))
|
16
|
-
end
|
17
|
-
|
18
|
-
test "still returns an existing translation as usual" do
|
19
|
-
assert_equal 'foo', lookup(:foo)
|
20
|
-
assert_equal 'baz', lookup(:'bar.baz')
|
21
|
-
end
|
22
|
-
|
23
|
-
test "falls back by cutting keys off the end of the scope" do
|
24
|
-
assert_equal 'foo', lookup(:foo, :scope => :'missing')
|
25
|
-
assert_equal 'foo', lookup(:foo, :scope => :'missing.missing')
|
26
|
-
assert_equal 'baz', lookup(:baz, :scope => :'bar.missing')
|
27
|
-
assert_equal 'baz', lookup(:baz, :scope => :'bar.missing.missing')
|
28
|
-
end
|
29
|
-
|
30
|
-
test "raises I18n::MissingTranslationData exception when no translation was found" do
|
31
|
-
assert_raise(I18n::MissingTranslationData) { lookup(:'foo.missing', :raise => true) }
|
32
|
-
assert_raise(I18n::MissingTranslationData) { lookup(:'bar.baz.missing', :raise => true) }
|
33
|
-
assert_raise(I18n::MissingTranslationData) { lookup(:'missing.bar.baz', :raise => true) }
|
34
|
-
end
|
35
|
-
|
36
|
-
test "cascades before evaluating the default" do
|
37
|
-
assert_equal 'foo', lookup(:foo, :scope => :missing, :default => 'default')
|
38
|
-
end
|
39
|
-
|
40
|
-
test "cascades defaults, too" do
|
41
|
-
assert_equal 'foo', lookup(nil, :default => [:'missing.missing', :'missing.foo'])
|
42
|
-
end
|
43
|
-
|
44
|
-
test "works with :offset => 2 and a single key" do
|
45
|
-
@cascade_options[:offset] = 2
|
46
|
-
lookup(:foo)
|
47
|
-
end
|
48
|
-
|
49
|
-
test "assemble required fallbacks for ActiveRecord validation messages" do
|
50
|
-
store_translations(:en,
|
51
|
-
:errors => {
|
52
|
-
:odd => 'errors.odd',
|
53
|
-
:reply => { :title => { :blank => 'errors.reply.title.blank' }, :taken => 'errors.reply.taken' },
|
54
|
-
:topic => { :title => { :format => 'errors.topic.title.format' }, :length => 'errors.topic.length' }
|
55
|
-
}
|
56
|
-
)
|
57
|
-
assert_equal 'errors.reply.title.blank', lookup(:'errors.reply.title.blank', :default => :'errors.topic.title.blank')
|
58
|
-
assert_equal 'errors.reply.taken', lookup(:'errors.reply.title.taken', :default => :'errors.topic.title.taken')
|
59
|
-
assert_equal 'errors.topic.title.format', lookup(:'errors.reply.title.format', :default => :'errors.topic.title.format')
|
60
|
-
assert_equal 'errors.topic.length', lookup(:'errors.reply.title.length', :default => :'errors.topic.title.length')
|
61
|
-
assert_equal 'errors.odd', lookup(:'errors.reply.title.odd', :default => :'errors.topic.title.odd')
|
62
|
-
end
|
63
|
-
|
64
|
-
test "assemble action view translation helper lookup cascade" do
|
65
|
-
@cascade_options[:offset] = 2
|
66
|
-
|
67
|
-
store_translations(:en,
|
68
|
-
:menu => { :show => 'menu.show' },
|
69
|
-
:namespace => {
|
70
|
-
:menu => { :new => 'namespace.menu.new' },
|
71
|
-
:controller => {
|
72
|
-
:menu => { :edit => 'namespace.controller.menu.edit' },
|
73
|
-
:action => {
|
74
|
-
:menu => { :destroy => 'namespace.controller.action.menu.destroy' }
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
78
|
-
)
|
79
|
-
|
80
|
-
assert_equal 'menu.show', lookup(:'namespace.controller.action.menu.show')
|
81
|
-
assert_equal 'namespace.menu.new', lookup(:'namespace.controller.action.menu.new')
|
82
|
-
assert_equal 'namespace.controller.menu.edit', lookup(:'namespace.controller.action.menu.edit')
|
83
|
-
assert_equal 'namespace.controller.action.menu.destroy', lookup(:'namespace.controller.action.menu.destroy')
|
84
|
-
end
|
85
|
-
end
|