grosser/gettext_i18n_rails — Issue #35: Extend the gettext parser to allow custom calls
Author: iceboundflame
Created: 2011-10-25 03:42:58+00:00
State: open

I've written wrappers around `_()` that supports parameters, like so:

my_( N_("Hello %{name}, you have %{num} messages"), name, msgcount )
# shorthand for _("Hello %{name}, you have %{num} messages") % {:name => name, :num => msgcount}

myn_( Nn_("%{num} message", "%{num} messages"), msgcount )
# shorthand for n_("%{num} message", "%{num} messages", msgcount) % {:num => msgcount}

But it'd be so much nicer if I could just write this:

my_("Hello %{name}, you have %{num} messages", name, msgcount)
myn_("%{num} message", "%{num} messages", msgcount)

This would become possible if we could customize what tokens trigger a translatable string to be generated. I see it hardcoded in the ruby gettext extractor right now; any thoughts on the best way to extract this list of tokens to somewhere user-accessible?