[Openstack] Nova now i18n-ified

Jay Pipes jaypipes at gmail.com
Wed Dec 22 16:01:18 UTC 2010


After much trunk-merging and wrangling of Hudson, the i18n-strings
branch has now hit trunk.

What does this mean?  A couple things:

For contributors:

>From now on, during code review, you may find some of us say something
like "hey, you need to mark your strings for translation".  What this
means is that in a patch you submitted, you did something like this:

logging.debug("My super-awesome patch should be merged!")

In order for the string "My super-awesome patch should be merged!" to
be marked for translation into non-English languages, it must be
surrounded with the _() function call (which is injected into the
builtin functions collection by gettext).

So, to satisfy i18n requirements, you would want to change the above
code to this:

logging.debug(_("My super-awesome patch should be merged!"))

Important:

When you have strings that have formatting markers in them (like %s),
LEAVE the formatting markers in place.

For example, this:

logging.debug("My name is %s", "Jay Pipes")

would be changed to:

logging.debug(_("My name is %s"), "Jay Pipes")

Note that the _() surrounds ONLY the string to be translated and not
the arguments that fill in a formatting marker.

For users:

I will be working with Monty Taylor on automating the process of
building the message templates and exporting them to Launchpad's
translations utility for string translation by users and contributors
alike.  All non-English-language speakers will be able to translate
the strings used in Nova's binaries and log messages into their local
language of choice.  I will be sending out another email with
instructions on how to do this. Stay tuned.

Please don't hesitate to ask questions about this on the mailing list!
I'm happy to help.

Cheers,
jay




More information about the Openstack mailing list