r18n-core 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ChangeLog +5 -0
- data/Rakefile +4 -24
- data/base/id.yml +31 -0
- data/lib/r18n-core/translated.rb +3 -2
- data/lib/r18n-core/version.rb +1 -1
- data/locales/id.rb +18 -0
- data/r18n-core.gemspec +1 -0
- data/spec/filters_spec.rb +36 -35
- data/spec/i18n_spec.rb +23 -23
- data/spec/locale_spec.rb +21 -21
- data/spec/locales/cs_spec.rb +1 -1
- data/spec/locales/en-us_spec.rb +1 -1
- data/spec/locales/en_spec.rb +1 -1
- data/spec/locales/fr_spec.rb +1 -1
- data/spec/locales/hu_spec.rb +2 -2
- data/spec/locales/it_spec.rb +1 -1
- data/spec/locales/pl_spec.rb +1 -1
- data/spec/locales/ru_spec.rb +1 -1
- data/spec/locales/sk_spec.rb +1 -1
- data/spec/locales/th_spec.rb +1 -1
- data/spec/r18n_spec.rb +23 -23
- data/spec/translated_spec.rb +23 -25
- data/spec/translation_spec.rb +10 -10
- data/spec/yaml_loader_spec.rb +6 -6
- metadata +44 -24
- data/.yardopts +0 -4
data/spec/translation_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../spec_helper', __FILE__)
|
|
3
3
|
|
4
4
|
describe R18n::Translation do
|
5
5
|
|
6
|
-
it "
|
6
|
+
it "returns 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
|
@@ -19,7 +19,7 @@ describe R18n::Translation do
|
|
19
19
|
(i18n.one | 'default').should == 'One'
|
20
20
|
end
|
21
21
|
|
22
|
-
it "
|
22
|
+
it "returns html escaped string" do
|
23
23
|
klass = Class.new(R18n::TranslatedString) do
|
24
24
|
def html_safe
|
25
25
|
'2'
|
@@ -31,7 +31,7 @@ describe R18n::Translation do
|
|
31
31
|
str.html_safe.should == '2'
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "loads use hierarchical translations" do
|
35
35
|
i18n = R18n::I18n.new(['ru', 'en'], DIR)
|
36
36
|
i18n.in.another.level.should == 'Иерархический'
|
37
37
|
i18n[:in][:another][:level].should == 'Иерархический'
|
@@ -39,7 +39,7 @@ describe R18n::Translation do
|
|
39
39
|
i18n.only.english.should == 'Only in English'
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
42
|
+
it "saves path for translation" do
|
43
43
|
i18n = R18n::I18n.new('en', DIR)
|
44
44
|
|
45
45
|
i18n.in.another.level.path.should == 'in.another.level'
|
@@ -52,18 +52,18 @@ describe R18n::Translation do
|
|
52
52
|
i18n.not.translated_path.should == ''
|
53
53
|
end
|
54
54
|
|
55
|
-
it "
|
55
|
+
it "returns translation keys" do
|
56
56
|
i18n = R18n::I18n.new('en', [DIR, TWO])
|
57
57
|
i18n.in.translation_keys.should =~ ['another', 'two']
|
58
58
|
end
|
59
59
|
|
60
|
-
it "
|
60
|
+
it "returns string with locale info" do
|
61
61
|
i18n = R18n::I18n.new(['nolocale', 'en'], DIR)
|
62
62
|
i18n.one.locale.should == R18n::UnsupportedLocale.new('nolocale')
|
63
63
|
i18n.two.locale.should == R18n.locale('en')
|
64
64
|
end
|
65
65
|
|
66
|
-
it "
|
66
|
+
it "filters typed data" do
|
67
67
|
en = R18n.locale('en')
|
68
68
|
translation = R18n::Translation.new(en, '', :locale => en, :translations =>
|
69
69
|
{ 'count' => R18n::Typed.new('pl', { 1 => 'one', 'n' => 'many' }) })
|
@@ -72,14 +72,14 @@ describe R18n::Translation do
|
|
72
72
|
translation.count(5).should == 'many'
|
73
73
|
end
|
74
74
|
|
75
|
-
it "
|
75
|
+
it "returns hash of translations" do
|
76
76
|
i18n = R18n::I18n.new('en', DIR)
|
77
77
|
i18n.in.to_hash.should == {
|
78
78
|
'another' => { 'level' => 'Hierarchical' }
|
79
79
|
}
|
80
80
|
end
|
81
81
|
|
82
|
-
it "
|
82
|
+
it "returns untranslated, when we go deeper string" do
|
83
83
|
en = R18n.locale('en')
|
84
84
|
translation = R18n::Translation.new(en, '',
|
85
85
|
:locale => en, :translations => { 'a' => 'A' })
|
@@ -89,7 +89,7 @@ describe R18n::Translation do
|
|
89
89
|
translation.a.no_tr.untranslated_path.should == 'no_tr'
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
92
|
+
it "inspects translation" do
|
93
93
|
en = R18n.locale('en')
|
94
94
|
|
95
95
|
translation = R18n::Translation.new(en, 'a',
|
data/spec/yaml_loader_spec.rb
CHANGED
@@ -14,22 +14,22 @@ describe R18n::Loader::YAML do
|
|
14
14
|
@loader = R18n::Loader::YAML.new(DIR)
|
15
15
|
end
|
16
16
|
|
17
|
-
it "
|
17
|
+
it "returns dir with translations" do
|
18
18
|
@loader.dir.should == DIR.expand_path.to_s
|
19
19
|
end
|
20
20
|
|
21
|
-
it "
|
21
|
+
it "equals 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
|
-
it "
|
26
|
+
it "returns all available translations" do
|
27
27
|
@loader.available.should =~ [R18n.locale('ru'),
|
28
28
|
R18n.locale('en'),
|
29
29
|
R18n.locale('nolocale')]
|
30
30
|
end
|
31
31
|
|
32
|
-
it "
|
32
|
+
it "loads translation" do
|
33
33
|
@loader.load(R18n.locale('ru')).should == {
|
34
34
|
'one' => 'Один',
|
35
35
|
'in' => { 'another' => { 'level' => 'Иерархический' } },
|
@@ -37,11 +37,11 @@ describe R18n::Loader::YAML do
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
40
|
-
it "
|
40
|
+
it "returns hash by dir" do
|
41
41
|
@loader.hash.should == R18n::Loader::YAML.new(DIR).hash
|
42
42
|
end
|
43
43
|
|
44
|
-
it "
|
44
|
+
it "loads in dir recursively" do
|
45
45
|
loader = R18n::Loader::YAML.new(TRANSLATIONS)
|
46
46
|
loader.available.should =~ [R18n.locale('ru'),
|
47
47
|
R18n.locale('en'),
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r18n-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andrey "A.I." Sitnik
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-13 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
description:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
description: |2
|
14
|
+
R18n is a i18n tool to translate your Ruby application.
|
15
|
+
It has nice Ruby-style syntax, filters, flexible locales, custom loaders,
|
16
|
+
translation support for any classes, time and number localization, several
|
17
|
+
user language support, agnostic core package with out-of-box support for
|
18
|
+
Rails, Sinatra and desktop applications.
|
19
19
|
email: andrey@sitnik.ru
|
20
20
|
executables: []
|
21
21
|
extensions: []
|
@@ -25,7 +25,6 @@ extra_rdoc_files:
|
|
25
25
|
- ChangeLog
|
26
26
|
files:
|
27
27
|
- .rspec
|
28
|
-
- .yardopts
|
29
28
|
- ChangeLog
|
30
29
|
- LICENSE
|
31
30
|
- README.md
|
@@ -42,6 +41,7 @@ files:
|
|
42
41
|
- base/fr.yml
|
43
42
|
- base/gl.yml
|
44
43
|
- base/hu.yml
|
44
|
+
- base/id.yml
|
45
45
|
- base/it.yml
|
46
46
|
- base/ja.yml
|
47
47
|
- base/kk.yml
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- locales/fr.rb
|
90
90
|
- locales/gl.rb
|
91
91
|
- locales/hu.rb
|
92
|
+
- locales/id.rb
|
92
93
|
- locales/it.rb
|
93
94
|
- locales/ja.rb
|
94
95
|
- locales/kk.rb
|
@@ -137,34 +138,53 @@ files:
|
|
137
138
|
- spec/translations/two/fr.yml
|
138
139
|
- spec/yaml_loader_spec.rb
|
139
140
|
homepage: https://github.com/ai/r18n
|
140
|
-
licenses:
|
141
|
+
licenses:
|
142
|
+
- LGPL-3
|
143
|
+
metadata: {}
|
141
144
|
post_install_message:
|
142
145
|
rdoc_options: []
|
143
146
|
require_paths:
|
144
147
|
- lib
|
145
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
149
|
requirements:
|
148
|
-
- -
|
150
|
+
- - '>='
|
149
151
|
- !ruby/object:Gem::Version
|
150
152
|
version: '0'
|
151
|
-
segments:
|
152
|
-
- 0
|
153
|
-
hash: -2490264881183161480
|
154
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
154
|
requirements:
|
157
|
-
- -
|
155
|
+
- - '>='
|
158
156
|
- !ruby/object:Gem::Version
|
159
157
|
version: '0'
|
160
|
-
segments:
|
161
|
-
- 0
|
162
|
-
hash: -2490264881183161480
|
163
158
|
requirements: []
|
164
159
|
rubyforge_project:
|
165
|
-
rubygems_version:
|
160
|
+
rubygems_version: 2.0.3
|
166
161
|
signing_key:
|
167
|
-
specification_version:
|
162
|
+
specification_version: 4
|
168
163
|
summary: I18n tool to translate your Ruby application.
|
169
|
-
test_files:
|
170
|
-
|
164
|
+
test_files:
|
165
|
+
- spec/filters_spec.rb
|
166
|
+
- spec/i18n_spec.rb
|
167
|
+
- spec/locale_spec.rb
|
168
|
+
- spec/locales/cs_spec.rb
|
169
|
+
- spec/locales/en-us_spec.rb
|
170
|
+
- spec/locales/en_spec.rb
|
171
|
+
- spec/locales/fr_spec.rb
|
172
|
+
- spec/locales/hu_spec.rb
|
173
|
+
- spec/locales/it_spec.rb
|
174
|
+
- spec/locales/pl_spec.rb
|
175
|
+
- spec/locales/ru_spec.rb
|
176
|
+
- spec/locales/sk_spec.rb
|
177
|
+
- spec/locales/th_spec.rb
|
178
|
+
- spec/r18n_spec.rb
|
179
|
+
- spec/spec_helper.rb
|
180
|
+
- spec/translated_spec.rb
|
181
|
+
- spec/translation_spec.rb
|
182
|
+
- spec/translations/extension/deep/en.yml
|
183
|
+
- spec/translations/extension/en.yml
|
184
|
+
- spec/translations/extension/notransl.yml
|
185
|
+
- spec/translations/general/en.yml
|
186
|
+
- spec/translations/general/nolocale.yml
|
187
|
+
- spec/translations/general/ru.yml
|
188
|
+
- spec/translations/two/en.yml
|
189
|
+
- spec/translations/two/fr.yml
|
190
|
+
- spec/yaml_loader_spec.rb
|
data/.yardopts
DELETED