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

Re: [Pulp-list] Translatable strings



On 08/02/2012 04:32 PM, James Slagle wrote:
Just a reminder, when you mark a string for translation, you have to pass the
string itself to _(), not a variable whose value is the string.

This does not work:

msg = "some string"
_(msg)

You have to do:

msg = _("some string")

and then use msg wherever you need to.

If the string is long and you want to wrap it across lines, use python's
built-in string concatenation (don't use + to concatenate strings):

msg = _("a really really "
         "long string")

And, do parameter substitution outside:

msg = ("Some Cool %s") % "stuff"

not
= ("Some Cool %s" % "stuff")


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