fast_gettext 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +14 -2
- data/Appraisals +5 -2
- data/Gemfile.lock +24 -24
- data/Readme.md +26 -0
- data/gemfiles/{rails.2.gemfile → rails23.gemfile} +1 -1
- data/gemfiles/rails23.gemfile.lock +56 -0
- data/gemfiles/{rails.3.gemfile → rails32.gemfile} +1 -1
- data/gemfiles/rails32.gemfile.lock +112 -0
- data/gemfiles/rails40.gemfile +15 -0
- data/gemfiles/rails40.gemfile.lock +110 -0
- data/lib/fast_gettext/storage.rb +1 -2
- data/lib/fast_gettext/translation.rb +92 -8
- data/lib/fast_gettext/translation_repository/db_models/translation_key.rb +9 -1
- data/lib/fast_gettext/translation_repository/db_models/translation_text.rb +2 -0
- data/lib/fast_gettext/version.rb +1 -1
- data/spec/fast_gettext/storage_spec.rb +3 -4
- data/spec/fast_gettext/translation_repository/chain_spec.rb +2 -2
- data/spec/fast_gettext/translation_repository/mo_spec.rb +5 -3
- data/spec/fast_gettext/translation_repository/yaml_spec.rb +3 -3
- data/spec/fast_gettext/translation_spec.rb +194 -1
- data/spec/fast_gettext/vendor/string_spec.rb +4 -10
- data/spec/locale/de/LC_MESSAGES/test2.mo +0 -0
- data/spec/locale/de/test.po +3 -0
- data/spec/locale/de/test2.po +23 -30
- data/spec/spec_helper.rb +21 -0
- metadata +41 -26
- data/gemfiles/rails.2.gemfile.lock +0 -56
- data/gemfiles/rails.3.gemfile.lock +0 -112
data/.travis.yml
CHANGED
@@ -1,5 +1,17 @@
|
|
1
|
-
|
1
|
+
bundler_args: ""
|
2
|
+
script: "bundle exec rake spec"
|
2
3
|
rvm:
|
3
4
|
- ree
|
4
|
-
- 1.9.2
|
5
5
|
- 1.9.3
|
6
|
+
- 2.0.0
|
7
|
+
gemfile:
|
8
|
+
- gemfiles/rails23.gemfile
|
9
|
+
- gemfiles/rails32.gemfile
|
10
|
+
- gemfiles/rails40.gemfile
|
11
|
+
bundler_args: --no-deployment
|
12
|
+
matrix:
|
13
|
+
exclude:
|
14
|
+
- rvm: 2.0.0
|
15
|
+
gemfile: gemfiles/rails23.gemfile
|
16
|
+
- rvm: ree
|
17
|
+
gemfile: gemfiles/rails40.gemfile
|
data/Appraisals
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fast_gettext (0.
|
4
|
+
fast_gettext (0.8.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
activemodel (3.2.
|
10
|
-
activesupport (= 3.2.
|
9
|
+
activemodel (3.2.14)
|
10
|
+
activesupport (= 3.2.14)
|
11
11
|
builder (~> 3.0.0)
|
12
|
-
activerecord (3.2.
|
13
|
-
activemodel (= 3.2.
|
14
|
-
activesupport (= 3.2.
|
12
|
+
activerecord (3.2.14)
|
13
|
+
activemodel (= 3.2.14)
|
14
|
+
activesupport (= 3.2.14)
|
15
15
|
arel (~> 3.0.2)
|
16
16
|
tzinfo (~> 0.3.29)
|
17
|
-
activesupport (3.2.
|
18
|
-
i18n (~> 0.6)
|
17
|
+
activesupport (3.2.14)
|
18
|
+
i18n (~> 0.6, >= 0.6.4)
|
19
19
|
multi_json (~> 1.0)
|
20
|
-
appraisal (0.5.
|
20
|
+
appraisal (0.5.2)
|
21
21
|
bundler
|
22
22
|
rake
|
23
23
|
arel (3.0.2)
|
24
24
|
builder (3.0.4)
|
25
|
-
bump (0.
|
26
|
-
diff-lcs (1.
|
27
|
-
i18n (0.6.
|
28
|
-
multi_json (1.
|
29
|
-
rake (
|
30
|
-
rspec (2.
|
31
|
-
rspec-core (~> 2.
|
32
|
-
rspec-expectations (~> 2.
|
33
|
-
rspec-mocks (~> 2.
|
34
|
-
rspec-core (2.
|
35
|
-
rspec-expectations (2.
|
36
|
-
diff-lcs (
|
37
|
-
rspec-mocks (2.
|
38
|
-
sqlite3 (1.3.
|
39
|
-
tzinfo (0.3.
|
25
|
+
bump (0.4.2)
|
26
|
+
diff-lcs (1.2.4)
|
27
|
+
i18n (0.6.5)
|
28
|
+
multi_json (1.7.9)
|
29
|
+
rake (10.1.0)
|
30
|
+
rspec (2.14.1)
|
31
|
+
rspec-core (~> 2.14.0)
|
32
|
+
rspec-expectations (~> 2.14.0)
|
33
|
+
rspec-mocks (~> 2.14.0)
|
34
|
+
rspec-core (2.14.5)
|
35
|
+
rspec-expectations (2.14.2)
|
36
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
37
|
+
rspec-mocks (2.14.3)
|
38
|
+
sqlite3 (1.3.8)
|
39
|
+
tzinfo (0.3.37)
|
40
40
|
|
41
41
|
PLATFORMS
|
42
42
|
ruby
|
data/Readme.md
CHANGED
@@ -83,6 +83,7 @@ Do this once in every Thread. (e.g. Rails -> ApplicationController)
|
|
83
83
|
_('not-found') == 'not-found'
|
84
84
|
s_('Namespace|no-found') == 'not-found'
|
85
85
|
n_('Axis','Axis',3) == 'Achsen' #German plural of Axis
|
86
|
+
_('Hello %{name}!') % {:name => "Pete"} == 'Hello Pete!'
|
86
87
|
|
87
88
|
|
88
89
|
Managing translations
|
@@ -196,6 +197,31 @@ Write your own TranslationRepository!
|
|
196
197
|
end
|
197
198
|
end
|
198
199
|
|
200
|
+
###Multi domain support
|
201
|
+
|
202
|
+
If you have more than one gettext domain, there are two sets of functions
|
203
|
+
available:
|
204
|
+
|
205
|
+
include FastGettext::TranslationMultidomain
|
206
|
+
|
207
|
+
d_("domainname", "string") # finds 'string' in domain domainname
|
208
|
+
dn_("domainname", "string", "strings", 1) # ditto
|
209
|
+
# etc.
|
210
|
+
|
211
|
+
These are helper methods so you don't need to write:
|
212
|
+
|
213
|
+
FastGettext.text_domain = "domainname"
|
214
|
+
_("string")
|
215
|
+
|
216
|
+
It is useful in Rails plugins in the views for example. The second set of
|
217
|
+
functions are D functions which search for string in _all_ domains. If there
|
218
|
+
are multiple translations in different domains, it returns them in random
|
219
|
+
order (depends on the Ruby hash implementation):
|
220
|
+
|
221
|
+
include FastGettext::TranslationMultidomain
|
222
|
+
|
223
|
+
D_("string") # finds 'string' in any domain
|
224
|
+
# etc.
|
199
225
|
|
200
226
|
FAQ
|
201
227
|
===
|
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/mgrosser/code/tools/fast_gettext
|
3
|
+
specs:
|
4
|
+
fast_gettext (0.7.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionmailer (2.3.18)
|
10
|
+
actionpack (= 2.3.18)
|
11
|
+
actionpack (2.3.18)
|
12
|
+
activesupport (= 2.3.18)
|
13
|
+
rack (~> 1.1.0)
|
14
|
+
activerecord (2.3.18)
|
15
|
+
activesupport (= 2.3.18)
|
16
|
+
activeresource (2.3.18)
|
17
|
+
activesupport (= 2.3.18)
|
18
|
+
activesupport (2.3.18)
|
19
|
+
appraisal (0.5.2)
|
20
|
+
bundler
|
21
|
+
rake
|
22
|
+
bump (0.4.2)
|
23
|
+
diff-lcs (1.2.4)
|
24
|
+
i18n (0.6.4)
|
25
|
+
rack (1.1.6)
|
26
|
+
rails (2.3.18)
|
27
|
+
actionmailer (= 2.3.18)
|
28
|
+
actionpack (= 2.3.18)
|
29
|
+
activerecord (= 2.3.18)
|
30
|
+
activeresource (= 2.3.18)
|
31
|
+
activesupport (= 2.3.18)
|
32
|
+
rake (>= 0.8.3)
|
33
|
+
rake (10.1.0)
|
34
|
+
rspec (2.14.1)
|
35
|
+
rspec-core (~> 2.14.0)
|
36
|
+
rspec-expectations (~> 2.14.0)
|
37
|
+
rspec-mocks (~> 2.14.0)
|
38
|
+
rspec-core (2.14.4)
|
39
|
+
rspec-expectations (2.14.0)
|
40
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
41
|
+
rspec-mocks (2.14.2)
|
42
|
+
sqlite3 (1.3.7)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
activerecord
|
49
|
+
appraisal
|
50
|
+
bump
|
51
|
+
fast_gettext!
|
52
|
+
i18n
|
53
|
+
rails (~> 2.3.0)
|
54
|
+
rake
|
55
|
+
rspec
|
56
|
+
sqlite3
|
@@ -0,0 +1,112 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/mgrosser/code/tools/fast_gettext
|
3
|
+
specs:
|
4
|
+
fast_gettext (0.7.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionmailer (3.2.14)
|
10
|
+
actionpack (= 3.2.14)
|
11
|
+
mail (~> 2.5.4)
|
12
|
+
actionpack (3.2.14)
|
13
|
+
activemodel (= 3.2.14)
|
14
|
+
activesupport (= 3.2.14)
|
15
|
+
builder (~> 3.0.0)
|
16
|
+
erubis (~> 2.7.0)
|
17
|
+
journey (~> 1.0.4)
|
18
|
+
rack (~> 1.4.5)
|
19
|
+
rack-cache (~> 1.2)
|
20
|
+
rack-test (~> 0.6.1)
|
21
|
+
sprockets (~> 2.2.1)
|
22
|
+
activemodel (3.2.14)
|
23
|
+
activesupport (= 3.2.14)
|
24
|
+
builder (~> 3.0.0)
|
25
|
+
activerecord (3.2.14)
|
26
|
+
activemodel (= 3.2.14)
|
27
|
+
activesupport (= 3.2.14)
|
28
|
+
arel (~> 3.0.2)
|
29
|
+
tzinfo (~> 0.3.29)
|
30
|
+
activeresource (3.2.14)
|
31
|
+
activemodel (= 3.2.14)
|
32
|
+
activesupport (= 3.2.14)
|
33
|
+
activesupport (3.2.14)
|
34
|
+
i18n (~> 0.6, >= 0.6.4)
|
35
|
+
multi_json (~> 1.0)
|
36
|
+
appraisal (0.5.2)
|
37
|
+
bundler
|
38
|
+
rake
|
39
|
+
arel (3.0.2)
|
40
|
+
builder (3.0.4)
|
41
|
+
bump (0.4.2)
|
42
|
+
diff-lcs (1.2.4)
|
43
|
+
erubis (2.7.0)
|
44
|
+
hike (1.2.3)
|
45
|
+
i18n (0.6.4)
|
46
|
+
journey (1.0.4)
|
47
|
+
json (1.8.0)
|
48
|
+
mail (2.5.4)
|
49
|
+
mime-types (~> 1.16)
|
50
|
+
treetop (~> 1.4.8)
|
51
|
+
mime-types (1.23)
|
52
|
+
multi_json (1.7.8)
|
53
|
+
polyglot (0.3.3)
|
54
|
+
rack (1.4.5)
|
55
|
+
rack-cache (1.2)
|
56
|
+
rack (>= 0.4)
|
57
|
+
rack-ssl (1.3.3)
|
58
|
+
rack
|
59
|
+
rack-test (0.6.2)
|
60
|
+
rack (>= 1.0)
|
61
|
+
rails (3.2.14)
|
62
|
+
actionmailer (= 3.2.14)
|
63
|
+
actionpack (= 3.2.14)
|
64
|
+
activerecord (= 3.2.14)
|
65
|
+
activeresource (= 3.2.14)
|
66
|
+
activesupport (= 3.2.14)
|
67
|
+
bundler (~> 1.0)
|
68
|
+
railties (= 3.2.14)
|
69
|
+
railties (3.2.14)
|
70
|
+
actionpack (= 3.2.14)
|
71
|
+
activesupport (= 3.2.14)
|
72
|
+
rack-ssl (~> 1.3.2)
|
73
|
+
rake (>= 0.8.7)
|
74
|
+
rdoc (~> 3.4)
|
75
|
+
thor (>= 0.14.6, < 2.0)
|
76
|
+
rake (10.1.0)
|
77
|
+
rdoc (3.12.2)
|
78
|
+
json (~> 1.4)
|
79
|
+
rspec (2.14.1)
|
80
|
+
rspec-core (~> 2.14.0)
|
81
|
+
rspec-expectations (~> 2.14.0)
|
82
|
+
rspec-mocks (~> 2.14.0)
|
83
|
+
rspec-core (2.14.4)
|
84
|
+
rspec-expectations (2.14.0)
|
85
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
86
|
+
rspec-mocks (2.14.2)
|
87
|
+
sprockets (2.2.2)
|
88
|
+
hike (~> 1.2)
|
89
|
+
multi_json (~> 1.0)
|
90
|
+
rack (~> 1.0)
|
91
|
+
tilt (~> 1.1, != 1.3.0)
|
92
|
+
sqlite3 (1.3.7)
|
93
|
+
thor (0.18.1)
|
94
|
+
tilt (1.4.1)
|
95
|
+
treetop (1.4.14)
|
96
|
+
polyglot
|
97
|
+
polyglot (>= 0.3.1)
|
98
|
+
tzinfo (0.3.37)
|
99
|
+
|
100
|
+
PLATFORMS
|
101
|
+
ruby
|
102
|
+
|
103
|
+
DEPENDENCIES
|
104
|
+
activerecord
|
105
|
+
appraisal
|
106
|
+
bump
|
107
|
+
fast_gettext!
|
108
|
+
i18n
|
109
|
+
rails (~> 3.2.0)
|
110
|
+
rake
|
111
|
+
rspec
|
112
|
+
sqlite3
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "appraisal"
|
6
|
+
gem "rake"
|
7
|
+
gem "sqlite3"
|
8
|
+
gem "rspec"
|
9
|
+
gem "activerecord"
|
10
|
+
gem "i18n"
|
11
|
+
gem "bump"
|
12
|
+
gem "rails", "~>4.0.0"
|
13
|
+
gem "protected_attributes"
|
14
|
+
|
15
|
+
gemspec :path=>"../"
|
@@ -0,0 +1,110 @@
|
|
1
|
+
PATH
|
2
|
+
remote: /Users/mgrosser/code/tools/fast_gettext
|
3
|
+
specs:
|
4
|
+
fast_gettext (0.7.1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
actionmailer (4.0.0)
|
10
|
+
actionpack (= 4.0.0)
|
11
|
+
mail (~> 2.5.3)
|
12
|
+
actionpack (4.0.0)
|
13
|
+
activesupport (= 4.0.0)
|
14
|
+
builder (~> 3.1.0)
|
15
|
+
erubis (~> 2.7.0)
|
16
|
+
rack (~> 1.5.2)
|
17
|
+
rack-test (~> 0.6.2)
|
18
|
+
activemodel (4.0.0)
|
19
|
+
activesupport (= 4.0.0)
|
20
|
+
builder (~> 3.1.0)
|
21
|
+
activerecord (4.0.0)
|
22
|
+
activemodel (= 4.0.0)
|
23
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
24
|
+
activesupport (= 4.0.0)
|
25
|
+
arel (~> 4.0.0)
|
26
|
+
activerecord-deprecated_finders (1.0.3)
|
27
|
+
activesupport (4.0.0)
|
28
|
+
i18n (~> 0.6, >= 0.6.4)
|
29
|
+
minitest (~> 4.2)
|
30
|
+
multi_json (~> 1.3)
|
31
|
+
thread_safe (~> 0.1)
|
32
|
+
tzinfo (~> 0.3.37)
|
33
|
+
appraisal (0.5.2)
|
34
|
+
bundler
|
35
|
+
rake
|
36
|
+
arel (4.0.0)
|
37
|
+
atomic (1.1.13)
|
38
|
+
builder (3.1.4)
|
39
|
+
bump (0.4.2)
|
40
|
+
diff-lcs (1.2.4)
|
41
|
+
erubis (2.7.0)
|
42
|
+
hike (1.2.3)
|
43
|
+
i18n (0.6.5)
|
44
|
+
mail (2.5.4)
|
45
|
+
mime-types (~> 1.16)
|
46
|
+
treetop (~> 1.4.8)
|
47
|
+
mime-types (1.24)
|
48
|
+
minitest (4.7.5)
|
49
|
+
multi_json (1.7.9)
|
50
|
+
polyglot (0.3.3)
|
51
|
+
protected_attributes (1.0.3)
|
52
|
+
activemodel (>= 4.0.0, < 5.0)
|
53
|
+
rack (1.5.2)
|
54
|
+
rack-test (0.6.2)
|
55
|
+
rack (>= 1.0)
|
56
|
+
rails (4.0.0)
|
57
|
+
actionmailer (= 4.0.0)
|
58
|
+
actionpack (= 4.0.0)
|
59
|
+
activerecord (= 4.0.0)
|
60
|
+
activesupport (= 4.0.0)
|
61
|
+
bundler (>= 1.3.0, < 2.0)
|
62
|
+
railties (= 4.0.0)
|
63
|
+
sprockets-rails (~> 2.0.0)
|
64
|
+
railties (4.0.0)
|
65
|
+
actionpack (= 4.0.0)
|
66
|
+
activesupport (= 4.0.0)
|
67
|
+
rake (>= 0.8.7)
|
68
|
+
thor (>= 0.18.1, < 2.0)
|
69
|
+
rake (10.1.0)
|
70
|
+
rspec (2.14.1)
|
71
|
+
rspec-core (~> 2.14.0)
|
72
|
+
rspec-expectations (~> 2.14.0)
|
73
|
+
rspec-mocks (~> 2.14.0)
|
74
|
+
rspec-core (2.14.5)
|
75
|
+
rspec-expectations (2.14.2)
|
76
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
77
|
+
rspec-mocks (2.14.3)
|
78
|
+
sprockets (2.10.0)
|
79
|
+
hike (~> 1.2)
|
80
|
+
multi_json (~> 1.0)
|
81
|
+
rack (~> 1.0)
|
82
|
+
tilt (~> 1.1, != 1.3.0)
|
83
|
+
sprockets-rails (2.0.0)
|
84
|
+
actionpack (>= 3.0)
|
85
|
+
activesupport (>= 3.0)
|
86
|
+
sprockets (~> 2.8)
|
87
|
+
sqlite3 (1.3.8)
|
88
|
+
thor (0.18.1)
|
89
|
+
thread_safe (0.1.2)
|
90
|
+
atomic
|
91
|
+
tilt (1.4.1)
|
92
|
+
treetop (1.4.15)
|
93
|
+
polyglot
|
94
|
+
polyglot (>= 0.3.1)
|
95
|
+
tzinfo (0.3.37)
|
96
|
+
|
97
|
+
PLATFORMS
|
98
|
+
ruby
|
99
|
+
|
100
|
+
DEPENDENCIES
|
101
|
+
activerecord
|
102
|
+
appraisal
|
103
|
+
bump
|
104
|
+
fast_gettext!
|
105
|
+
i18n
|
106
|
+
protected_attributes
|
107
|
+
rails (~> 4.0.0)
|
108
|
+
rake
|
109
|
+
rspec
|
110
|
+
sqlite3
|