grosser-fast_gettext 0.4.13 → 0.4.14

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.13
1
+ 0.4.14
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{fast_gettext}
5
- s.version = "0.4.13"
5
+ s.version = "0.4.14"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Michael Grosser"]
9
- s.date = %q{2009-06-29}
9
+ s.date = %q{2009-08-10}
10
10
  s.email = %q{grosser.michael@gmail.com}
11
11
  s.extra_rdoc_files = [
12
12
  "README.markdown"
@@ -163,6 +163,7 @@ module FastGettext
163
163
  def update_current_cache
164
164
  caches[text_domain] ||= {}
165
165
  caches[text_domain][locale] ||= {}
166
+ caches[text_domain][locale][""] = false #ignore gettext meta key when translating
166
167
  self.current_cache = caches[text_domain][locale]
167
168
  end
168
169
  end
@@ -9,21 +9,27 @@ describe MoFile do
9
9
  before :all do
10
10
  File.exist?(de_file).should == true
11
11
  end
12
+
12
13
  it "parses a file" do
13
14
  de['car'].should == 'Auto'
14
15
  end
16
+
15
17
  it "stores untranslated values as nil" do
16
18
  de['Car|Model'].should == nil
17
19
  end
20
+
18
21
  it "finds pluralized values" do
19
22
  de.plural('Axis','Axis').should == ['Achse','Achsen']
20
23
  end
24
+
21
25
  it "returns singular translations when pluralisation could not be found" do
22
26
  de.plural('Axis','Axis','Axis').should == ['Achse','Achse','Achse']
23
27
  end
28
+
24
29
  it "returns ids when not plural and singular translations could not be found" do
25
30
  de.plural('Axis','Axis','NOTFOUND').should == ['Achse','Achse','NOTFOUND']
26
31
  end
32
+
27
33
  it "can access plurals through []" do
28
34
  de['Axis'].should == 'Achse' #singular
29
35
  end
@@ -257,6 +257,16 @@ describe 'Storage' do
257
257
  key_exist?('xxx')
258
258
  current_cache['xxx'].should == 'xxx'
259
259
  end
260
+
261
+ it "is false for gettext meta key" do
262
+ key_exist?("").should == false
263
+ end
264
+ end
265
+
266
+ describe :cached_find do
267
+ it "is nil for gettext meta key" do
268
+ cached_find("").should == false
269
+ end
260
270
  end
261
271
 
262
272
  describe NoTextDomainConfigured do
@@ -27,9 +27,14 @@ describe FastGettext::Translation do
27
27
  it "translates simple text" do
28
28
  _('car').should == 'Auto'
29
29
  end
30
+
30
31
  it "returns key if not translation was found" do
31
32
  _('NOT|FOUND').should == 'NOT|FOUND'
32
33
  end
34
+
35
+ it "does not return the gettext meta information" do
36
+ _('').should == ''
37
+ end
33
38
  end
34
39
 
35
40
  describe :n_ do
@@ -73,11 +78,13 @@ describe FastGettext::Translation do
73
78
 
74
79
  describe :s_ do
75
80
  it "translates simple text" do
76
- _('car').should == 'Auto'
81
+ s_('car').should == 'Auto'
77
82
  end
83
+
78
84
  it "returns cleaned key if a translation was not found" do
79
85
  s_("XXX|not found").should == "not found"
80
86
  end
87
+
81
88
  it "can use a custom seperator" do
82
89
  s_("XXX/not found",'/').should == "not found"
83
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grosser-fast_gettext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.13
4
+ version: 0.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-29 00:00:00 -07:00
12
+ date: 2009-08-10 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -84,6 +84,7 @@ files:
84
84
  - vendor/string.rb
85
85
  has_rdoc: false
86
86
  homepage: http://github.com/grosser/fast_gettext
87
+ licenses:
87
88
  post_install_message:
88
89
  rdoc_options:
89
90
  - --charset=UTF-8
@@ -104,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
105
  requirements: []
105
106
 
106
107
  rubyforge_project:
107
- rubygems_version: 1.2.0
108
+ rubygems_version: 1.3.5
108
109
  signing_key:
109
110
  specification_version: 3
110
111
  summary: A simple, fast and threadsafe implementation of GetText