Module: I18nLink::Helper
- Includes:
- ActionView::Helpers::UrlHelper, ERB::Util
- Defined in:
- lib/i18n_link/helper.rb
Instance Method Summary collapse
Instance Method Details
#t_link(translation, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/i18n_link/helper.rb', line 8 def t_link(translation, = {}) .symbolize_keys! string = h(t(translation)).gsub(/%\{[^}]+\}/) do |tl| if tl.include?(":") token, label = tl[2..-2].split(":", 2) addr = .delete(token.to_sym) if addr.nil? tl else = .delete("#{token}_options".to_sym) link_to(label, addr, ) end else tl end end raw(string % ) end |