Module: ViewComponentContrib::TranslationHelper::ClassMethods
- Defined in:
- lib/view_component_contrib/translation_helper.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#i18n_namespace ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/view_component_contrib/translation_helper.rb', line 14 def i18n_namespace return @i18n_namespace if defined?(@i18n_namespace) @i18n_namespace = if superclass.respond_to?(:i18n_namespace) superclass.i18n_namespace else DEFAULT_NAMESPACE end end |
Instance Method Details
#contrib_i18n_scope ⇒ Object
25 26 27 28 29 |
# File 'lib/view_component_contrib/translation_helper.rb', line 25 def contrib_i18n_scope return @contrib_i18n_scope if defined?(@contrib_i18n_scope) @contrib_i18n_scope = name.sub("::Component", "").underscore.split("/") end |
#i18n_scope=(val) ⇒ Object
31 32 33 34 35 |
# File 'lib/view_component_contrib/translation_helper.rb', line 31 def i18n_scope=(val) raise ArgumentError, "Must be array" unless val.is_a?(Array) @contrib_i18n_scope = val.dup.freeze end |
#virtual_path ⇒ Object
37 38 39 40 41 42 |
# File 'lib/view_component_contrib/translation_helper.rb', line 37 def virtual_path @contrib_virtual_path ||= [ i18n_namespace, *contrib_i18n_scope ].join(".") end |