grosser-fast_gettext 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 7
4
+ :patch: 8
@@ -1,7 +1,16 @@
1
1
  module FastGettext
2
2
  module Translation
3
3
  extend self
4
-
4
+
5
+ #make it usable in class definition, e.g.
6
+ # class Y
7
+ # include FastGettext::Translation
8
+ # @@x = _('y')
9
+ # end
10
+ def self.included(klas) #:nodoc:
11
+ klas.extend self
12
+ end
13
+
5
14
  def _(translate)
6
15
  FastGettext.current_translations[translate] || translate
7
16
  end
@@ -5,6 +5,20 @@ FastGettext.text_domain = 'test'
5
5
  FastGettext.available_locales = ['en','de']
6
6
  FastGettext.locale = 'de'
7
7
 
8
+ class IncludeTest
9
+ include FastGettext::Translation
10
+ @@xx = _('car')
11
+ def self.ext
12
+ _('car')
13
+ end
14
+ def inc
15
+ _('car')
16
+ end
17
+ def self.xx
18
+ @@xx
19
+ end
20
+ end
21
+
8
22
  include FastGettext
9
23
 
10
24
  describe FastGettext do
@@ -17,16 +31,9 @@ describe FastGettext do
17
31
  Nn_('X','Y').should == ['X','Y']
18
32
  end
19
33
  it "is extended to a class and included into a class" do
20
- class IncludeTest
21
- include FastGettext::Translation
22
- def self.ext
23
- _('car')
24
- end
25
- def inc
26
- _('car')
27
- end
28
- end
34
+ IncludeTest.ext.should == 'Auto'
29
35
  IncludeTest.ext.should == 'Auto'
30
36
  IncludeTest.new.inc.should == 'Auto'
37
+ IncludeTest.xx.should == 'Auto'
31
38
  end
32
39
  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.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser