rao-view_helper 0.0.34.pre → 0.0.35.pre

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
  SHA256:
3
- metadata.gz: 1184a427a2d735924f5536ead1565739707761e746de92fdbf5d421f5a85a09c
4
- data.tar.gz: 7db7026d66cd66de3b05c2b5dc732d63e68a2b3e5d9f5188a44833db2f294be4
3
+ metadata.gz: 218190af06d71f387630ab11de60a24f545e2f42aab60aa6f9fec285798fdef1
4
+ data.tar.gz: 307ceeb828e8f8dc10b134d5dceccc202d31c2eab6f8f89e65dca0ee586eba27
5
5
  SHA512:
6
- metadata.gz: 739140224a000b910e0a6d1688fe9fe0060f89d119c1b33803e479edacaf781c99b1887508388ae7722039e7529a8ad8ac73dacda7f8d9ead2a0589daf5d4815
7
- data.tar.gz: 92e339832fb0b5a001dc6f1f1d8b093af167feed844590e11f97de1613153af71ed714c43a5e78a749e1772c5450a1b15d95bd6afb4816e055517518e5e37560
6
+ metadata.gz: 541cd6123032e630961cc8465baa9ed50fd0e0b097300f6b8a27843ad3b9db8b4516393b8052ea70410531a523a86f338c32bbd276428722cfe7ae8ffed87a0c
7
+ data.tar.gz: 1f967ce317af304a66c833c16e379cf9ea707db8efb30b1f69236057232a3d82eb89b5da24725db96fc0413f0f6353a538dcd76846139f83fc75c19527e76fa5
@@ -32,6 +32,38 @@ module Rao
32
32
  def render(locals = {})
33
33
  c.render partial: "/#{self.class.name.underscore}/#{caller_locations(1,1)[0].label}", locals: locals
34
34
  end
35
+
36
+ # You can use scoped translations by using the dot notation.
37
+ #
38
+ # Example:
39
+ #
40
+ # # app/view_helpers/blog_view_helper.rb
41
+ # class BlogViewHelper < Rao::ViewHelper::Base
42
+ # def title
43
+ # t('.title')
44
+ # end
45
+ # end
46
+ #
47
+ # # config/locales/en.yml
48
+ # en:
49
+ # view_helpers:
50
+ # blog_view_helper:
51
+ # title: 'Posts'
52
+ #
53
+ # blog_view_helper(self).title
54
+ # => "Posts"
55
+ #
56
+ module I18nConcern
57
+ def t(key, options = {})
58
+ if key.start_with?('.')
59
+ I18n.t("view_helpers.#{self.class.name.underscore}.#{key}", options)
60
+ else
61
+ I18n.t(key, options)
62
+ end
63
+ end
64
+ end
65
+
66
+ include I18nConcern
35
67
  end
36
68
  end
37
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rao-view_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.34.pre
4
+ version: 0.0.35.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-08 00:00:00.000000000 Z
11
+ date: 2019-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails