Gettext and placeholder


#1

Hello!
In one of my views i have something like this:

<% ciccio = ‘panza’ %>
<%=h _(“yeah #{ciccio}”) %>

but the localize script from
http://manuals.rubyonrails.com/read/chapter/105 does not add the second
line to my pot and po files. Am I doing something wrong? Did someone get
this to work?


#2

Hi,

On Wed, 16 Nov 2005 21:20:57 +0100
Simon S. removed_email_address@domain.invalid wrote:

Hello!
In one of my views i have something like this:

<% ciccio = ‘panza’ %>
<%=h _(“yeah #{ciccio}”) %>

but the localize script from
http://manuals.rubyonrails.com/read/chapter/105 does not add the second
line to my pot and po files. Am I doing something wrong? Did someone get
this to work?

Ruby-GetText-Package doesn’t support “#{…}” style.
Use:

_(“yeah %s”) % ciccio


#3

Masao M. wrote:

Ruby-GetText-Package doesn’t support “#{…}” style.
Use:

_(“yeah %s”) % ciccio

Thanks!


#4

Hi,

On Fri, 18 Nov 2005 00:16:15 +0100
Sascha E. removed_email_address@domain.invalid wrote:

_(“yeah :greeting”) % :greeting => ‘right’

The reason for this would be so that the translator will have it easier to
translate because more of the context of the message is known when you are
looking at the msgid.

Interesting.

If gettext overrides String#%(ary) => String#%(hash_or_ary),
It seems we can implement it with backward compatibility.
I’ll consider your suggestion.

On the other hand, it may be a good proposal to extend the
behaviour of ruby’s string literal.(ruby-1.9 or 2.0?)

“yeah :greeting :number” % {:greeting => ‘right’, :number => 10}

So I recommand you to discuss this proposal on ruby-talk
or ruby-core.


#5

Simon S. wrote:

Masao M. wrote:

Ruby-GetText-Package doesn’t support “#{…}” style.
Use:

_(“yeah %s”) % ciccio

Masao,

what do you think about supporting something like

_(“yeah :greeting”) % :greeting => ‘right’

The reason for this would be so that the translator will have it easier
to
translate because more of the context of the message is known when you
are
looking at the msgid.

Sascha