[Python-projects] false positive with the _() symbol from gettextmodule

chaica chaica at ohmytux.com
Wed Jun 17 22:16:08 CEST 2009


Hi,

My program runs and uses internationalization, switching the strings
following the system locales. My setting is really close from the
official documentation (here :
http://www.python.org/doc/2.6.2/library/gettext.html#localizing-your-application ).

my import is : 
import gettext
[snip]
after that :
if __name__ == '__main__':
    gettext.install('bel', unicode=1)
[snip]

after that, my string have the _() symbol around, as documented. My
program currently supports French and English.

You can read the code if needed at
http://www.ohmytux.com/belier/belier-1.0.tar.gz

Bye,
Carl chenet




Le mercredi 17 juin 2009 à 15:58 -0400, Rasener, Dustin M a écrit :
> We use gettext here, along with pylint.  Are you sure that your import
> statement is correct?  Does it look something like this?
> 
> 	from django.utils.translation import ugettext as _
> 
> Our project is using Django, if yours is not, this import will
> necessarily be different.
> 
> Dustin
> 
> -----Original Message-----
> From: python-projects-bounces at lists.logilab.org
> [mailto:python-projects-bounces at lists.logilab.org] On Behalf Of chaica
> Sent: Wednesday, June 17, 2009 3:41 PM
> To: python-projects at lists.logilab.org
> Subject: [Python-projects] false positive with the _() symbol from
> gettextmodule
> 
> Hi,
> 
> Using the gettext module for internationalization, you have to put the
> _() symbol around each string you want to translate. Pylint seems unable
> to recognize this symbol and triggers an error : 
> 
> E: 60:Terminal.extrait_ordres: Undefined variable '_'
> E: 66:Terminal.extrait_ordres: Undefined variable '_'
> E: 72:Terminal.extrait_ordres: Undefined variable '_'
> E: 77:Terminal.extrait_ordres: Undefined variable '_'
> E: 82:Terminal.extrait_ordres: Undefined variable '_'
> E: 87:Terminal.extrait_ordres: Undefined variable '_'
> 
> Bye,
> Carl Chenet
> 
> _______________________________________________
> Python-Projects mailing list
> Python-Projects at lists.logilab.org
> http://lists.logilab.org/mailman/listinfo/python-projects



More information about the Python-Projects mailing list