Commit Graph

27 Commits

Author SHA1 Message Date
Tim Peters 182b5aca27 Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
Martin v. Löwis 8f0bd5657a Declare encoding. Use unsigned long constants. Fixes #728277. 2003-05-09 08:59:17 +00:00
Barry Warsaw e04ee70a68 Mostly reformatting, splitting long lines, whitespace normalization
etc.

Fixed one typo in the __main__ section.
2003-04-16 18:08:23 +00:00
Martin v. Löwis 0d1fdea8ef Patch #494845: Support string concatenation, detect non-string data,
add globbing support, find modules by name instead of by file.
2002-11-22 08:36:54 +00:00
Barry Warsaw 63ce5af496 Added the -X/--no-docstrings flag which takes a filename containing a
list of files to not extract docstrings from when the -D option is
given.  This isn't optimal, but I didn't want to change the semantics
of -D, and it's bad form to allow optional switch arguments.

Bumping __version__ to 1.4.

TokenEater.__init__(): Initialize __curfile to None.

__waiting(): In order to extract docstrings from the module, both the
    -D flag should be set, and the __curfile should not be named in
    the -X filename (i.e. it isn't in opts.nodocstrings).

set_filename(): Fixed a bug where once the first module docstring is
    extracted, no subsequent module docstrings will be extracted.  The
    bug was that the first extraction set __freshmodule to 0, but that
    flag was never reset back to 1.  set_filename() is always called
    when the next file is being processed, so use it to reset the
    __freshmodule flag.

main(): Add support for -X/--no-docstring.
2001-07-27 16:47:18 +00:00
Barry Warsaw 5c94ce58e7 write(): Karl Eichwalder points out that the #, flag comments should
be outputted just before the msgid lines.
2001-06-20 19:41:40 +00:00
Barry Warsaw 8c78d3a5d1 write(): It's been generally agreed on the i18n-sig that the docstring
marker should be output as a #, flag, e.g. "#, docstring".
2001-06-19 19:54:19 +00:00
Barry Warsaw 50cf706b5c write(): Aggressively sort all catalog entries, and fix the bug where
there were multiple translatable strings on a single line of source
code.
2001-05-24 23:06:13 +00:00
Barry Warsaw 128c77d03a write(): Do two levels of sorting: first sort the individual location
tuples by filename/lineno, then sort the catalog entries by their
location tuples.
2001-05-23 16:59:45 +00:00
Barry Warsaw 2b63969a5a main(): default-domain argument to getopt.getopt() was missing a = to
indicate it took an argument.  This closes SF patch #402223 by Bastian
Kleineidam.
2001-05-21 19:58:23 +00:00
Barry Warsaw 16b62c1300 __addentry(): add optional keyword arg `isdocstring' which is a flag
indicating whether the entry was extracted from a docstring or not.

write(): If any of the locations of a string appearance came from a
docstring, add a comment such as

#. docstring

before the references (after a suggestion by Martin von Loewis).
2001-05-21 19:51:26 +00:00
Barry Warsaw 6e972414be write(): A patch inspired by Tokio Kikuchi that sorts location entries
first by filename and then by line number.  Closes SF patch #425821.

Also, fixes a problem with duplicate entries.
2001-05-21 19:35:20 +00:00
Barry Warsaw 78d7dc4979 Added -o/--output-file option as per GNU msgfmt to specify the output
file instead of using inputfilename.mo
2001-03-02 16:53:54 +00:00
Martin v. Löwis 0f6b3832b9 Put current date into POT-Creation-Date; leave PO-Revision-Date for
for the translator to update; that is compatible with xgettext 0.10.35.
2001-03-01 22:56:17 +00:00
Barry Warsaw 75ee8f54fa main(): Slightly more informative error message when TokenError
occurs.  Also, continue processing.
2001-02-26 04:46:53 +00:00
Barry Warsaw 08a8a355be Added the -D/--docstrings option for extraction of unmarked module,
class, method, and function docstrings.
2000-10-27 04:56:28 +00:00
Fred Drake 33e2c3ece3 Remove bogus stdout redirection and use of sys.__stdout__; use
augmented print statement instead.
2000-10-26 03:49:15 +00:00
Barry Warsaw 72dacb8026 Tool to generate binary GNU .mo file from .po template files. Written
by Martin v. Loewis, proofed by Barry Warsaw for coding standards,
typos, and to make command line options compatible with GNU msgfmt
where they overlap.

Closes patch #101295.
2000-09-01 08:10:08 +00:00
Barry Warsaw 75a6e67e69 Added an unused Unicode string for testing. 2000-05-02 19:28:30 +00:00
Barry Warsaw a17e0f1b61 A bunch of changes, primarily to command line argument parsing
(inspired by Detlef Lannert).  Specifically,

    -k/--keyword no longer takes an optional argument to clear the
    default keywords.  Instead, use -K/--no-default-keywords to clear
    them.

    -n/--add-location also no longer takes an optional argument to set
    the comment style.  Instead, use -S/--style to set the comment
    style to GNU or Solaris.

    -o/--output can take `-' as the filename, meaning write to
    standard output.

    The inputfile name can also be `-' meaning read from standard in.

A few other changes include

    Kludge to mark the file docstring as translatable.  Since the
    marking is to place _() around the docstring, and because we
    actually have to define the _() function before we use it, this
    means that we have to manually assign to __doc__ the output of
    _().  This doesn't seem too bad because you'll only use this idiom
    when translating a script's docstring (you really don't need to
    translate most module docstrings).

    Convert everything to string methods and do not import the string
    module.

    Bump the version number to 1.1
2000-03-08 15:18:35 +00:00
Barry Warsaw 7733e12c9c Two buglet fixes. Peter Funk caught the bug in make_escapes:
This will fold all ISO 8859 chars from the upper half of the
    charset into the lower half, which is ...ummm.... unintened.

The second is a typo in the reference to options.escape in main().
2000-02-27 14:30:48 +00:00
Barry Warsaw c8f0892d12 Changes submitted by Peter Funk (some fixes/additions by B.Warsaw) to
make pygettext more compatible with GNU xgettext, specifically:

Added -E/--escape for allowing pass-thru of iso8859-1 characters above
7 bits.

Added -o/--output option for renaming the output file from
messages.pot (there's overlap with -d/--default-domain, but GNU
xgettext has them both).

Added -p/--output-dir for specifying the output directory for
messages.pot.

Added -V/--version for printing the version number.

Added -w/--width for specifying the output page width (this is because
now pygettext, like GNU xgettext will put several locations on the
same line to cut down on vertical space).

Added -x/--exclude-file for specifying a list of strings that are not
to be extracted from the input files.

Bumped version number to 1.0

Try to import fintl and use fintl.gettext as _ if available.  Fall
back is to use identity definition of _().

Moved the escape creation to a function make_escapes() so that its
behavior can be controlled by the -E option.

__openseen(): Support the -x option.

write(): Support -w option and vertical space preserving feature.

main(): Support new options.
2000-02-26 20:56:47 +00:00
Barry Warsaw 8f35681843 Added \" to escapes so embedded escaped double quotes are handled
correctly.  Patch suggested by Mads Kiilerich <mk@solit.dk>.
1999-12-06 02:46:49 +00:00
Barry Warsaw 5dbf526e8e Several improvements, some of where were contributed by Bernhard
Herzog <herzog@online.de>.  Specifically,

--verbose/-v flag added

pot_header added to make msgmerge and Emacs po-mode work better

normalize(), escape(), safe_eval(): Improved normalization of strings
for more .po file compatibility (e.g. C style).  Handles emmbedded
newlines better.

Also added an identity function called _() and use it in the file
where messages are printed.  This allows us to selftest pygettext.py
with itself as input.
1999-11-03 18:47:52 +00:00
Barry Warsaw a507c32991 Python equivalent of xgettext(1). This was originally released
separately but now is included in the standard Python distribution.
1999-11-03 16:46:05 +00:00
Barry Warsaw e27db5a393 Initial implementation 1999-08-13 20:59:48 +00:00
Barry Warsaw af5725104b Initial revision 1999-08-11 21:40:38 +00:00