r18n-core 0.4.10 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +5 -0
- data/Gemfile.lock +1 -1
- data/README.rdoc +25 -25
- data/Rakefile +0 -1
- data/lib/r18n-core.rb +5 -5
- data/lib/r18n-core/filters.rb +45 -45
- data/lib/r18n-core/helpers.rb +4 -4
- data/lib/r18n-core/i18n.rb +30 -30
- data/lib/r18n-core/locale.rb +26 -26
- data/lib/r18n-core/translated.rb +23 -23
- data/lib/r18n-core/translated_string.rb +4 -4
- data/lib/r18n-core/translation.rb +10 -10
- data/lib/r18n-core/unsupported_locale.rb +6 -6
- data/lib/r18n-core/untranslated.rb +13 -13
- data/lib/r18n-core/utils.rb +4 -4
- data/lib/r18n-core/version.rb +1 -1
- data/lib/r18n-core/yaml_loader.rb +13 -11
- data/locales/bg.rb +3 -3
- data/locales/ca.rb +6 -5
- data/locales/cs.rb +5 -5
- data/locales/da.rb +4 -4
- data/locales/de.rb +4 -4
- data/locales/en-us.rb +1 -1
- data/locales/en.rb +6 -6
- data/locales/eo.rb +4 -4
- data/locales/es.rb +4 -4
- data/locales/fi.rb +5 -5
- data/locales/fr.rb +6 -6
- data/locales/hu.rb +1 -1
- data/locales/it.rb +5 -5
- data/locales/ja.rb +5 -4
- data/locales/kk.rb +4 -4
- data/locales/lv.rb +5 -5
- data/locales/nl.rb +5 -5
- data/locales/pl.rb +5 -5
- data/locales/pt.rb +4 -4
- data/locales/ru.rb +5 -5
- data/locales/sk.rb +5 -5
- data/locales/sv-se.rb +4 -4
- data/locales/th.rb +7 -4
- data/locales/zh.rb +6 -5
- data/r18n-core.gemspec +0 -1
- data/spec/filters_spec.rb +48 -48
- data/spec/i18n_spec.rb +32 -32
- data/spec/locale_spec.rb +20 -20
- data/spec/locales/cs_spec.rb +2 -2
- data/spec/locales/hu_spec.rb +1 -1
- data/spec/locales/it_spec.rb +1 -1
- data/spec/locales/pl_spec.rb +2 -2
- data/spec/locales/ru_spec.rb +3 -3
- data/spec/locales/sk_spec.rb +2 -2
- data/spec/r18n_spec.rb +21 -21
- data/spec/spec_helper.rb +3 -3
- data/spec/translated_spec.rb +24 -24
- data/spec/translation_spec.rb +10 -10
- data/spec/yaml_loader_spec.rb +10 -10
- metadata +24 -26
data/spec/translation_spec.rb
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
require File.expand_path('../spec_helper', __FILE__)
|
3
3
|
|
4
4
|
describe R18n::Translation do
|
5
|
-
|
5
|
+
|
6
6
|
it "should return unstranslated string if translation isn't found" do
|
7
7
|
i18n = R18n::I18n.new('en', DIR)
|
8
8
|
i18n.not.exists.should be_a(R18n::Untranslated)
|
9
9
|
i18n.not.exists.should_not be_translated
|
10
10
|
(i18n.not.exists | 'default').should == 'default'
|
11
|
-
|
11
|
+
|
12
12
|
(i18n.in | 'default').should == 'default'
|
13
|
-
|
13
|
+
|
14
14
|
i18n.one.should be_translated
|
15
15
|
(i18n.one | 'default').should == 'One'
|
16
16
|
end
|
@@ -22,20 +22,20 @@ describe R18n::Translation do
|
|
22
22
|
i18n['in']['another']['level'].should == 'Иерархический'
|
23
23
|
i18n.only.english.should == 'Only in English'
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
it "should save path for translation" do
|
27
27
|
i18n = R18n::I18n.new('en', DIR)
|
28
|
-
|
28
|
+
|
29
29
|
i18n.in.another.level.path.should == 'in.another.level'
|
30
|
-
|
30
|
+
|
31
31
|
i18n.in.another.not.exists.path.should == 'in.another.not.exists'
|
32
32
|
i18n.in.another.not.exists.untranslated_path.should == 'not.exists'
|
33
33
|
i18n.in.another.not.exists.translated_path.should == 'in.another.'
|
34
|
-
|
34
|
+
|
35
35
|
i18n.not.untranslated_path.should == 'not'
|
36
36
|
i18n.not.translated_path.should == ''
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
it "should return translation keys" do
|
40
40
|
i18n = R18n::I18n.new('en', [DIR, TWO])
|
41
41
|
i18n.in._keys.should =~ ['another', 'two']
|
@@ -46,13 +46,13 @@ describe R18n::Translation do
|
|
46
46
|
i18n.one.locale.should == R18n::UnsupportedLocale.new('no-LC')
|
47
47
|
i18n.two.locale.should == R18n::Locale.load('en')
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
it "should filter typed data" do
|
51
51
|
en = R18n::Locale.load('en')
|
52
52
|
translation = R18n::Translation.new(en, '', en, {
|
53
53
|
'count' => R18n::Typed.new('pl', { 1 => 'one', 'n' => 'many' })
|
54
54
|
})
|
55
|
-
|
55
|
+
|
56
56
|
translation.count(1).should == 'one'
|
57
57
|
translation.count(5).should == 'many'
|
58
58
|
end
|
data/spec/yaml_loader_spec.rb
CHANGED
@@ -5,40 +5,40 @@ describe R18n::Loader::YAML do
|
|
5
5
|
before :all do
|
6
6
|
R18n::Filters.add('my', :my) { |i| i }
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
after :all do
|
10
10
|
R18n::Filters.delete(:my)
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
before do
|
14
14
|
@loader = R18n::Loader::YAML.new(DIR)
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
it "should return dir with translations" do
|
18
18
|
@loader.dir.should == DIR.expand_path.to_s
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
it "should be equal to another YAML loader with same dir" do
|
22
22
|
@loader.should == R18n::Loader::YAML.new(DIR)
|
23
23
|
@loader.should_not == Class.new(R18n::Loader::YAML).new(DIR)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
it "should return all available translations" do
|
27
27
|
@loader.available.should =~ [R18n::Locale.load('ru'),
|
28
28
|
R18n::Locale.load('en'),
|
29
29
|
R18n::Locale.load('no-lc')]
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
it "should load translation" do
|
33
33
|
@loader.load(R18n::Locale.load('ru')).should == {
|
34
34
|
'one' => 'Один', 'in' => {'another' => {'level' => 'Иерархический'}},
|
35
35
|
'typed' => R18n::Typed.new('my', 'value') }
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
it "should return hash by dir" do
|
39
39
|
@loader.hash.should == R18n::Loader::YAML.new(DIR).hash
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
it "should load in dir recursively" do
|
43
43
|
loader = R18n::Loader::YAML.new(TRANSLATIONS)
|
44
44
|
loader.available.should =~ [R18n::Locale.load('ru'),
|
@@ -46,12 +46,12 @@ describe R18n::Loader::YAML do
|
|
46
46
|
R18n::Locale.load('fr'),
|
47
47
|
R18n::Locale.load('no-tr'),
|
48
48
|
R18n::Locale.load('no-lc')]
|
49
|
-
|
49
|
+
|
50
50
|
translation = loader.load(R18n::Locale.load('en'))
|
51
51
|
translation['two'].should == 'Two'
|
52
52
|
translation['in']['two'].should == 'Two'
|
53
53
|
translation['ext'].should == 'Extension'
|
54
54
|
translation['deep'].should == 'Deep one'
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 25
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 11
|
10
|
+
version: 0.4.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrey "A.I." Sitnik
|
@@ -15,10 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-10-02 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
21
|
+
type: :development
|
22
|
+
name: bundler
|
22
23
|
prerelease: false
|
23
24
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
25
|
none: false
|
@@ -32,9 +33,9 @@ dependencies:
|
|
32
33
|
- 10
|
33
34
|
version: 1.0.10
|
34
35
|
requirement: *id001
|
35
|
-
type: :development
|
36
|
-
name: bundler
|
37
36
|
- !ruby/object:Gem::Dependency
|
37
|
+
type: :development
|
38
|
+
name: hanna
|
38
39
|
prerelease: false
|
39
40
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
41
|
none: false
|
@@ -46,9 +47,9 @@ dependencies:
|
|
46
47
|
- 0
|
47
48
|
version: "0"
|
48
49
|
requirement: *id002
|
49
|
-
type: :development
|
50
|
-
name: hanna
|
51
50
|
- !ruby/object:Gem::Dependency
|
51
|
+
type: :development
|
52
|
+
name: rake
|
52
53
|
prerelease: false
|
53
54
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
55
|
none: false
|
@@ -68,9 +69,9 @@ dependencies:
|
|
68
69
|
- 0
|
69
70
|
version: 0.9.0
|
70
71
|
requirement: *id003
|
71
|
-
type: :development
|
72
|
-
name: rake
|
73
72
|
- !ruby/object:Gem::Dependency
|
73
|
+
type: :development
|
74
|
+
name: rspec-core
|
74
75
|
prerelease: false
|
75
76
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
76
77
|
none: false
|
@@ -82,9 +83,9 @@ dependencies:
|
|
82
83
|
- 0
|
83
84
|
version: "0"
|
84
85
|
requirement: *id004
|
85
|
-
type: :development
|
86
|
-
name: rspec-core
|
87
86
|
- !ruby/object:Gem::Dependency
|
87
|
+
type: :development
|
88
|
+
name: rspec-expectations
|
88
89
|
prerelease: false
|
89
90
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
90
91
|
none: false
|
@@ -96,9 +97,9 @@ dependencies:
|
|
96
97
|
- 0
|
97
98
|
version: "0"
|
98
99
|
requirement: *id005
|
99
|
-
type: :development
|
100
|
-
name: rspec-expectations
|
101
100
|
- !ruby/object:Gem::Dependency
|
101
|
+
type: :development
|
102
|
+
name: rspec-mocks
|
102
103
|
prerelease: false
|
103
104
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
104
105
|
none: false
|
@@ -110,9 +111,9 @@ dependencies:
|
|
110
111
|
- 0
|
111
112
|
version: "0"
|
112
113
|
requirement: *id006
|
113
|
-
type: :development
|
114
|
-
name: rspec-mocks
|
115
114
|
- !ruby/object:Gem::Dependency
|
115
|
+
type: :development
|
116
|
+
name: rcov
|
116
117
|
prerelease: false
|
117
118
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
118
119
|
none: false
|
@@ -124,9 +125,9 @@ dependencies:
|
|
124
125
|
- 0
|
125
126
|
version: "0"
|
126
127
|
requirement: *id007
|
127
|
-
type: :development
|
128
|
-
name: rcov
|
129
128
|
- !ruby/object:Gem::Dependency
|
129
|
+
type: :development
|
130
|
+
name: maruku
|
130
131
|
prerelease: false
|
131
132
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
132
133
|
none: false
|
@@ -138,9 +139,9 @@ dependencies:
|
|
138
139
|
- 0
|
139
140
|
version: "0"
|
140
141
|
requirement: *id008
|
141
|
-
type: :development
|
142
|
-
name: maruku
|
143
142
|
- !ruby/object:Gem::Dependency
|
143
|
+
type: :development
|
144
|
+
name: RedCloth
|
144
145
|
prerelease: false
|
145
146
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
146
147
|
none: false
|
@@ -152,8 +153,6 @@ dependencies:
|
|
152
153
|
- 0
|
153
154
|
version: "0"
|
154
155
|
requirement: *id009
|
155
|
-
type: :development
|
156
|
-
name: RedCloth
|
157
156
|
description: " R18n is a i18n tool to translate your Ruby application.\n It has nice Ruby-style syntax, filters, flexible locales, custom loaders,\n translation support for any classes, time and number localization, several\n user language support, agnostic core package with out-of-box support for\n Rails, Sinatra, Merb and desktop applications.\n"
|
158
157
|
email: andrey@sitnik.ru
|
159
158
|
executables: []
|
@@ -263,7 +262,6 @@ files:
|
|
263
262
|
- spec/translations/two/en.yml
|
264
263
|
- spec/translations/two/fr.yml
|
265
264
|
- spec/yaml_loader_spec.rb
|
266
|
-
has_rdoc: true
|
267
265
|
homepage: http://r18n.rubyforge.org/
|
268
266
|
licenses: []
|
269
267
|
|
@@ -293,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
293
291
|
requirements: []
|
294
292
|
|
295
293
|
rubyforge_project: r18n-core
|
296
|
-
rubygems_version: 1.
|
294
|
+
rubygems_version: 1.7.2
|
297
295
|
signing_key:
|
298
296
|
specification_version: 3
|
299
297
|
summary: I18n tool to translate your Ruby application.
|