Module: StringExtension
- Defined in:
- lib/bootstrap_leather/localization.rb
Overview
Enables ‘text to translate’.l
Instance Method Summary collapse
- #localize(*args) ⇒ Object (also: #l)
Instance Method Details
#localize(*args) ⇒ Object Also known as: l
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/bootstrap_leather/localization.rb', line 5 def localize(*args) sym = if args.first.is_a? Symbol args.shift else underscore.tr(' ', '_').gsub(/[^a-z0-9_]+/i, '').to_sym end args << { default: self } I18n.t(sym, *args).html_safe end |