fast_gettext 0.7.1 → 0.8.0
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.
- 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
@@ -1,14 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe String do
|
4
|
-
def pending_18
|
5
|
-
if RUBY_VERSION > '1.9'
|
6
|
-
yield
|
7
|
-
else
|
8
|
-
pending "does not work on 1.8"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
4
|
before :all do
|
13
5
|
if "i18n gem overwrites % method".respond_to?(:interpolate_without_ruby_19_syntax)
|
14
6
|
class String
|
@@ -92,14 +84,16 @@ describe String do
|
|
92
84
|
end
|
93
85
|
|
94
86
|
describe 'with i18n loaded' do
|
87
|
+
let(:pending_condition) { (RUBY_VERSION < "1.9" and ActiveRecord::VERSION::MAJOR == 3) or ActiveRecord::VERSION::MAJOR >= 4 }
|
88
|
+
|
95
89
|
it "interpolates if i18n is loaded before" do
|
96
|
-
|
90
|
+
pending_if pending_condition, "does not work on ree + rails 3 or rails 4" do
|
97
91
|
system("bundle exec ruby spec/cases/interpolate_i18n_before_fast_gettext.rb > /dev/null 2>&1").should == true
|
98
92
|
end
|
99
93
|
end
|
100
94
|
|
101
95
|
it "interpolates if i18n is loaded before" do
|
102
|
-
|
96
|
+
pending_if pending_condition, "does not work on ree + rails 3 or rails 4" do
|
103
97
|
system("bundle exec ruby spec/cases/interpolate_i18n_after_fast_gettext.rb > /dev/null 2>&1").should == true
|
104
98
|
end
|
105
99
|
end
|
Binary file
|
data/spec/locale/de/test.po
CHANGED
data/spec/locale/de/test2.po
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
|
4
|
-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
5
|
-
#
|
1
|
+
# this is the same file as test.po but with "2" added to each translation
|
2
|
+
# and one extra translation added
|
3
|
+
|
6
4
|
#, fuzzy
|
7
5
|
msgid ""
|
8
6
|
msgstr ""
|
@@ -16,56 +14,51 @@ msgstr ""
|
|
16
14
|
"Content-Transfer-Encoding: 8bit\n"
|
17
15
|
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
18
16
|
|
19
|
-
#: app/helpers/translation_helper.rb:3
|
20
17
|
msgid "%{relative_time} ago"
|
21
|
-
msgstr "vor %{relative_time}"
|
18
|
+
msgstr "vor %{relative_time} 2"
|
22
19
|
|
23
|
-
#: app/views/cars/show.html.erb:5
|
24
20
|
msgid "Axis"
|
25
|
-
msgid_plural "Axis"
|
26
|
-
msgstr[0] "Achse"
|
27
|
-
msgstr[1] "Achsen"
|
21
|
+
msgid_plural "Axis 2"
|
22
|
+
msgstr[0] "Achse 2"
|
23
|
+
msgstr[1] "Achsen 2"
|
28
24
|
|
29
|
-
#: app/controllers/cars_controller.rb:47
|
30
25
|
msgid "Car was successfully created."
|
31
|
-
msgstr "Auto wurde erfolgreich gespeichert"
|
26
|
+
msgstr "Auto wurde erfolgreich gespeichert 2"
|
32
27
|
|
33
|
-
#: app/controllers/cars_controller.rb:64
|
34
28
|
msgid "Car was successfully updated."
|
35
|
-
msgstr "Auto wurde erfolgreich aktualisiert"
|
29
|
+
msgstr "Auto wurde erfolgreich aktualisiert 2"
|
36
30
|
|
37
|
-
#: app/views/cars/show.html.erb:1 locale/model_attributes.rb:3
|
38
31
|
msgid "Car|Model"
|
39
|
-
msgstr "Modell"
|
32
|
+
msgstr "Modell 2"
|
40
33
|
|
41
34
|
msgid "Untranslated"
|
35
|
+
msgstr ""
|
36
|
+
|
37
|
+
msgid "Untranslated and translated in test2"
|
42
38
|
msgstr "Translated"
|
43
39
|
|
44
|
-
#: app/views/cars/show.html.erb:3 locale/model_attributes.rb:4
|
45
40
|
msgid "Car|Wheels count"
|
46
|
-
msgstr "Räderzahl"
|
41
|
+
msgstr "Räderzahl 2"
|
47
42
|
|
48
|
-
#: app/views/cars/show.html.erb:7
|
49
43
|
msgid "Created"
|
50
|
-
msgstr "Erstellt"
|
44
|
+
msgstr "Erstellt 2"
|
51
45
|
|
52
|
-
#: app/views/cars/show.html.erb:9
|
53
46
|
msgid "Month"
|
54
|
-
msgstr "Monat"
|
47
|
+
msgstr "Monat 2"
|
55
48
|
|
56
|
-
#: locale/model_attributes.rb:2
|
57
49
|
msgid "car"
|
58
|
-
msgstr "Auto"
|
50
|
+
msgstr "Auto 2"
|
59
51
|
|
60
|
-
#: locale/testlog_phrases.rb:2
|
61
52
|
msgid "this is a dynamic translation which was found thorugh gettext_test_log!"
|
62
53
|
msgstr ""
|
63
54
|
"Dies ist eine dynamische Übersetzung, die durch gettext_test_log "
|
64
|
-
"gefunden wurde!"
|
55
|
+
"gefunden wurde! 2"
|
65
56
|
|
66
|
-
#: locale/test_escape.rb:2
|
67
57
|
msgid "You should escape '\\' as '\\\\'."
|
68
|
-
msgstr "Du solltest '\\' als '\\\\' escapen."
|
58
|
+
msgstr "Du solltest '\\' als '\\\\' escapen. 2"
|
69
59
|
|
70
60
|
msgid "Umläüte"
|
71
|
-
msgstr "Umlaute"
|
61
|
+
msgstr "Umlaute 2"
|
62
|
+
|
63
|
+
msgid "only in test2 domain"
|
64
|
+
msgstr "nur in test2 Domain"
|
data/spec/spec_helper.rb
CHANGED
@@ -14,8 +14,29 @@ RSpec.configure do |config|
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def default_setup
|
17
|
+
# make sure all tests are really independent
|
18
|
+
Thread.current[:fast_gettext_text_domain] = nil
|
19
|
+
Thread.current[:fast_gettext__locale] = nil
|
20
|
+
Thread.current[:fast_gettext_available_locales] = nil
|
21
|
+
Thread.current[:fast_gettext_pluralisation_rule] = nil
|
22
|
+
Thread.current[:fast_gettext_current_cache] = nil
|
23
|
+
FastGettext.send(:class_variable_set, :@@translation_repositories, {})
|
24
|
+
FastGettext.send(:class_variable_set, :@@caches, {})
|
17
25
|
FastGettext.add_text_domain('test',:path=>File.join(File.dirname(__FILE__),'locale'))
|
18
26
|
FastGettext.text_domain = 'test'
|
19
27
|
FastGettext.available_locales = ['en','de','gsw_CH']
|
20
28
|
FastGettext.locale = 'de'
|
29
|
+
FastGettext.send(:update_current_cache)
|
30
|
+
end
|
31
|
+
|
32
|
+
def pending_if(condition, *args)
|
33
|
+
if condition
|
34
|
+
pending(*args) { yield }
|
35
|
+
else
|
36
|
+
yield
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def setup_extra_domain
|
41
|
+
FastGettext.add_text_domain('test2',:path=>File.join(File.dirname(__FILE__),'locale'))
|
21
42
|
end
|
metadata
CHANGED
@@ -1,22 +1,32 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_gettext
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 8
|
9
|
+
- 0
|
10
|
+
version: 0.8.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Michael Grosser
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2013-08-30 00:00:00 Z
|
13
19
|
dependencies: []
|
20
|
+
|
14
21
|
description:
|
15
22
|
email: michael@grosser.it
|
16
23
|
executables: []
|
24
|
+
|
17
25
|
extensions: []
|
26
|
+
|
18
27
|
extra_rdoc_files: []
|
19
|
-
|
28
|
+
|
29
|
+
files:
|
20
30
|
- .gitignore
|
21
31
|
- .travis.yml
|
22
32
|
- Appraisals
|
@@ -39,10 +49,12 @@ files:
|
|
39
49
|
- examples/db/migration.rb
|
40
50
|
- examples/missing_translation_logger.rb
|
41
51
|
- fast_gettext.gemspec
|
42
|
-
- gemfiles/
|
43
|
-
- gemfiles/
|
44
|
-
- gemfiles/
|
45
|
-
- gemfiles/
|
52
|
+
- gemfiles/rails23.gemfile
|
53
|
+
- gemfiles/rails23.gemfile.lock
|
54
|
+
- gemfiles/rails32.gemfile
|
55
|
+
- gemfiles/rails32.gemfile.lock
|
56
|
+
- gemfiles/rails40.gemfile
|
57
|
+
- gemfiles/rails40.gemfile.lock
|
46
58
|
- lib/fast_gettext.rb
|
47
59
|
- lib/fast_gettext/mo_file.rb
|
48
60
|
- lib/fast_gettext/po_file.rb
|
@@ -105,35 +117,38 @@ files:
|
|
105
117
|
- spec/spec_helper.rb
|
106
118
|
- spec/support/be_accessible_matcher.rb
|
107
119
|
homepage: http://github.com/grosser/fast_gettext
|
108
|
-
licenses:
|
120
|
+
licenses:
|
109
121
|
- MIT
|
110
122
|
- Ruby
|
111
123
|
post_install_message:
|
112
124
|
rdoc_options: []
|
113
|
-
|
125
|
+
|
126
|
+
require_paths:
|
114
127
|
- lib
|
115
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
129
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
|
121
|
-
segments:
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
hash: 3
|
134
|
+
segments:
|
122
135
|
- 0
|
123
|
-
|
124
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
version: "0"
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
138
|
none: false
|
126
|
-
requirements:
|
127
|
-
- -
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
|
130
|
-
segments:
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
hash: 3
|
143
|
+
segments:
|
131
144
|
- 0
|
132
|
-
|
145
|
+
version: "0"
|
133
146
|
requirements: []
|
147
|
+
|
134
148
|
rubyforge_project:
|
135
149
|
rubygems_version: 1.8.25
|
136
150
|
signing_key:
|
137
151
|
specification_version: 3
|
138
152
|
summary: A simple, fast, memory-efficient and threadsafe implementation of GetText
|
139
153
|
test_files: []
|
154
|
+
|
@@ -1,56 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: /Users/mgrosser/code/tools/fast_gettext
|
3
|
-
specs:
|
4
|
-
fast_gettext (0.7.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
actionmailer (2.3.14)
|
10
|
-
actionpack (= 2.3.14)
|
11
|
-
actionpack (2.3.14)
|
12
|
-
activesupport (= 2.3.14)
|
13
|
-
rack (~> 1.1.0)
|
14
|
-
activerecord (2.3.14)
|
15
|
-
activesupport (= 2.3.14)
|
16
|
-
activeresource (2.3.14)
|
17
|
-
activesupport (= 2.3.14)
|
18
|
-
activesupport (2.3.14)
|
19
|
-
appraisal (0.5.1)
|
20
|
-
bundler
|
21
|
-
rake
|
22
|
-
bump (0.3.5)
|
23
|
-
diff-lcs (1.1.3)
|
24
|
-
i18n (0.6.1)
|
25
|
-
rack (1.1.3)
|
26
|
-
rails (2.3.14)
|
27
|
-
actionmailer (= 2.3.14)
|
28
|
-
actionpack (= 2.3.14)
|
29
|
-
activerecord (= 2.3.14)
|
30
|
-
activeresource (= 2.3.14)
|
31
|
-
activesupport (= 2.3.14)
|
32
|
-
rake (>= 0.8.3)
|
33
|
-
rake (0.9.2.2)
|
34
|
-
rspec (2.11.0)
|
35
|
-
rspec-core (~> 2.11.0)
|
36
|
-
rspec-expectations (~> 2.11.0)
|
37
|
-
rspec-mocks (~> 2.11.0)
|
38
|
-
rspec-core (2.11.1)
|
39
|
-
rspec-expectations (2.11.3)
|
40
|
-
diff-lcs (~> 1.1.3)
|
41
|
-
rspec-mocks (2.11.3)
|
42
|
-
sqlite3 (1.3.6)
|
43
|
-
|
44
|
-
PLATFORMS
|
45
|
-
ruby
|
46
|
-
|
47
|
-
DEPENDENCIES
|
48
|
-
activerecord
|
49
|
-
appraisal
|
50
|
-
bump
|
51
|
-
fast_gettext!
|
52
|
-
i18n
|
53
|
-
rails (~> 2.0)
|
54
|
-
rake
|
55
|
-
rspec
|
56
|
-
sqlite3
|
@@ -1,112 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: /Users/mgrosser/code/tools/fast_gettext
|
3
|
-
specs:
|
4
|
-
fast_gettext (0.7.0)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
actionmailer (3.2.8)
|
10
|
-
actionpack (= 3.2.8)
|
11
|
-
mail (~> 2.4.4)
|
12
|
-
actionpack (3.2.8)
|
13
|
-
activemodel (= 3.2.8)
|
14
|
-
activesupport (= 3.2.8)
|
15
|
-
builder (~> 3.0.0)
|
16
|
-
erubis (~> 2.7.0)
|
17
|
-
journey (~> 1.0.4)
|
18
|
-
rack (~> 1.4.0)
|
19
|
-
rack-cache (~> 1.2)
|
20
|
-
rack-test (~> 0.6.1)
|
21
|
-
sprockets (~> 2.1.3)
|
22
|
-
activemodel (3.2.8)
|
23
|
-
activesupport (= 3.2.8)
|
24
|
-
builder (~> 3.0.0)
|
25
|
-
activerecord (3.2.8)
|
26
|
-
activemodel (= 3.2.8)
|
27
|
-
activesupport (= 3.2.8)
|
28
|
-
arel (~> 3.0.2)
|
29
|
-
tzinfo (~> 0.3.29)
|
30
|
-
activeresource (3.2.8)
|
31
|
-
activemodel (= 3.2.8)
|
32
|
-
activesupport (= 3.2.8)
|
33
|
-
activesupport (3.2.8)
|
34
|
-
i18n (~> 0.6)
|
35
|
-
multi_json (~> 1.0)
|
36
|
-
appraisal (0.5.1)
|
37
|
-
bundler
|
38
|
-
rake
|
39
|
-
arel (3.0.2)
|
40
|
-
builder (3.0.4)
|
41
|
-
bump (0.3.5)
|
42
|
-
diff-lcs (1.1.3)
|
43
|
-
erubis (2.7.0)
|
44
|
-
hike (1.2.1)
|
45
|
-
i18n (0.6.1)
|
46
|
-
journey (1.0.4)
|
47
|
-
json (1.7.5)
|
48
|
-
mail (2.4.4)
|
49
|
-
i18n (>= 0.4.0)
|
50
|
-
mime-types (~> 1.16)
|
51
|
-
treetop (~> 1.4.8)
|
52
|
-
mime-types (1.19)
|
53
|
-
multi_json (1.3.7)
|
54
|
-
polyglot (0.3.3)
|
55
|
-
rack (1.4.1)
|
56
|
-
rack-cache (1.2)
|
57
|
-
rack (>= 0.4)
|
58
|
-
rack-ssl (1.3.2)
|
59
|
-
rack
|
60
|
-
rack-test (0.6.2)
|
61
|
-
rack (>= 1.0)
|
62
|
-
rails (3.2.8)
|
63
|
-
actionmailer (= 3.2.8)
|
64
|
-
actionpack (= 3.2.8)
|
65
|
-
activerecord (= 3.2.8)
|
66
|
-
activeresource (= 3.2.8)
|
67
|
-
activesupport (= 3.2.8)
|
68
|
-
bundler (~> 1.0)
|
69
|
-
railties (= 3.2.8)
|
70
|
-
railties (3.2.8)
|
71
|
-
actionpack (= 3.2.8)
|
72
|
-
activesupport (= 3.2.8)
|
73
|
-
rack-ssl (~> 1.3.2)
|
74
|
-
rake (>= 0.8.7)
|
75
|
-
rdoc (~> 3.4)
|
76
|
-
thor (>= 0.14.6, < 2.0)
|
77
|
-
rake (0.9.2.2)
|
78
|
-
rdoc (3.12)
|
79
|
-
json (~> 1.4)
|
80
|
-
rspec (2.11.0)
|
81
|
-
rspec-core (~> 2.11.0)
|
82
|
-
rspec-expectations (~> 2.11.0)
|
83
|
-
rspec-mocks (~> 2.11.0)
|
84
|
-
rspec-core (2.11.1)
|
85
|
-
rspec-expectations (2.11.3)
|
86
|
-
diff-lcs (~> 1.1.3)
|
87
|
-
rspec-mocks (2.11.3)
|
88
|
-
sprockets (2.1.3)
|
89
|
-
hike (~> 1.2)
|
90
|
-
rack (~> 1.0)
|
91
|
-
tilt (~> 1.1, != 1.3.0)
|
92
|
-
sqlite3 (1.3.6)
|
93
|
-
thor (0.16.0)
|
94
|
-
tilt (1.3.3)
|
95
|
-
treetop (1.4.12)
|
96
|
-
polyglot
|
97
|
-
polyglot (>= 0.3.1)
|
98
|
-
tzinfo (0.3.35)
|
99
|
-
|
100
|
-
PLATFORMS
|
101
|
-
ruby
|
102
|
-
|
103
|
-
DEPENDENCIES
|
104
|
-
activerecord
|
105
|
-
appraisal
|
106
|
-
bump
|
107
|
-
fast_gettext!
|
108
|
-
i18n
|
109
|
-
rails (~> 3.0)
|
110
|
-
rake
|
111
|
-
rspec
|
112
|
-
sqlite3
|