iGEL / it

A helper for links and other html tags in your translations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No support for `mail_to` style links

UsAndRufus opened this issue · comments

commented

Currently internationalising our app and using It for inline links. Would be great to support mail_to style links.

E.g. it('.contact_us', mail: It.mail(Rails.config.support_email) and then the corresponding translation: contact_us: "Click %{mail:here} to send us an email!"

It's not that difficult to implement as mail_to is just a call to link_to that adds mailto: in front of the href.

commented

Let me know if there's appetite for this beyond me and I'll make a PR.

Hi @UsAndRufus!

Thank you for your idea. However, I think it's already possible:

en:
  copy: "Want to contact %{user}%? %{link:send %{b:%{user} a message}}!"

<%=it "copy", link: "mailto:igel@igels.net", user: 'iGEL', b: It.tag(:b) %>

I'll close this issue for now, but feel free to reopen it if that doesn't work for you.

commented

It definitely is possible like, you just have to add mailto: in front of the link. The nice thing about Rails' mail_to helper is it auomatically inserts that. Purely convenience! I made a little helper for our Rails app to do this:

def mail_it(url, extras={})
  It.link("mailto:#{url}", extras)
end