Hi everyone,
are there any shortcuts to I18n.t baked into Haml? Are their any
helpers or hackeries to make calling out to I18n.translate (or similar
functions) easier?
I am asking not because «%p= t "whatever"» is too cumbersome but
because the whole thing tends to get messy when passing arguments for
interpolation.
I.e. in one of my views I would *love* to do something like this
%p" a.namespaced.key
:passed_to_i18n_translate => haml { %p here be haml }
:more_haml => haml do
%p
more
haml
:foo => "foo"
:bar => bar()
(where " is chosen at random for this example)
instead of this
- profile_link = capture_haml do
%a.person_link{ :href => person_path(comment.author) }&=
comment.author.full_name
%p.credits= t
"views.items.credits_with_profile_link_and_double_timestamp", |
:profile_link => profile_link, |
:time_ago_in_words => time_ago_in_words(comment.created_at), |
:timestamp => comment.created_at |
Besides all the | the fact that I don't seem to be able to
capture_haml inline à la :profile_link => capture_haml { %whatever }
is quite annoying.
Since it is nighttime here and I'm surely not the first to think about
this I am wondering if I might have completely missed the obvious and/
or my suggestion for an alternative implementation seems totally
esoteric? Or rather quite sensible?
It would be awesome to hear the group's thoughts about this and how
others use translation helpers in their .haml files.
I must also admit that so far I've been too lazy to really dig into
the Haml source code. Thus my implementation suggestion might not even
be possible. However, it would still be great to have some real world
examples other than my horrible one from above..
Any input or comment is greatly appreciated,
Niels
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---