r18n-rails-api 1.1.10 → 1.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e4c713166d39430000c484d4d2aa50ff71dc4cc
4
- data.tar.gz: a45df9a54c5777bd43e2955fc52b8257f86b405f
3
+ metadata.gz: 95934fcd7dab04c55e3a3e26e77a222a743389d9
4
+ data.tar.gz: 22cbe765710c61b1ffbdadae27f482f0d7c66ca9
5
5
  SHA512:
6
- metadata.gz: 80a3e421051ccd6fd0268d80163d910fbcfa9adaafddfa4d7b6d723c4eaa6f005cc894aaf76f28f75aadb448de583b9600657063c1944f7b26906f41702db57d
7
- data.tar.gz: 9d2f314fe7eeb4e065cb27af00787ed69acc7fe16ce44aa42c2a979c127c8cfe862dcf8d5a34ccf27cc2fe31bfb5ad6d8e42c4f18952ad92ed84843b72ce0ed5
6
+ metadata.gz: 1ee1b04b3fc3a3e17e0aadaf8738d028db8337a37818a4f658ce94addddc4c854176944f72a4a78822e5524e275a0562ebaa85a6722ab72d0d74d19443ea0812
7
+ data.tar.gz: 6b84c05d65282b0f5932fdefba6cd3a06ec0010137a7c59a75cb2bbabf2738318a9cd4371d9a2ba30ae51a851a2883125aa83e9b06a69652674aaeec3e1a3c13
@@ -53,6 +53,9 @@ module R18n
53
53
  if entry.is_a? Symbol
54
54
  value = lookup(locale, scope, entry, separator, params)
55
55
  return value unless value.is_a? Untranslated
56
+ elsif entry.is_a? Proc
57
+ proc_key = options.delete(:object) || key
58
+ return entry.call(proc_key, options)
56
59
  else
57
60
  return entry
58
61
  end
data/spec/backend_spec.rb CHANGED
@@ -48,9 +48,10 @@ describe R18n::Backend do
48
48
  end
49
49
 
50
50
  it "uses default value" do
51
- I18n.t(:missed, :default => 'Default').should == 'Default'
52
- I18n.t(:missed, :default => :default, :scope => :in).should == 'Default'
51
+ I18n.t(:missed, :default => 'Default').should == 'Default'
52
+ I18n.t(:missed, :default => :default, :scope => :in).should == 'Default'
53
53
  I18n.t(:missed, :default => [:also_no, :'in.default']).should == 'Default'
54
+ I18n.t(:missed, :default => proc { |key| key.to_s }).should == 'missed'
54
55
  end
55
56
 
56
57
  it "raises error on no translation" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r18n-rails-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.10
4
+ version: 1.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Sitnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-21 00:00:00.000000000 Z
11
+ date: 2014-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: r18n-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.10
19
+ version: 1.1.11
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.10
26
+ version: 1.1.11
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: i18n
29
29
  requirement: !ruby/object:Gem::Requirement