air18n 0.1.51 → 0.1.52
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/lib/air18n/class_methods.rb +4 -1
- data/lib/air18n/version.rb +1 -1
- data/spec/lib/air18n/air18n_spec.rb +5 -1
- metadata +2 -2
data/lib/air18n/class_methods.rb
CHANGED
@@ -44,14 +44,17 @@ module Air18n
|
|
44
44
|
# Sets I18n.full_locale to specified locale, yields, then sets
|
45
45
|
# I18n.full_locale back to what it was.
|
46
46
|
#
|
47
|
+
# Returns what the block returns.
|
48
|
+
#
|
47
49
|
# Useful for tests or where you want to render something in a
|
48
50
|
# certain language without the side-effect of changing
|
49
51
|
# I18n.full_locale.
|
50
52
|
def run_in_locale(locale)
|
51
53
|
old_locale = I18n.full_locale
|
52
54
|
I18n.full_locale = locale
|
53
|
-
yield
|
55
|
+
ret = yield
|
54
56
|
I18n.full_locale = old_locale
|
57
|
+
ret
|
55
58
|
end
|
56
59
|
|
57
60
|
# Like ActionView::Helpers::TextHelper#pluralize, except requires that
|
data/lib/air18n/version.rb
CHANGED
@@ -31,11 +31,15 @@ describe Air18n do
|
|
31
31
|
context 'run_in_locale' do
|
32
32
|
it 'should work' do
|
33
33
|
old_locale = I18n.full_locale
|
34
|
+
|
34
35
|
I18n.full_locale = :pl
|
35
|
-
I18n.run_in_locale(:is) do
|
36
|
+
ret = I18n.run_in_locale(:is) do
|
36
37
|
I18n.full_locale.should == :is
|
38
|
+
:return_value
|
37
39
|
end
|
40
|
+
ret.should == :return_value
|
38
41
|
I18n.full_locale.should == :pl
|
42
|
+
|
39
43
|
I18n.full_locale = old_locale
|
40
44
|
end
|
41
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: air18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.52
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-01-
|
16
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: i18n
|