Google Groups

Best strategy for translations?

Javier Poo Aug 2, 2011 1:35 PM
Posted in group: Liquid Templates
Hi all,

I'm working on moving a products frontend from ERB to Liquid Markup. One of the problems we are facing is to implement internationalization, the problem is half solved with a filter, but I need to sometimes pass named parameters to the filter, I've been unable to do that, parameters got evaluated and only the actual value gets to the filter. It would be helpful if someone has experience in solving this problem and share his/her experience.

Some context for better understanding.
Suppose I have this site.yml file:
          welcome: "Hi %{name} your status is %{status}"

I'd like to do something like this in the views:
<li>{{ 'site.welcome' | translate, status:member.status }}</li>

I can do that now, but I'll only get the and member.status in the filter, but I'm not getting name: and status: as variable names.

This is the filter:
  def translate(value, *args)
What I get in args is an array containing ["member_name_value","member_status_value"]