diff options
author | Bruno Haible <bruno@clisp.org> | 2007-10-22 01:42:25 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-06-23 12:15:22 +0200 |
commit | e1b1b593f018e8334300ce948d87c4fe42a402ea (patch) | |
tree | 8c6cb29d5878a57cb39ada7c56b2488e0e4aeb91 /gettext-tools/src | |
parent | b4621cf20c4b8d6d5d4fba750d374c929128745c (diff) | |
download | external_gettext-e1b1b593f018e8334300ce948d87c4fe42a402ea.zip external_gettext-e1b1b593f018e8334300ce948d87c4fe42a402ea.tar.gz external_gettext-e1b1b593f018e8334300ce948d87c4fe42a402ea.tar.bz2 |
Normalize the leading space of every comment line during the input phase
rather than during output.
Diffstat (limited to 'gettext-tools/src')
-rw-r--r-- | gettext-tools/src/ChangeLog | 12 | ||||
-rw-r--r-- | gettext-tools/src/read-catalog-abstract.c | 19 | ||||
-rw-r--r-- | gettext-tools/src/write-po.c | 4 | ||||
-rw-r--r-- | gettext-tools/src/write-stringtable.c | 8 |
4 files changed, 34 insertions, 9 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index 837e6e4..f870e01 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,15 @@ +2007-10-21 Bruno Haible <bruno@clisp.org> + + Normalize the leading space of every comment line during input, not + during output. + * read-catalog-abstract.c (po_callback_comment_dispatcher): Before + calling po_callback_comment or po_callback_comment_dot, drop the + leading space. + * write-po.c (message_print_comment, message_print_comment_dot): Don't + remove the leading space of every comment line. + * write-stringtable.c (write_message): Likewise. + Suggested by Dwayne Bailey <dwayne@translate.org.za>. + 2007-10-20 Bruno Haible <bruno@clisp.org> * msgmerge.c (message_merge): Set the fuzzy flag if the msgid_plural diff --git a/gettext-tools/src/read-catalog-abstract.c b/gettext-tools/src/read-catalog-abstract.c index 56385ee..e78a031 100644 --- a/gettext-tools/src/read-catalog-abstract.c +++ b/gettext-tools/src/read-catalog-abstract.c @@ -1,5 +1,5 @@ /* Reading PO files, abstract class. - Copyright (C) 1995-1996, 1998, 2000-2006 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 1998, 2000-2007 Free Software Foundation, Inc. This file was written by Peter Miller <millerp@canb.auug.org.au> @@ -649,7 +649,14 @@ void po_callback_comment_dispatcher (const char *s) { if (*s == '.') - po_callback_comment_dot (s + 1); + { + s++; + /* There is usually a space before the comment. People don't + consider it part of the comment, therefore remove it here. */ + if (*s == ' ') + s++; + po_callback_comment_dot (s); + } else if (*s == ':') { /* Parse the file location string. The appropriate callback will be @@ -669,6 +676,12 @@ po_callback_comment_dispatcher (const char *s) if (po_parse_comment_solaris_filepos (s)) /* Do nothing, it is a Sun-style file pos line. */ ; else - po_callback_comment (s); + { + /* There is usually a space before the comment. People don't + consider it part of the comment, therefore remove it here. */ + if (*s == ' ') + s++; + po_callback_comment (s); + } } } diff --git a/gettext-tools/src/write-po.c b/gettext-tools/src/write-po.c index 915af0e..105d062 100644 --- a/gettext-tools/src/write-po.c +++ b/gettext-tools/src/write-po.c @@ -246,7 +246,7 @@ message_print_comment (const message_ty *mp, ostream_t stream) { const char *e; ostream_write_str (stream, "#"); - if (*s != '\0' && *s != ' ') + if (*s != '\0') ostream_write_str (stream, " "); e = strchr (s, '\n'); if (e == NULL) @@ -284,7 +284,7 @@ message_print_comment_dot (const message_ty *mp, ostream_t stream) { const char *s = mp->comment_dot->item[j]; ostream_write_str (stream, "#."); - if (*s != '\0' && *s != ' ') + if (*s != '\0') ostream_write_str (stream, " "); ostream_write_str (stream, s); ostream_write_str (stream, "\n"); diff --git a/gettext-tools/src/write-stringtable.c b/gettext-tools/src/write-stringtable.c index 2c84927..4544c64 100644 --- a/gettext-tools/src/write-stringtable.c +++ b/gettext-tools/src/write-stringtable.c @@ -1,5 +1,5 @@ /* Writing NeXTstep/GNUstep .strings files. - Copyright (C) 2003, 2006 Free Software Foundation, Inc. + Copyright (C) 2003, 2006-2007 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2003. This program is free software: you can redistribute it and/or modify @@ -110,7 +110,7 @@ write_message (ostream_t stream, const message_ty *mp, if (c_strstr (s, "*/") == NULL) { ostream_write_str (stream, "/*"); - if (*s != '\0' && *s != '\n' && *s != ' ') + if (*s != '\0' && *s != '\n') ostream_write_str (stream, " "); ostream_write_str (stream, s); ostream_write_str (stream, " */\n"); @@ -120,7 +120,7 @@ write_message (ostream_t stream, const message_ty *mp, { const char *e; ostream_write_str (stream, "//"); - if (*s != '\0' && *s != '\n' && *s != ' ') + if (*s != '\0' && *s != '\n') ostream_write_str (stream, " "); e = strchr (s, '\n'); if (e == NULL) @@ -163,7 +163,7 @@ write_message (ostream_t stream, const message_ty *mp, { const char *e; ostream_write_str (stream, "//"); - if (first || (*s != '\0' && *s != '\n' && *s != ' ')) + if (first || (*s != '\0' && *s != '\n')) ostream_write_str (stream, " "); if (first) ostream_write_str (stream, "Comment: "); |