[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Named parameters to format?

From: Christopher Allan Webber
Subject: Named parameters to format?
Date: Mon, 14 Dec 2015 22:52:35 -0600

Hello all,

I've been thinking about what I'm going to do once I hit the need for
gettext support.  I'm not really sure for things that have multiple
variables in their string.  In python land, I'd do something like:

  gettext("foo %(bar) %(baz)") % {"bar": "bleh",
                                  "baz": "wonk"}

This would give translators an opportunity to move the right parameters
to the right place in the string.  However, this appears to not be
possible in our current format system, because there's no place to put
keyword based substitutable arguments.  Syntactic word ordering varies
from natural language to natural language, so...

Surely someone's run into this before?  What's the right solution?

 - Chris

reply via email to

[Prev in Thread] Current Thread [Next in Thread]