Here is the markup I'm trying to get:
<p>View more <a href="/clinics/integratedclinic">clinic information</a>
including physicians, locations, directions, documents, and more.</p>
I'm using haml, yaml, and Rails (oh my!). In order to do this with localization, I have to have this yaml:
en:
view_more: View more
link: clinic information
details: including physicians, locations, directions, documents, and more.
And put my haml on 3 lines like:
%p
= I18n.t('view_more')
= link_to I18n.t('link'), clinic
= I18n.t('details')
It seems like there's got to be a better way. The first issue is that this wouldn't work for languages with different syntax, in which the link might occur at the end of the sentence because of grammatical word order.
Isn't there a way to pass the link in as a parameter? But then I have to interpolate it in the yaml, and maybe put markup in there? That doesn't seem great, either. Is there an elegant way to do this that I'm missing?
You find some more ideas at a similar question. My favourite is to use just two translations together.
In your locale:
And just one view:
The simplest way is using Localized Views. At first replace
with
Subsequently you can create a file
_view_more.en.html.haml
with