diff options
author | Daiki Ueno <ueno@gnu.org> | 2015-01-28 16:50:20 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2015-01-29 12:31:50 +0900 |
commit | 96dde0b8bdf6e4930f22556412d1680721929cd1 (patch) | |
tree | bcb636a22b8c7080a7945d9f649f75f4ff274689 /gettext-tools/doc | |
parent | 2d36f1e1de7521090272b88f161711f95228c19d (diff) | |
download | external_gettext-96dde0b8bdf6e4930f22556412d1680721929cd1.zip external_gettext-96dde0b8bdf6e4930f22556412d1680721929cd1.tar.gz external_gettext-96dde0b8bdf6e4930f22556412d1680721929cd1.tar.bz2 |
msgfilter: Add --newline option
The filter program was supposed to handle translation without a
newline character at the end of line. This was causing
portability problems with standard text processing programs on
some platforms (BSD sed, for instance) and not friendly towards
POSIX, where a "text file" is required to have an ending newline.
The new --newline option controls the behavior. If it is given,
both filter input and output are assumed to end with a newline
character.
* gettext-tools/src/msgfilter.c (newline): New variable.
(long_options): Add --newline option.
(main): Handle --newline option.
(usage): Document --newline option.
(process_string_with_newline): New function which wraps
process_string.
(process_message): Use process_string_with_newline instead of
process_string if --newline is specified.
* gettext-tools/tests/msgfilter-8: New file.
* gettext-tools/tests/Makefile.am (TESTS): Add new test.
* gettext-tools/doc/msgfilter.texi: Document --newline option.
Diffstat (limited to 'gettext-tools/doc')
-rw-r--r-- | gettext-tools/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gettext-tools/doc/msgfilter.texi | 23 |
2 files changed, 20 insertions, 7 deletions
diff --git a/gettext-tools/doc/ChangeLog b/gettext-tools/doc/ChangeLog index 109505b..5f618a0 100644 --- a/gettext-tools/doc/ChangeLog +++ b/gettext-tools/doc/ChangeLog @@ -1,3 +1,7 @@ +2015-01-28 Daiki Ueno <ueno@gnu.org> + + * msgfilter.texi: Document --newline option. + 2015-01-05 Daiki Ueno <ueno@gnu.org> * gettext.texi (Vala): New section. diff --git a/gettext-tools/doc/msgfilter.texi b/gettext-tools/doc/msgfilter.texi index 1fae251..758f7a4 100644 --- a/gettext-tools/doc/msgfilter.texi +++ b/gettext-tools/doc/msgfilter.texi @@ -73,6 +73,14 @@ input and writes a modified translation to standard output. A frequently used filter is @samp{sed}. A few particular built-in filters are also recognized. +@table @samp +@itemx --newline +@opindex --newline@r{, @code{msgfilter} option} +Add newline at the end of each input line and also strip the ending +newline from the output line. + +@end table + @cindex @code{msgfilter} filter and catalog encoding Note: If the filter is not a built-in filter, you have to care about encodings: It is your responsibility to ensure that the @var{filter} can cope @@ -86,13 +94,14 @@ you can first convert the translation catalog to UTF-8 using the locale, by using the @code{LC_ALL} environment variable. @cindex portability problems with @code{sed} -Note: Most translations in a translation catalog don't end with a newline -character. For this reason, it is important that the @var{filter} -recognizes its last input line even if it ends without a newline, and that -it doesn't add an undesired trailing newline at the end. The @samp{sed} -program on some platforms is known to ignore the last line of input if it -is not terminated with a newline. You can use GNU @code{sed} instead; it -does not have this limitation. +Note: Most translations in a translation catalog don't end with a +newline character. For this reason, unless the @code{--newline} +option is used, it is important that the @var{filter} recognizes its +last input line even if it ends without a newline, and that it doesn't +add an undesired trailing newline at the end. The @samp{sed} program on +some platforms is known to ignore the last line of input if it is not +terminated with a newline. You can use GNU @code{sed} instead; it does +not have this limitation. @subsection Useful @var{filter-option}s when the @var{filter} is @samp{sed} |