Module: I18nViz::ViewHelpers
- Defined in:
- lib/i18n_viz/view_helpers.rb
Instance Method Summary collapse
- #display_i18n_viz? ⇒ Boolean
-
#i18n_viz_include_tag ⇒ Object
TODO: doesn’t work yet.
-
#translate(key, options = {}) ⇒ Object
(also: #t)
TODO: alias.
Instance Method Details
#display_i18n_viz? ⇒ Boolean
25 26 27 |
# File 'lib/i18n_viz/view_helpers.rb', line 25 def display_i18n_viz? params && params[:i18n_viz] rescue false # rescue workaround, because params is weirdly defined in e.g. ActionMailer end |
#i18n_viz_include_tag ⇒ Object
TODO: doesn’t work yet
18 19 20 21 22 23 |
# File 'lib/i18n_viz/view_helpers.rb', line 18 def i18n_viz_include_tag # TODO: doesn't work yet return unless display_i18n_viz? stylesheet_link_tag("i18n_viz") javascript_include_tag "i18n_viz" end |
#translate(key, options = {}) ⇒ Object Also known as: t
TODO: alias
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/i18n_viz/view_helpers.rb', line 4 def translate(key, = {}) # TODO: alias if display_i18n_viz? && [:i18n_viz] != false # TODO: ActionController::Base.perform_caching = false if ActionController::Base.perform_caching == true if ![:scope].blank? "#{super(key, )}--#{[:scope].to_s}.#{scope_key_by_partial(key)}--" else "#{super(key, )}--#{scope_key_by_partial(key)}--" end else super(key, ) end end |