alephant-renderer 0.0.9 → 0.0.10

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: 128c9a65c285628666a483b665c2baac732dcd70
4
- data.tar.gz: d52c276a2def00d664a38ce4b41b0891d7fc6dae
3
+ metadata.gz: c7001528da4f7c06a258cce649ffe62ca7c4b4f4
4
+ data.tar.gz: 25abdd3bc60c640c21f31f1de2c4585955eeae81
5
5
  SHA512:
6
- metadata.gz: c2374d88c67d9673a437c9ad2300a4edbb94eea786fa954447e7f05a396e1d58b617793f32c8ee86df88bd2b31c32066184e78f5b048ad94b62963024b687b94
7
- data.tar.gz: dbb6e7acc7af49fea6165430faa34dfad0b78c53c1fc58e687f05f474beb1086ff9c22b08a1206c8e14e8c5f73a19d5fdcdfdf744a409fe14493b396bd79e5e2
6
+ metadata.gz: 9f8f5068a7969f9bf0faabd88d76740ffb33d7d8e758d9ab5d4ba8a507b3051bed41de5a3d910ac65510d8d2b4f1b6a5890435c16fa5d9c70e19274a19ed4e4d
7
+ data.tar.gz: f6612815917388f3e3370d20ed2d8b9fd3323f2c3eb4fd3d5b7f8a77ead7612894d9fedffad04b050a14d6e6cf880449609a28905bc887c4c0c5e5199f8e1fa7
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Renderer
3
- VERSION = "0.0.9"
3
+ VERSION = "0.0.10"
4
4
  end
5
5
  end
@@ -19,7 +19,8 @@ module Alephant::Views
19
19
  def t(key, params = {})
20
20
  I18n.locale = locale
21
21
  prefix = /\/([^\/]+)\.mustache/.match(template_file)[1]
22
- I18n.translate("#{prefix}.#{key}", params)
22
+ params.merge! :default => key unless params[:default]
23
+ translation = I18n.translate("#{prefix}.#{key}", params)
23
24
  end
24
25
 
25
26
  def self.inherited(subclass)
@@ -23,5 +23,19 @@ describe Alephant::Views::Base do
23
23
 
24
24
  expect(Fixtures::Welsh.new.t('bar')).to eq('Welsh Translation')
25
25
  end
26
+
27
+ it "Uses the translation keys value if no translation and no default set" do
28
+ Alephant::Renderer.create('welsh', base_path, :model)
29
+
30
+ expect(Fixtures::Welsh.new.t('non_existent')).to eq('non_existent')
31
+ end
32
+ end
33
+
34
+ describe "t(key, param{:default => 'A default'})" do
35
+ it "Uses the passed in default if translation key does not exist" do
36
+ Alephant::Renderer.create('welsh', base_path, :model)
37
+
38
+ expect(Fixtures::Welsh.new.t('non_existent', :default => 'A default')).to eq('A default')
39
+ end
26
40
  end
27
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-renderer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Kenny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-07 00:00:00.000000000 Z
11
+ date: 2014-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec