Sha256: b536f0369e1db41dde674fb5e22d8ccc1291409f2d32305921c1c0bc8dffc760
Contents?: true
Size: 705 Bytes
Versions: 16
Compression:
Stored size: 705 Bytes
Contents
# String Extension module StringExtension 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 alias l localize end String.send :include, StringExtension # Symbol Extensions module SymbolExtensionCustom def localize_with_debugging(*args) localized_sym = I18n.translate(self, *args) localized_sym.is_a?(String) ? localized_sym.html_safe : localized_sym end alias l localize_with_debugging def l_with_args(*args) l(*args).html_safe end end Symbol.send :include, SymbolExtensionCustom
Version data entries
16 entries across 16 versions & 1 rubygems