fast_gettext 0.5.6 → 0.5.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.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.7
|
data/fast_gettext.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fast_gettext}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-24}
|
13
13
|
s.email = %q{grosser.michael@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.markdown"
|
data/lib/fast_gettext/storage.rb
CHANGED
@@ -56,6 +56,8 @@ module FastGettext
|
|
56
56
|
end
|
57
57
|
|
58
58
|
|
59
|
+
# if overwritten by user( FastGettext.pluralisation_rule = xxx) use it,
|
60
|
+
# otherwise fall back to repo or to default lambda
|
59
61
|
def pluralisation_rule
|
60
62
|
Thread.current[:fast_gettext_pluralisation_rule] || current_repository.pluralisation_rule || lambda{|i| i!=1}
|
61
63
|
end
|
@@ -2,6 +2,7 @@ require 'spec/spec_helper'
|
|
2
2
|
|
3
3
|
describe 'FastGettext::TranslationRepository::Yaml' do
|
4
4
|
before do
|
5
|
+
FastGettext.pluralisation_rule = nil
|
5
6
|
@rep = FastGettext::TranslationRepository.build('test', :path => File.join('spec', 'locale', 'yaml'), :type => :yaml)
|
6
7
|
@rep.is_a?(FastGettext::TranslationRepository::Yaml).should be_true
|
7
8
|
FastGettext.locale = 'de'
|
@@ -43,11 +44,11 @@ describe 'FastGettext::TranslationRepository::Yaml' do
|
|
43
44
|
FastGettext.n_('cars.axis',1).should == 'Achse'
|
44
45
|
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
4.times do |i|
|
48
|
+
it "can be used to do wanky pluralisation rules #{i}" do
|
49
|
+
FastGettext.stub!(:current_repository).and_return @rep
|
49
50
|
@rep.stub!(:pluralisation_rule).and_return lambda{i}
|
50
|
-
FastGettext.n_('cars.silly',1).should == i.to_s
|
51
|
+
FastGettext.n_('cars.silly',1).should == i.to_s # cars.silly translations are 0,1,2,3
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
@@ -101,6 +101,13 @@ describe FastGettext::Translation do
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
describe :ns_ do
|
105
|
+
it "translates whith namespace" do
|
106
|
+
ns_('Fruit|Apple','Fruit|Apples',2).should == 'Apples'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
|
104
111
|
describe :caching do
|
105
112
|
describe :cache_hit do
|
106
113
|
before do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 7
|
9
|
+
version: 0.5.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Grosser
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-24 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|