[issue18217] Deprecate and remove gettext.install

2022-03-19 Thread Irit Katriel


Irit Katriel  added the comment:

There were several votes in the discussion for rejecting this deprecation, so I 
am closing the issue.

--
nosy: +iritkatriel
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18217] Deprecate and remove gettext.install

2015-04-13 Thread A.M. Kuchling

A.M. Kuchling added the comment:

I suggest we just close this ticket.  I tried producing a documentation patch 
(attached), but they seem like a marginal improvement.  

(I don't think the text in the docs such as 'gettext' (bound to 
self.gettext()) is confusing; given the context, I think the reader will 
assume it's bound to the method and not to the results of calling that method.)

--
nosy: +akuchling
Added file: http://bugs.python.org/file38926/issue18217.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18217
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18217] Deprecate and remove gettext.install

2014-03-13 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Mar 13, 2014, at 05:15 AM, Éric Araujo wrote:

The source contains :meth:`self.gettext`, and Sphinx adds the parentheses
when creating markup for a function, probably because it’s common to say
things like “the len() function”.  There is a Sphinx config value to control
that.  If one wants to keep the parens for most functions but not have them
in a few cases, other markup than :meth:/:func: has to be used.

The defaults should definitely be kept for :meth: and :func:

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18217
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18217] Deprecate and remove gettext.install

2014-03-12 Thread Éric Araujo

Éric Araujo added the comment:

 The doc for NullTranslations.install needs the erroneous '()'s removed to 
 make clear
 that the bindings are to bound methods and not the result of calls to bound 
 methods.
 Ie, self.gettest() should be just self.gettext.

The source contains :meth:`self.gettext`, and Sphinx adds the parentheses when 
creating markup for a function, probably because it’s common to say things like 
“the len() function”.  There is a Sphinx config value to control that.  If one 
wants to keep the parens for most functions but not have them in a few cases, 
other markup than :meth:/:func: has to be used.

--
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18217
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18217] Deprecate and remove gettext.install

2013-06-27 Thread Jakub Wilk

Changes by Jakub Wilk jw...@jwilk.net:


--
nosy: +jwilk

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-21 Thread Éric Araujo

Éric Araujo added the comment:

Working with an explicit translator object sounds much better to me too.  I 
haven’t used it yet, but Babel has been on my radar for long, and does that 
(like flufl.i18n from what I can tell).

--
nosy: +eric.araujo

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-21 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Jun 21, 2013, at 04:18 PM, Éric Araujo wrote:

Working with an explicit translator object sounds much better to me too.  I
haven’t used it yet, but Babel has been on my radar for long, and does that
(like flufl.i18n from what I can tell).

flufl.enum didn't make it into the stdlib.  Think I'd have more luck with
flufl.i18n? ;)

--

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The rationale for install is For convenience, you want the _() function to be 
installed in Python’s builtins namespace, so it is easily accessible in all 
modules of your application. As David noted, this also make it easy to update 
_ in just one place when a new language is selected.

Alex disagrees and would like to break any code that uses install, which I 
thing is much code, by removing it. This would force writers to do something 
else that will be *much* more work and which might make code harder to read. We 
do not do this without much greater reason than Alex has given. I think this a 
bad deprecation proposal and should be rejected. I also think the idea should 
have been posted to python-ideas first.

I do think that this should become a doc issue to clarify the meaning and usage 
of install.

The link Alex gave was to NullTranslations.install. The module install function 
itself is at
http://hg.python.org/cpython/file/01da7bf11ca1/Lib/gettext.py#l424

The doc for install could be much improved to say what it actually does.

Pass *domain*, *localedir*, fallback=True, and *codeset* to translation, which 
returns translation instance t. Pass *names* to t.install. The default install 
method, NullTranslations.install link, which is inherited by GNUTranslations 
link, installs t.gettext in builtins as _. See the description of translation 
and NullTranslations.install for the meaning of the parameters.
+ rationale quoted above

This expanded doc would make it clearer that one can write a custom subclass of 
NullTranslations with a custom .install method that would do something 
different, such as bind _ to a dynamic (indirect) gettext, whether in builtins 
or in a project module that is explicitly imported by every module that needs 
it.

The doc for NullTranslations.install needs the erroneous '()'s removed to make 
clear that the bindings are to bound methods and not the result of calls to 
bound methods. Ie, self.gettest() should be just self.gettext.

--
nosy: +terry.reedy
type:  - enhancement
versions: +Python 3.4

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-14 Thread Alex Gaynor

New submission from Alex Gaynor:

There's a myriad of reasons it's a bad idea:

* Makes code harder to read
* Doesn't play nicely with multiple projects using gettext
* Defeats any attempt at static analysis
* etc...

--
messages: 191152
nosy: alex
priority: normal
severity: normal
status: open
title: Deprecate and remove gettext.install

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-14 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-14 Thread R. David Murray

R. David Murray added the comment:

How would you do dynamic switching of translation locale at runtime, then?

--
nosy: +r.david.murray

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-14 Thread Alex Gaynor

Alex Gaynor added the comment:

I'm not sure I understand the question. What `install()` does is set 
`__builtins__._` to be gettext. I think people should import the gettext 
function they need.

--

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-14 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Jun 14, 2013, at 09:27 PM, R. David Murray wrote:

How would you do dynamic switching of translation locale at runtime, then?

flufl.i18n :)

http://pythonhosted.org/flufl.i18n/

--

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-14 Thread R. David Murray

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



[issue18217] Deprecate and remove gettext.install

2013-06-14 Thread Alex Gaynor

Alex Gaynor added the comment:

I think the code makes what this does much clearer: 
http://hg.python.org/cpython/file/01da7bf11ca1/Lib/gettext.py#l209

There's no reason you can't make your own translation object, and expose it's 
gettext method as as your API, and then you can update the underlying 
translation object to check locales. This is approximately exactly how Django 
works.

--

___
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



[issue18217] Deprecate and remove gettext.install

2013-06-14 Thread R. David Murray

R. David Murray added the comment:

Which is what Barry's library does.

But rather than just deprecating install, I think we should fix the module so 
that it supports this directly.  That could be as simple as adding a dynamic 
translations class.

What does library code that wants to provide internationalization do, though?  
Right now they could just use _, and tell library users they need to call 
gettext.install in their application.  Is there some other technique that is 
currently used?

--

___
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