i18n 0.3.0 → 0.3.1
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 +19 -0
- data/README.textile +41 -15
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/i18n.rb +1 -1
- data/lib/i18n/backend/active_record.rb +6 -5
- data/lib/i18n/backend/active_record/missing.rb +64 -0
- data/lib/i18n/backend/active_record/translation.rb +2 -2
- data/lib/i18n/backend/base.rb +2 -2
- data/lib/i18n/backend/chain.rb +3 -3
- data/lib/i18n/helpers/gettext.rb +1 -1
- data/test/all.rb +4 -4
- data/test/api/basics.rb +8 -8
- data/test/api/defaults.rb +40 -0
- data/test/api/interpolation.rb +65 -67
- data/test/api/link.rb +31 -38
- data/test/api/localization/date.rb +69 -50
- data/test/api/localization/date_time.rb +66 -42
- data/test/api/localization/procs.rb +54 -0
- data/test/api/localization/time.rb +71 -52
- data/test/api/lookup.rb +38 -0
- data/test/api/pluralization.rb +22 -24
- data/test/api/procs.rb +40 -0
- data/test/cases/api/active_record_test.rb +28 -0
- data/test/cases/api/all_features_test.rb +37 -0
- data/test/cases/api/chain_test.rb +26 -0
- data/test/cases/api/fallbacks_test.rb +33 -0
- data/test/cases/api/pluralization_test.rb +33 -0
- data/test/cases/api/simple_test.rb +21 -0
- data/test/{backend/active_record_missing/active_record_missing_test.rb → cases/backend/active_record/missing_test.rb} +5 -8
- data/test/{backend/active_record → cases/backend}/active_record_test.rb +13 -3
- data/test/{backend/cache → cases/backend}/cache_test.rb +7 -7
- data/test/{backend/chain → cases/backend}/chain_test.rb +1 -1
- data/test/{backend/fallbacks → cases/backend}/fallbacks_test.rb +5 -5
- data/test/{backend/simple → cases/backend}/helpers_test.rb +1 -1
- data/test/{backend/metadata → cases/backend}/metadata_test.rb +12 -10
- data/test/{backend/pluralization → cases/backend}/pluralization_test.rb +10 -10
- data/test/cases/backend/simple_test.rb +77 -0
- data/test/{core_ext → cases/core_ext}/string/interpolate_test.rb +15 -15
- data/test/{gettext → cases/gettext}/api_test.rb +1 -4
- data/test/{gettext → cases/gettext}/backend_test.rb +9 -2
- data/test/{i18n_exceptions_test.rb → cases/i18n_exceptions_test.rb} +1 -1
- data/test/{i18n_load_path_test.rb → cases/i18n_load_path_test.rb} +2 -2
- data/test/{i18n_test.rb → cases/i18n_test.rb} +1 -1
- data/test/{locale → cases/locale}/fallbacks_test.rb +1 -3
- data/test/{locale → cases/locale}/tag/rfc4646_test.rb +1 -3
- data/test/{locale → cases/locale}/tag/simple_test.rb +1 -3
- data/test/fixtures/locales/de.po +5 -0
- data/test/test_helper.rb +45 -30
- data/vendor/po_parser.rb +329 -0
- metadata +60 -69
- data/lib/i18n/backend/active_record_missing.rb +0 -55
- data/test/api/lambda.rb +0 -52
- data/test/api/localization/lambda.rb +0 -26
- data/test/api/translation.rb +0 -51
- data/test/backend/active_record/all.rb +0 -3
- data/test/backend/active_record/api_test.rb +0 -54
- data/test/backend/active_record/setup.rb +0 -166
- data/test/backend/all/api_test.rb +0 -88
- data/test/backend/chain/api_test.rb +0 -80
- data/test/backend/fallbacks/api_test.rb +0 -84
- data/test/backend/pluralization/api_test.rb +0 -86
- data/test/backend/simple/all.rb +0 -5
- data/test/backend/simple/api_test.rb +0 -92
- data/test/backend/simple/lookup_test.rb +0 -24
- data/test/backend/simple/setup.rb +0 -147
- data/test/backend/simple/translations_test.rb +0 -83
- data/test/with_options.rb +0 -34
@@ -1,80 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
4
|
-
require 'i18n/backend/chain'
|
5
|
-
|
6
|
-
module ChainSetup
|
7
|
-
def setup
|
8
|
-
super
|
9
|
-
first = I18n::Backend::Simple.new
|
10
|
-
I18n.backend = I18n::Backend::Chain.new(first, I18n.backend)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_using_chain_backend
|
14
|
-
assert_equal I18n::Backend::Chain, I18n.backend.class
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
class I18nChainBackendApiBasicsTest < Test::Unit::TestCase
|
19
|
-
include ChainSetup
|
20
|
-
include Tests::Backend::Api::Basics
|
21
|
-
end
|
22
|
-
|
23
|
-
class I18nChainBackendApiTranslateTest < Test::Unit::TestCase
|
24
|
-
include Tests::Backend::Simple::Setup::Base
|
25
|
-
include ChainSetup
|
26
|
-
include Tests::Backend::Api::Translation
|
27
|
-
end
|
28
|
-
|
29
|
-
class I18nChainBackendApiInterpolateTest < Test::Unit::TestCase
|
30
|
-
include Tests::Backend::Simple::Setup::Base
|
31
|
-
include ChainSetup
|
32
|
-
include Tests::Backend::Api::Interpolation
|
33
|
-
end
|
34
|
-
|
35
|
-
class I18nChainBackendApiLambdaTest < Test::Unit::TestCase
|
36
|
-
include Tests::Backend::Simple::Setup::Base
|
37
|
-
include ChainSetup
|
38
|
-
include Tests::Backend::Api::Lambda
|
39
|
-
end
|
40
|
-
|
41
|
-
class I18nChainBackendApiTranslateLinkedTest < Test::Unit::TestCase
|
42
|
-
include Tests::Backend::Simple::Setup::Base
|
43
|
-
include ChainSetup
|
44
|
-
include Tests::Backend::Api::Link
|
45
|
-
end
|
46
|
-
|
47
|
-
class I18nChainBackendApiPluralizationTest < Test::Unit::TestCase
|
48
|
-
include Tests::Backend::Simple::Setup::Base
|
49
|
-
include ChainSetup
|
50
|
-
include Tests::Backend::Api::Pluralization
|
51
|
-
end
|
52
|
-
|
53
|
-
class I18nChainBackendApiLocalizeDateTest < Test::Unit::TestCase
|
54
|
-
include Tests::Backend::Simple::Setup::Base
|
55
|
-
include Tests::Backend::Simple::Setup::Localization
|
56
|
-
include ChainSetup
|
57
|
-
include Tests::Backend::Api::Localization::Date
|
58
|
-
end
|
59
|
-
|
60
|
-
class I18nChainBackendApiLocalizeDateTimeTest < Test::Unit::TestCase
|
61
|
-
include Tests::Backend::Simple::Setup::Base
|
62
|
-
include Tests::Backend::Simple::Setup::Localization
|
63
|
-
include ChainSetup
|
64
|
-
include Tests::Backend::Api::Localization::DateTime
|
65
|
-
end
|
66
|
-
|
67
|
-
class I18nChainBackendApiLocalizeTimeTest < Test::Unit::TestCase
|
68
|
-
include Tests::Backend::Simple::Setup::Base
|
69
|
-
include Tests::Backend::Simple::Setup::Localization
|
70
|
-
include ChainSetup
|
71
|
-
include Tests::Backend::Api::Localization::Time
|
72
|
-
end
|
73
|
-
|
74
|
-
class I18nChainBackendApiLocalizeLambdaTest < Test::Unit::TestCase
|
75
|
-
include Tests::Backend::Simple::Setup::Base
|
76
|
-
include Tests::Backend::Simple::Setup::Localization
|
77
|
-
include ChainSetup
|
78
|
-
include Tests::Backend::Api::Localization::Lambda
|
79
|
-
end
|
80
|
-
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
4
|
-
require 'i18n/backend/fallbacks'
|
5
|
-
|
6
|
-
module FallbacksSetup
|
7
|
-
class Backend
|
8
|
-
include I18n::Backend::Base
|
9
|
-
include I18n::Backend::Fallbacks
|
10
|
-
end
|
11
|
-
|
12
|
-
def setup
|
13
|
-
I18n.backend = Backend.new
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_uses_fallbacks
|
18
|
-
assert I18n.backend.class.included_modules.include?(I18n::Backend::Fallbacks)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class I18nFallbacksBackendApiBasicsTest < Test::Unit::TestCase
|
23
|
-
include FallbacksSetup
|
24
|
-
include Tests::Backend::Api::Basics
|
25
|
-
end
|
26
|
-
|
27
|
-
class I18nFallbacksBackendApiTranslateTest < Test::Unit::TestCase
|
28
|
-
include Tests::Backend::Simple::Setup::Base
|
29
|
-
include FallbacksSetup
|
30
|
-
include Tests::Backend::Api::Translation
|
31
|
-
end
|
32
|
-
|
33
|
-
class I18nFallbacksBackendApiInterpolateTest < Test::Unit::TestCase
|
34
|
-
include Tests::Backend::Simple::Setup::Base
|
35
|
-
include FallbacksSetup
|
36
|
-
include Tests::Backend::Api::Interpolation
|
37
|
-
end
|
38
|
-
|
39
|
-
class I18nFallbacksBackendApiLambdaTest < Test::Unit::TestCase
|
40
|
-
include Tests::Backend::Simple::Setup::Base
|
41
|
-
include FallbacksSetup
|
42
|
-
include Tests::Backend::Api::Lambda
|
43
|
-
end
|
44
|
-
|
45
|
-
class I18nFallbacksBackendApiTranslateLinkedTest < Test::Unit::TestCase
|
46
|
-
include Tests::Backend::Simple::Setup::Base
|
47
|
-
include FallbacksSetup
|
48
|
-
include Tests::Backend::Api::Link
|
49
|
-
end
|
50
|
-
|
51
|
-
class I18nFallbacksBackendApiPluralizationTest < Test::Unit::TestCase
|
52
|
-
include Tests::Backend::Simple::Setup::Base
|
53
|
-
include FallbacksSetup
|
54
|
-
include Tests::Backend::Api::Pluralization
|
55
|
-
end
|
56
|
-
|
57
|
-
class I18nFallbacksBackendApiLocalizeDateTest < Test::Unit::TestCase
|
58
|
-
include Tests::Backend::Simple::Setup::Base
|
59
|
-
include Tests::Backend::Simple::Setup::Localization
|
60
|
-
include FallbacksSetup
|
61
|
-
include Tests::Backend::Api::Localization::Date
|
62
|
-
end
|
63
|
-
|
64
|
-
class I18nFallbacksBackendApiLocalizeDateTimeTest < Test::Unit::TestCase
|
65
|
-
include Tests::Backend::Simple::Setup::Base
|
66
|
-
include Tests::Backend::Simple::Setup::Localization
|
67
|
-
include FallbacksSetup
|
68
|
-
include Tests::Backend::Api::Localization::DateTime
|
69
|
-
end
|
70
|
-
|
71
|
-
class I18nFallbacksBackendApiLocalizeTimeTest < Test::Unit::TestCase
|
72
|
-
include Tests::Backend::Simple::Setup::Base
|
73
|
-
include Tests::Backend::Simple::Setup::Localization
|
74
|
-
include FallbacksSetup
|
75
|
-
include Tests::Backend::Api::Localization::Time
|
76
|
-
end
|
77
|
-
|
78
|
-
class I18nFallbacksBackendApiLocalizeLambdaTest < Test::Unit::TestCase
|
79
|
-
include Tests::Backend::Simple::Setup::Base
|
80
|
-
include Tests::Backend::Simple::Setup::Localization
|
81
|
-
include FallbacksSetup
|
82
|
-
include Tests::Backend::Api::Localization::Lambda
|
83
|
-
end
|
84
|
-
|
@@ -1,86 +0,0 @@
|
|
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
|
-
|
data/test/backend/simple/all.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
4
|
-
|
5
|
-
class I18nSimpleBackendApiBasicsTest < Test::Unit::TestCase
|
6
|
-
include Tests::Backend::Simple::Setup::Base
|
7
|
-
include Tests::Backend::Api::Basics
|
8
|
-
|
9
|
-
def test_uses_simple_backend
|
10
|
-
assert_equal I18n::Backend::Simple, I18n.backend.class
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'i18n/backend/fallbacks'
|
15
|
-
|
16
|
-
class I18nSimpleBackendApiTranslateTest < Test::Unit::TestCase
|
17
|
-
include Tests::Backend::Simple::Setup::Base
|
18
|
-
include Tests::Backend::Api::Translation
|
19
|
-
|
20
|
-
# implementation specific tests
|
21
|
-
|
22
|
-
def test_translate_calls_lookup_with_locale_given
|
23
|
-
I18n.backend.expects(:lookup).with(:de, :bar, [:foo], nil).returns 'bar'
|
24
|
-
I18n.backend.translate :de, :bar, :scope => [:foo]
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_translate_calls_pluralize
|
28
|
-
I18n.backend.expects(:pluralize).with(:en, 'bar', 1).returns 'bar'
|
29
|
-
I18n.backend.translate :en, :bar, :scope => [:foo], :count => 1
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_translate_calls_interpolate
|
33
|
-
I18n.backend.expects(:interpolate).with(:en, 'bar', {}).returns 'bar'
|
34
|
-
I18n.backend.translate :en, :bar, :scope => [:foo]
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_translate_calls_interpolate_including_count_as_a_value
|
38
|
-
I18n.backend.expects(:interpolate).with(:en, 'bar', {:count => 1}).returns 'bar'
|
39
|
-
I18n.backend.translate :en, :bar, :scope => [:foo], :count => 1
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
class I18nSimpleBackendApiInterpolateTest < Test::Unit::TestCase
|
44
|
-
include Tests::Backend::Simple::Setup::Base
|
45
|
-
include Tests::Backend::Api::Interpolation
|
46
|
-
|
47
|
-
# implementation specific tests
|
48
|
-
|
49
|
-
def test_interpolate_given_nil_as_a_string_returns_nil
|
50
|
-
assert_nil I18n.backend.send(:interpolate, nil, nil, :name => 'David')
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_interpolate_given_an_non_string_as_a_string_returns_nil
|
54
|
-
assert_equal [], I18n.backend.send(:interpolate, nil, [], :name => 'David')
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
class I18nSimpleBackendApiLambdaTest < Test::Unit::TestCase
|
59
|
-
include Tests::Backend::Simple::Setup::Base
|
60
|
-
include Tests::Backend::Api::Lambda
|
61
|
-
end
|
62
|
-
|
63
|
-
class I18nSimpleBackendApiTranslateLinkedTest < Test::Unit::TestCase
|
64
|
-
include Tests::Backend::Simple::Setup::Base
|
65
|
-
include Tests::Backend::Api::Link
|
66
|
-
end
|
67
|
-
|
68
|
-
class I18nSimpleBackendApiPluralizationTest < Test::Unit::TestCase
|
69
|
-
include Tests::Backend::Simple::Setup::Base
|
70
|
-
include Tests::Backend::Api::Pluralization
|
71
|
-
end
|
72
|
-
|
73
|
-
class I18nSimpleBackendApiLocalizeDateTest < Test::Unit::TestCase
|
74
|
-
include Tests::Backend::Simple::Setup::Localization
|
75
|
-
include Tests::Backend::Api::Localization::Date
|
76
|
-
end
|
77
|
-
|
78
|
-
class I18nSimpleBackendApiLocalizeDateTimeTest < Test::Unit::TestCase
|
79
|
-
include Tests::Backend::Simple::Setup::Localization
|
80
|
-
include Tests::Backend::Api::Localization::DateTime
|
81
|
-
end
|
82
|
-
|
83
|
-
class I18nSimpleBackendApiLocalizeTimeTest < Test::Unit::TestCase
|
84
|
-
include Tests::Backend::Simple::Setup::Localization
|
85
|
-
include Tests::Backend::Api::Localization::Time
|
86
|
-
end
|
87
|
-
|
88
|
-
class I18nSimpleBackendApiLocalizeLambdaTest < Test::Unit::TestCase
|
89
|
-
include Tests::Backend::Simple::Setup::Localization
|
90
|
-
include Tests::Backend::Api::Localization::Lambda
|
91
|
-
end
|
92
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
4
|
-
|
5
|
-
class I18nSimpleBackendLookupTest < Test::Unit::TestCase
|
6
|
-
include Tests::Backend::Simple::Setup::Base
|
7
|
-
|
8
|
-
# useful because this way we can use the backend with no key for interpolation/pluralization
|
9
|
-
def test_lookup_given_nil_as_a_key_returns_nil
|
10
|
-
assert_nil I18n.backend.send(:lookup, :en, nil)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_lookup_given_nested_keys_looks_up_a_nested_hash_value
|
14
|
-
assert_equal 'bar', I18n.backend.send(:lookup, :en, :bar, [:foo])
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_lookup_using_a_custom_separator
|
18
|
-
assert_equal 'bar', I18n.backend.send(:lookup, :en, 'foo|bar', [], '|')
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_default_using_a_custom_separator
|
22
|
-
assert_equal 'bar', I18n.backend.send(:default, :en, :'does_not_exist', :'foo|bar', :separator => '|')
|
23
|
-
end
|
24
|
-
end
|
@@ -1,147 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Tests
|
4
|
-
module Backend
|
5
|
-
module Simple
|
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
|
-
|
23
|
-
module Localization
|
24
|
-
include Base
|
25
|
-
|
26
|
-
def setup
|
27
|
-
super
|
28
|
-
setup_datetime_translations
|
29
|
-
setup_datetime_lambda_translations
|
30
|
-
@old_timezone, ENV['TZ'] = ENV['TZ'], 'UTC'
|
31
|
-
end
|
32
|
-
|
33
|
-
def teardown
|
34
|
-
super
|
35
|
-
@old_timezone ? ENV['TZ'] = @old_timezone : ENV.delete('TZ')
|
36
|
-
end
|
37
|
-
|
38
|
-
def setup_datetime_translations
|
39
|
-
backend_store_translations :de, {
|
40
|
-
:date => {
|
41
|
-
:formats => {
|
42
|
-
:default => "%d.%m.%Y",
|
43
|
-
:short => "%d. %b",
|
44
|
-
:long => "%d. %B %Y",
|
45
|
-
:long_ordinalized => lambda { |date, options|
|
46
|
-
tz = " (#{options[:timezone]})" if options[:timezone]
|
47
|
-
"#{date.day}ter %B %Y#{tz}"
|
48
|
-
}
|
49
|
-
},
|
50
|
-
:day_names => %w(Sonntag Montag Dienstag Mittwoch Donnerstag Freitag Samstag),
|
51
|
-
:abbr_day_names => %w(So Mo Di Mi Do Fr Sa),
|
52
|
-
:month_names => %w(Januar Februar März April Mai Juni Juli August September Oktober November Dezember).unshift(nil),
|
53
|
-
:abbr_month_names => %w(Jan Feb Mar Apr Mai Jun Jul Aug Sep Okt Nov Dez).unshift(nil),
|
54
|
-
:order => [:day, :month, :year]
|
55
|
-
},
|
56
|
-
:time => {
|
57
|
-
:formats => {
|
58
|
-
:default => "%a, %d. %b %Y %H:%M:%S %z",
|
59
|
-
:short => "%d. %b %H:%M",
|
60
|
-
:long => "%d. %B %Y %H:%M",
|
61
|
-
:long_ordinalized => lambda { |date, options|
|
62
|
-
tz = " (#{options[:timezone]})" if options[:timezone]
|
63
|
-
"#{date.day}ter %B %Y, %H:%M Uhr#{tz}"
|
64
|
-
}
|
65
|
-
},
|
66
|
-
:am => 'am',
|
67
|
-
:pm => 'pm'
|
68
|
-
},
|
69
|
-
:datetime => {
|
70
|
-
:distance_in_words => {
|
71
|
-
:half_a_minute => 'half a minute',
|
72
|
-
:less_than_x_seconds => {
|
73
|
-
:one => 'less than 1 second',
|
74
|
-
:other => 'less than {{count}} seconds'
|
75
|
-
},
|
76
|
-
:x_seconds => {
|
77
|
-
:one => '1 second',
|
78
|
-
:other => '{{count}} seconds'
|
79
|
-
},
|
80
|
-
:less_than_x_minutes => {
|
81
|
-
:one => 'less than a minute',
|
82
|
-
:other => 'less than {{count}} minutes'
|
83
|
-
},
|
84
|
-
:x_minutes => {
|
85
|
-
:one => '1 minute',
|
86
|
-
:other => '{{count}} minutes'
|
87
|
-
},
|
88
|
-
:about_x_hours => {
|
89
|
-
:one => 'about 1 hour',
|
90
|
-
:other => 'about {{count}} hours'
|
91
|
-
},
|
92
|
-
:x_days => {
|
93
|
-
:one => '1 day',
|
94
|
-
:other => '{{count}} days'
|
95
|
-
},
|
96
|
-
:about_x_months => {
|
97
|
-
:one => 'about 1 month',
|
98
|
-
:other => 'about {{count}} months'
|
99
|
-
},
|
100
|
-
:x_months => {
|
101
|
-
:one => '1 month',
|
102
|
-
:other => '{{count}} months'
|
103
|
-
},
|
104
|
-
:about_x_years => {
|
105
|
-
:one => 'about 1 year',
|
106
|
-
:other => 'about {{count}} year'
|
107
|
-
},
|
108
|
-
:over_x_years => {
|
109
|
-
:one => 'over 1 year',
|
110
|
-
:other => 'over {{count}} years'
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
end
|
116
|
-
|
117
|
-
def setup_datetime_lambda_translations
|
118
|
-
backend_store_translations 'ru', {
|
119
|
-
:date => {
|
120
|
-
:'day_names' => lambda { |key, options|
|
121
|
-
(options[:format] =~ /^%A/) ?
|
122
|
-
%w(Воскресенье Понедельник Вторник Среда Четверг Пятница Суббота) :
|
123
|
-
%w(воскресенье понедельник вторник среда четверг пятница суббота)
|
124
|
-
},
|
125
|
-
:'abbr_day_names' => %w(Вс Пн Вт Ср Чт Пт Сб),
|
126
|
-
:'month_names' => lambda { |key, options|
|
127
|
-
(options[:format] =~ /(%d|%e)(\s*)?(%B)/) ?
|
128
|
-
%w(января февраля марта апреля мая июня июля августа сентября октября ноября декабря).unshift(nil) :
|
129
|
-
%w(Январь Февраль Март Апрель Май Июнь Июль Август Сентябрь Октябрь Ноябрь Декабрь).unshift(nil)
|
130
|
-
},
|
131
|
-
:'abbr_month_names' => lambda { |key, options|
|
132
|
-
(options[:format] =~ /(%d|%e)(\s*)(%b)/) ?
|
133
|
-
%w(янв. февр. марта апр. мая июня июля авг. сент. окт. нояб. дек.).unshift(nil) :
|
134
|
-
%w(янв. февр. март апр. май июнь июль авг. сент. окт. нояб. дек.).unshift(nil)
|
135
|
-
},
|
136
|
-
},
|
137
|
-
:time => {
|
138
|
-
:am => "утра",
|
139
|
-
:pm => "вечера"
|
140
|
-
}
|
141
|
-
}
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|