Issue 1098749: Single-line option to pygettext.py (original) (raw)

Created on 2005-01-09 03:01 by blais, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
patch blais,2005-01-09 03:01 Patch of pygettext.py against 2.4
issue1098749.diff belopolsky,2010-07-19 01:34 Patch against py3k revision 82959 review
Messages (7)
msg47502 - (view) Author: Martin Blais (blais) * (Python committer) Date: 2005-01-09 03:01
i added an option that make pygettext consider certain multi-line strings as single-line strings. If you're using an editor like kbabel, it's nice, you don't see the newlines. This comes really handy for strings to be used as HTML, where line breaks don't matter (and I'm sure for many other uses). You can select which keywords trigger this special extraction. All the other gettext tools work normally. Default behaviour does not change. I use it something like this: POTCMD = pygettext.py \ --verbose --extract-all --no-default-keywords \ --keyword-single=_ --keyword-single=N_ \ --keyword=__ ... pot: (POTCMD)−d(POTCMD) -d (POTCMD)d(PROJECT) -p (dir(dir (dir@) $(PYFILES) cheers,
msg47503 - (view) Author: Nobody/Anonymous (nobody) Date: 2005-09-22 07:45
Logged In: NO Code review.... 1. You have a few lines like : s = '%s' % ' '.join(newlines) Surely that is the same as just: s = ' '.join(newlines) 2. You use the single line option value as part of the key in __messages dictionary. That means that the output will have duplicate msgid values if your source contains both _normal('hello world') and _single('hello world'). Other GNU gettext tools assume that there will not be duplicates. (assuming --keyword=_normal --keyword-single=_single) 3. You also get duplicates for: _single("""this is one line and this is another""") and _single("""this is one line and this is another""") because normalization is performed just before output. Unless Im missing something, I think the right solution to these two problems is to normalize before calling __addentry, and leave the key to __messages as it was originally.
msg59750 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-01-11 21:11
Is this change still useful for 2.6?
msg110703 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-19 01:33
A rare example of a 5-year old patch that still applies with only a minor tweak. This is probably a sign that pygettext itself has not been kept up to date. In any case, I am attaching an updated patch which I did not test beyond running pygettext.py -h. There was no response from OP to the patch review and from a brief look at the patch, it is not commit ready. I am adding this as a dependency to meta-issue #7962 so that the fate of this patch and pygettext itself can be decided.
msg114992 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-26 15:50
My gut reaction is that pygettext should be deprecated, other opinions are welcome.
msg203395 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-19 16:05
New changeset 4fe87b5df2d0 by Andrew Kuchling in branch '3.3': #1098749: re-word gettext docs to not encourage using pygettext so much. http://hg.python.org/cpython/rev/4fe87b5df2d0
msg203396 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2013-11-19 16:11
I've applied a patch from #8502 that doesn't encourage the use of pygettext.py so strongly. I raised the issue of deprecating pygettext.py on python-dev on Nov 11 2013; the thread starts at <https://mail.python.org/pipermail/python-dev/2013-November/130123.html>. Barry Warsaw and Philip Jenvey suggested deprecating it; Martin von Loewis was OK with continuing to maintain pygettext. So I'll leave this issue open, in case anyone wants to review the patch and commit it.
History
Date User Action Args
2022-04-11 14:56:09 admin set github: 41413
2020-11-07 02:45:54 iritkatriel set versions: + Python 3.9, Python 3.10, - Python 3.2
2014-12-31 16:23:24 akuchling set nosy: - akuchling
2014-02-03 15:46:18 BreamoreBoy set nosy: - BreamoreBoy
2013-11-19 16:11:49 akuchling set messages: +
2013-11-19 16:05:40 python-dev set nosy: + python-devmessages: +
2010-12-30 22:14:16 georg.brandl unlink issue7962 dependencies
2010-11-05 20:30:54 eric.araujo set nosy: + eric.araujo
2010-08-26 15:50:45 BreamoreBoy set nosy: + BreamoreBoymessages: +
2010-08-07 20:22:59 terry.reedy set versions: + Python 3.2, - Python 2.6
2010-07-19 01:34:11 belopolsky set files: + issue1098749.diff
2010-07-19 01:33:50 belopolsky set nosy: + belopolskymessages: + type: enhancementstage: patch review
2010-07-19 01:32:16 belopolsky link issue7962 dependencies
2008-01-11 21:11:58 akuchling set nosy: + akuchlingmessages: + versions: + Python 2.6, - Python 2.4
2005-01-09 03:01:53 blais create