R. David Murray added the comment:

install says this:

    This installs the function _() in Python’s builtins namespace, based on 
domain, localedir, and codeset which are passed to the function translation()

Unless I'm misunderstanding something, this means that the actual value of _ is 
different depending on which domain, localedir, and codeset are in use.  So if 
my application allows the user to *change languages* at runtime, I need to 
*change* what is bound to _.  If my program has assigned a value to _, when 
another part of the application changes the language, what is bound to _ in 
other modules is not going to change.  This is my understanding of why _ is put 
in the global namespace.

Of course, I've only used gettext in one application (that did dynamic language 
switching), so I could just have been doing it wrong...and I suppose there is 
no reason (and some sense) why _ could not be a function that indirects to the 
current language.  Or is that the way it works now and I am just 
misunderstanding the documentation?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18217>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to