[issue17067] Examples in documentation for 3.x in 23.1.3.4. Deferred translations are rather weak

2021-10-21 Thread Irit Katriel


Irit Katriel  added the comment:

I can't find DeferredTranslation in the current codebase, and in any case the 
response from 8 years ago seems to be leaning towards reject.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue17067] Examples in documentation for 3.x in 23.1.3.4. Deferred translations are rather weak

2013-01-28 Thread Carsten Klein

New submission from Carsten Klein:

The examples for the topic presented are rather weak. In fact, they merely 
present do nothing replacements for an actually working, deferred localization 
mechanism or some sort of prototypical implementation thereof.

As such I propose that they be replaced with something more meaningful,
for example such as 


class DeferredTranslation(object):

def __init__(self, message, ...):

self.message = message

def __str__(self):

return gettext.translation(...).lgettext(self.message)


def _(message, ...):

return DeferredTranslation(message, ...)


MSG = _('localized message')


Or something else along that way other than the currently presented examples :D

--
assignee: docs@python
components: Documentation
messages: 180882
nosy: carsten.kl...@axn-software.de, docs@python
priority: normal
severity: normal
status: open
title: Examples in documentation for 3.x in 23.1.3.4. Deferred translations are 
rather weak
type: enhancement
versions: Python 3.3

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



[issue17067] Examples in documentation for 3.x in 23.1.3.4. Deferred translations are rather weak

2013-01-28 Thread R. David Murray

R. David Murray added the comment:

Thanks for your suggestion, but...

The example currently in the docs is exactly how we do deferred translation in 
the project I am currently working on.  Your example is much more complex, and 
I don't see the benefit of it.

Specifically, using the example in the docs you can easily mix deferred 
translations with non-deferred translations, which what you generally end up 
wanting to do in real code.  (You use deferred translation with strings that 
are defined at import time, as in the example, and non-deferred with strings 
that are computed at runtime.)

Perhaps there is a need for additional text about how this works in practice, 
including an example of switching the language dynamically during runtime.

--
nosy: +r.david.murray

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



[issue17067] Examples in documentation for 3.x in 23.1.3.4. Deferred translations are rather weak

2013-01-28 Thread R. David Murray

R. David Murray added the comment:

Sorry, I didn't mean computed at runtime, I meant defined in code where the _ 
call is *executed* at runtime, rather than at import time.

--

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