Sha256: 04b2afddf8d52c5ec2a8e3e6fddec8259ea1cec0c1c732151accbe90800efddf

Contents?: true

Size: 766 Bytes

Versions: 3

Compression:

Stored size: 766 Bytes

Contents

module I18nViz
  module ViewHelpers

    def translate(key, options = {}) # TODO: alias
      if display_i18n_viz? && options[:i18n_viz] != false
        # TODO: ActionController::Base.perform_caching = false  if ActionController::Base.perform_caching == true
        "#{super(key, options)}--#{key}--"
      else
        super(key, options)
      end
    end
    alias :t :translate
    
    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

    def display_i18n_viz?
      I18nViz.enabled? && params && params[:i18n_viz]  rescue false  # rescue workaround, because params is weirdly defined in e.g. ActionMailer 
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
i18n_viz-0.3.2 lib/i18n_viz/view_helpers.rb
i18n_viz-0.3.1 lib/i18n_viz/view_helpers.rb
i18n_viz-0.3.0 lib/i18n_viz/view_helpers.rb