Module: CSVMagic::I18nHelpers
- Defined in:
- lib/csv_magic/i18n_helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#csv_magic_t(key, options = {}) ⇒ Object
This is a proxy to the ::I18n.t method with an csv_magic scope.
Class Method Details
.included(controller) ⇒ Object
4 5 6 7 8 |
# File 'lib/csv_magic/i18n_helpers.rb', line 4 def self.included(controller) if controller.respond_to?(:helper_method) controller.send(:helper_method, [:csv_magic_t]) end end |
Instance Method Details
#csv_magic_t(key, options = {}) ⇒ Object
This is a proxy to the ::I18n.t method with an csv_magic scope.
NOTE:
The keys are scoped into csv_magic
namespace. Even if you pass a scope this is scoped under csv_magic
.
17 18 19 20 |
# File 'lib/csv_magic/i18n_helpers.rb', line 17 def csv_magic_t(key, ={}) scope = [:scope].blank? ? 'csv_magic' : "csv_magic.#{.delete(:scope)}" ::I18n.t(key, {:scope => scope, :default => key.to_s.humanize}.merge()) end |