Module: StringExtension
- Defined in:
- lib/paid_up/localization.rb
Overview
String Extension
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/paid_up/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 |