Difference between " and '

François Pinard pinard at iro.umontreal.ca
Fri Jul 22 11:13:03 EDT 2005


[Terry Hancock]

> On Friday 22 July 2005 08:09 am, François Pinard wrote:
>
> > [Robert Kern]
> >
> > > One habit that seems to crop up, though, is that I will use '' for
> > > internal strings and "" for strings that will eventually get seen
> > > by the user.  Don't ask me why.

> > One sure thing is that it would help, later, if you ever want to
> > internationalise a Python program.  Not that it occurs that often! :-)

> Whoa.  Why?  Does xgettext not recognize _('')?

Yes, of course.

The most tedious part of internationalising a project is the selection
of strings to be translated, among all program strings, and wrapping
these within the special _(...) construct.  If you can _already_ rely
on the fact double-quote strings are always to be wrapped, and that
single-quote strings are never to be wrapped, the tedious part is
already done, or almost.  A few relatively quick editor commands are
may complete that aspect of the work (provided you use a reasonably
featureful editor).

As for Using xgettext or its Python counterpart, this is usually burned
into the release engineering (Makefile, distutils, or else), and is not
much of an effort, once you found a good recipe or example for it.

-- 
François Pinard   http://pinard.progiciels-bpi.ca



More information about the Python-list mailing list