+2006-03-28 Bruno Haible <bruno@clisp.org>
+
+ * PACKAGING: Mention bin/recode* programs.
+
2005-12-29 Bruno Haible <bruno@clisp.org>
* build-aux/install-reloc: If hard linking is not possible, use a
* msgmerge is much faster now, when using a large compendium.
+* A new program recode-sr-latin is provided, that converts Serbian text from
+ the Cyrillic script to the Latin script.
+ The command "msgfilter recode-sr-latin" can be used to convert a Serbian
+ Cyrillic PO file (sr.po) to a Serbian Latin PO file (sr@latin.po).
+
* Programming languages support:
- C++ with Boost:
$prefix/bin/xgettext
$prefix/bin/gettextize
$prefix/bin/autopoint
+ $prefix/bin/recode*
$prefix/share/man/man1/msg*.1
$prefix/share/man/man1/xgettext.1
$prefix/share/man/man1/gettextize.1
+2006-03-28 Bruno Haible <bruno@clisp.org>
+
+ * msgfilter.texi: Explain built-in filters and recode-sr-latin.
+
2006-03-26 Bruno Haible <bruno@clisp.org>
* gettext.texi (Java): Recommend a simpler idiom for Java 1.5.
The @var{filter} can be any program that reads a translation from standard
input and writes a modified translation to standard output. A frequently
-used filter is @samp{sed}.
+used filter is @samp{sed}. A few particular built-in filters are also
+recognized.
@cindex @code{msgfilter} filter and catalog encoding
-Note: It is your responsibility to ensure that the @var{filter} can cope
+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
with input encoded in the translation catalog's encoding. If the
@var{filter} wants input in a particular encoding, you can in a first step
convert the translation catalog to that encoding using the @samp{msgconv}
@end table
+@subsection Built-in @var{filter}s
+
+@pindex recode-sr-latin
+@cindex @code{recode-sr-latin} program
+The filter @samp{recode-sr-latin} is recognized as a built-in filter.
+The command @samp{recode-sr-latin} converts Serbian text, written in the
+Cyrillic script, to the Latin script.
+The command @samp{msgfilter recode-sr-latin} applies this conversion to the
+translations of a PO file. Thus, it can be used to convert an @file{sr.po}
+file to an @file{sr@@latin.po} file.
+
+The use of built-in filters is not sensitive to the current locale's encoding.
+Moreover, when used with a built-in filter, @samp{msgfilter} can automatically
+convert the message catalog to the UTF-8 encoding when needed.
+
@subsection Input file syntax
@table @samp
+2006-03-28 Bruno Haible <bruno@clisp.org>
+
+ * filters.h: New file.
+ * filter-sr-latin.c: New file, based on code from Danilo Ĺ egan.
+ * recode-sr-latin.c: New file.
+ * msgfilter.c: Include filters.h, msgl-iconv.h, po-charset.h.
+ (filter): New variable.
+ (main): Recognize recode-sr-latin as built-in.
+ (generic_filter): New function, extracted from process_string.
+ (process_string): Call the filter.
+ * Makefile.am (bin_PROGRAMS): Add recode-sr-latin.
+ (noinst_HEADERS): Add filters.h.
+ (msgfilter_SOURCES): Add filter-sr-latin.c.
+ (recode_sr_latin_SOURCES, recode_sr_latin_LDADD,
+ recode_sr_latin_CPPFLAGS, recode_sr_latin_LDFLAGS): New variables.
+ * Makefile.msvc (PROGRAMS): Add recode-sr-latin.exe.
+ (msgfilter_OBJECTS): Add filter-sr-latin.obj.
+ (recode_sr_latin_OBJECTS): New variable.
+ (filter-sr-latin.obj, recode-sr-latin.obj): New rules.
+ (recode-sr-latin.exe): New rule.
+ (install): Also install recode-sr-latin.exe.
+ (uninstall): Also uninstall recode-sr-latin.exe.
+ * Makefile.vms (PROGRAMS): Add recode-sr-latin.exe.
+ (msgfilter_OBJECTS): Add filter-sr-latin.obj.
+ (recode_sr_latin_OBJECTS): New variable.
+ (filter-sr-latin.obj, recode-sr-latin.obj): New rules.
+ (recode-sr-latin.exe): New rule.
+ (install): Also install recode-sr-latin.exe.
+ (uninstall): Also uninstall recode-sr-latin.exe.
+
2006-03-28 Bruno Haible <bruno@clisp.org>
* msgl-iconv.c: Include iconvstring.h. Don't include <errno.h>.
bin_PROGRAMS = \
msgcmp msgfmt msgmerge msgunfmt xgettext \
-msgattrib msgcat msgcomm msgconv msgen msgexec msgfilter msggrep msginit msguniq
+msgattrib msgcat msgcomm msgconv msgen msgexec msgfilter msggrep msginit msguniq \
+recode-sr-latin
noinst_PROGRAMS = hostname urlget
read-resources.h write-resources.h \
read-tcl.h write-tcl.h \
write-qt.h \
-po-time.h plural-table.h lang-table.h format.h \
+po-time.h plural-table.h lang-table.h format.h filters.h \
xgettext.h x-c.h x-po.h x-sh.h x-python.h x-lisp.h x-elisp.h x-librep.h \
x-scheme.h x-smalltalk.h x-java.h x-properties.h x-csharp.h x-awk.h x-ycp.h \
x-tcl.h x-perl.h x-php.h x-stringtable.h x-rst.h x-glade.h
else
msgfilter_SOURCES = ../mingw/c++msgfilter.cc
endif
+msgfilter_SOURCES += filter-sr-latin.c
if !MINGW
msggrep_SOURCES = msggrep.c
else
else
msguniq_SOURCES = ../mingw/c++msguniq.cc
endif
+recode_sr_latin_SOURCES = recode-sr-latin.c filter-sr-latin.c
hostname_SOURCES = hostname.c
urlget_SOURCES = urlget.c
msginit_LDADD = ../intl/localename.@INTL_LIBTOOL_SUFFIX_PREFIX@o \
libgettextsrc.la @INTL_MACOSX_LIBS@
msguniq_LDADD = libgettextsrc.la @INTL_MACOSX_LIBS@
+recode_sr_latin_LDADD = ../lib/libgettextlib.la @INTL_MACOSX_LIBS@
# Specify installation directory, for --enable-relocatable.
msgcmp_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
msggrep_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
msginit_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
msguniq_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
+recode_sr_latin_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(bindir)\"
hostname_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(pkglibdir)\"
urlget_CPPFLAGS = $(AM_CPPFLAGS) -DINSTALLDIR=\"$(pkglibdir)\"
if RELOCATABLE_VIA_LD
msggrep_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
msginit_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
msguniq_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
+recode_sr_latin_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
hostname_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(pkglibdir)`
urlget_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(pkglibdir)`
endif
PROGRAMS = \
msgcmp.exe msgfmt.exe msgmerge.exe msgunfmt.exe xgettext.exe \
-msgattrib.exe msgcat.exe msgcomm.exe msgconv.exe msgen.exe msgexec.exe msgfilter.exe msggrep.exe msginit.exe msguniq.exe
+msgattrib.exe msgcat.exe msgcomm.exe msgconv.exe msgen.exe msgexec.exe msgfilter.exe msggrep.exe msginit.exe msguniq.exe \
+recode-sr-latin.exe
OBJECTS = \
message.obj \
msgconv_OBJECTS = msgconv.obj
msgen_OBJECTS = msgen.obj
msgexec_OBJECTS = msgexec.obj
-msgfilter_OBJECTS = msgfilter.obj
+msgfilter_OBJECTS = msgfilter.obj filter-sr-latin.obj
msggrep_OBJECTS = msggrep.obj
msginit_OBJECTS = msginit.obj lang-table.obj plural-count.obj localealias.obj
msguniq_OBJECTS = msguniq.obj
+recode_sr_latin_OBJECTS = recode-sr-latin.obj filter-sr-latin.obj
LDADD =
RESOURCES = gettextsrc.res
msguniq.obj : msguniq.c
$(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c -Tp msguniq.c
+filter-sr-latin.obj : filter-sr-latin.c
+ $(CC) $(INCLUDES) $(CFLAGS) -c filter-sr-latin.c
+
+recode-sr-latin.obj : recode-sr-latin.c
+ $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c recode-sr-latin.c
+
msgcmp.exe : $(msgcmp_OBJECTS)
$(CC) $(MFLAGS) $(DEBUGFLAGS) $(msgcmp_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(libdir)\iconv.lib $(LDADD) -Femsgcmp.exe
msguniq.exe : $(msguniq_OBJECTS)
$(CC) $(MFLAGS) $(DEBUGFLAGS) $(msguniq_OBJECTS) gettextsrc.lib ..\lib\gettextlib.lib ..\intl\intl.lib $(libdir)\iconv.lib $(LDADD) -Femsguniq.exe
+recode-sr-latin.exe : $(recode_sr_latin_OBJECTS)
+ $(CC) $(MFLAGS) $(DEBUGFLAGS) $(recode_sr_latin_OBJECTS) ..\lib\gettextlib.lib ..\intl\intl.lib $(libdir)\iconv.lib $(LDADD) -Ferecode-sr-latin.exe
+
# Compilation rules for gettextpo.lib objects, with $(PICFLAGS).
gettext-po.obj : gettext-po.c
$(INSTALL_PROGRAM) msggrep.exe $(bindir)\msggrep.exe
$(INSTALL_PROGRAM) msginit.exe $(bindir)\msginit.exe
$(INSTALL_PROGRAM) msguniq.exe $(bindir)\msguniq.exe
+ $(INSTALL_PROGRAM) recode-sr-latin.exe $(bindir)\recode-sr-latin.exe
-mkdir $(datadir)
-mkdir $(pkgdatadir)
$(INSTALL_DATA) msgunfmt.tcl $(pkgdatadir)\msgunfmt.tcl
$(RM) $(bindir)\msggrep.exe
$(RM) $(bindir)\msginit.exe
$(RM) $(bindir)\msguniq.exe
+ $(RM) $(bindir)\recode-sr-latin.exe
$(RM) $(pkgdatadir)\msgunfmt.tcl
$(RM) $(includedir)\gettext-po.h
!if $(DLL)
#### End of system configuration section. ####
-PROGRAMS = msgcmp.exe, msgfmt.exe, msgmerge.exe, msgunfmt.exe, xgettext.exe, msgattrib.exe, msgcat.exe, msgcomm.exe, msgconv.exe, msgen.exe, msgexec.exe, msgfilter.exe, msggrep.exe, msginit.exe, msguniq.exe
+PROGRAMS = msgcmp.exe, msgfmt.exe, msgmerge.exe, msgunfmt.exe, xgettext.exe, msgattrib.exe, msgcat.exe, msgcomm.exe, msgconv.exe, msgen.exe, msgexec.exe, msgfilter.exe, msggrep.exe, msginit.exe, msguniq.exe, recode-sr-latin.exe
OBJECTS = \
message.obj, \
msgconv_OBJECTS = msgconv.obj
msgen_OBJECTS = msgen.obj
msgexec_OBJECTS = msgexec.obj
-msgfilter_OBJECTS = msgfilter.obj
+msgfilter_OBJECTS = msgfilter.obj, filter-sr-latin.obj
msggrep_OBJECTS = msggrep.obj
msginit_OBJECTS = msginit.obj, lang-table.obj, plural-count.obj, localealias.obj
msguniq_OBJECTS = msguniq.obj
+recode_sr_latin_OBJECTS = recode-sr-latin.obj, filter-sr-latin.obj
all : gettextsrc.olb,$(PROGRAMS),gettextpo.olb
write sys$output "Nothing else to be done for 'all'."
msguniq.obj : msguniq.c
$(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS),"INSTALLPREFIX=""$(prefix)]""","INSTALLDIR=""$(bindir)]""") msguniq.c
+filter-sr-latin.obj : filter-sr-latin.c
+ $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS)) filter-sr-latin.c
+
+recode-sr-latin.obj : recode-sr-latin.c
+ $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS),"INSTALLPREFIX=""$(prefix)]""","INSTALLDIR=""$(bindir)]""") recode-sr-latin.c
+
libiconv.opt :
if f$search("sys$library:libiconv.olb") .nes. "" then $(LN) [-.-.vms]with-libiconv.opt libiconv.opt
if f$search("sys$library:libiconv.olb") .eqs. "" then $(LN) [-.-.vms]without-libiconv.opt libiconv.opt
msguniq.exe : $(msguniq_OBJECTS),libiconv.opt
link /executable=msguniq.exe $(msguniq_OBJECTS),gettextsrc.olb/lib,[-.lib]gettextlib.olb/lib,[-.intl]intl.olb/lib,$(LDADD)
+recode-sr-latin.exe : $(recode_sr_latin_OBJECTS),libiconv.opt
+ link /executable=recode-sr-latin.exe $(recode_sr_latin_OBJECTS),[-.lib]gettextlib.olb/lib,[-.intl]intl.olb/lib,$(LDADD)
+
# Compilation rules for gettextpo.olb objects.
gettext-po.obj : gettext-po.c
$(INSTALL_PROGRAM) msggrep.exe $(bindir)]msggrep.exe
$(INSTALL_PROGRAM) msginit.exe $(bindir)]msginit.exe
$(INSTALL_PROGRAM) msguniq.exe $(bindir)]msguniq.exe
+ $(INSTALL_PROGRAM) recode-sr-latin.exe $(bindir)]recode-sr-latin.exe
create /directory $(datadir)]
create /directory $(pkgdatadir)]
$(INSTALL_DATA) msgunfmt.tcl $(pkgdatadir)]msgunfmt.tcl
$(RM) $(bindir)]msggrep.exe;
$(RM) $(bindir)]msginit.exe;
$(RM) $(bindir)]msguniq.exe;
+ $(RM) $(bindir)]recode-sr-latin.exe;
$(RM) $(pkgdatadir)]msgunfmt.tcl;
$(RM) $(includedir)]gettext-po.h
$(RM) $(libdir)]gettextpo.olb
#include "findprog.h"
#include "pipe.h"
#include "wait-process.h"
+#include "filters.h"
+#include "msgl-iconv.h"
+#include "po-charset.h"
#include "gettext.h"
#define _(str) gettext (str)
static char **sub_argv;
static int sub_argc;
+/* Filter function. */
+static void (*filter) (const char *str, size_t len, char **resultp, size_t *lengthp);
+
/* Long options. */
static const struct option long_options[] =
{
__attribute__ ((noreturn))
#endif
;
+static void generic_filter (const char *str, size_t len, char **resultp, size_t *lengthp);
static msgdomain_list_ty *process_msgdomain_list (msgdomain_list_ty *mdlp);
/* Read input file. */
result = read_po_file (input_file);
- /* Warn if the current locale is not suitable for this PO file. */
- compare_po_locale_charsets (result);
+ /* Recognize special programs as built-ins. */
+ if (strcmp (sub_name, "recode-sr-latin") == 0 && sub_argc == 1)
+ {
+ filter = serbian_to_latin;
- /* Attempt to locate the program.
- This is an optimization, to avoid that spawn/exec searches the PATH
- on every call. */
- sub_path = find_in_path (sub_name);
+ /* Convert the input to UTF-8 first. */
+ result = iconv_msgdomain_list (result, po_charset_utf8, input_file);
+ }
+ else
+ {
+ filter = generic_filter;
+
+ /* Warn if the current locale is not suitable for this PO file. */
+ compare_po_locale_charsets (result);
- /* Finish argument list for the program. */
- sub_argv[0] = (char *) sub_path;
+ /* Attempt to locate the program.
+ This is an optimization, to avoid that spawn/exec searches the PATH
+ on every call. */
+ sub_path = find_in_path (sub_name);
+
+ /* Finish argument list for the program. */
+ sub_argv[0] = (char *) sub_path;
+ }
/* Apply the subprogram. */
result = process_msgdomain_list (result);
# endif
#endif
-/* Process a string STR of size LEN bytes through the subprogram, then
- remove NUL bytes.
+/* Process a string STR of size LEN bytes through the subprogram.
Store the freshly allocated result at *RESULTP and its length at *LENGTHP.
*/
static void
-process_string (const char *str, size_t len, char **resultp, size_t *lengthp)
+generic_filter (const char *str, size_t len, char **resultp, size_t *lengthp)
{
#if defined _MSC_VER || defined __MINGW32__
/* Native Woe32 API. */
error (EXIT_FAILURE, 0, _("%s subprocess terminated with exit code %d"),
sub_name, exitstatus);
+ *resultp = result;
+ *lengthp = length;
+#endif
+}
+
+
+/* Process a string STR of size LEN bytes, then remove NUL bytes.
+ Store the freshly allocated result at *RESULTP and its length at *LENGTHP.
+ */
+static void
+process_string (const char *str, size_t len, char **resultp, size_t *lengthp)
+{
+ char *result;
+ size_t length;
+
+ filter (str, len, &result, &length);
+
/* Remove NUL bytes from result. */
{
char *p = result;
*resultp = result;
*lengthp = length;
-#endif
}
+2006-03-28 Bruno Haible <bruno@clisp.org>
+
+ * recode-sr-latin-1: New file.
+ * recode-sr-latin-2: New file.
+ * msgfilter-sr-latin-1: New file.
+ * Makefile.am (TESTS): Add them.
+ (TESTS_ENVIRONMENT): Also set the RECODE variable.
+
2006-03-19 Bruno Haible <bruno@clisp.org>
* xgettext-9: New file.
msgen-1 msgen-2 msgen-3 \
msgexec-1 msgexec-2 msgexec-3 msgexec-4 \
msgfilter-1 msgfilter-2 msgfilter-3 msgfilter-4 \
+ msgfilter-sr-latin-1 \
msgfmt-1 msgfmt-2 msgfmt-3 msgfmt-4 msgfmt-5 msgfmt-6 msgfmt-7 \
msgfmt-8 msgfmt-9 msgfmt-10 msgfmt-11 msgfmt-12 msgfmt-13 msgfmt-14 \
msgfmt-15 \
msgunfmt-properties-1 \
msgunfmt-tcl-1 \
msguniq-1 msguniq-2 msguniq-3 msguniq-4 msguniq-5 \
+ recode-sr-latin-1 recode-sr-latin-2 \
xgettext-1 xgettext-2 xgettext-3 xgettext-4 xgettext-5 xgettext-6 \
xgettext-7 xgettext-8 xgettext-9 \
xgettext-awk-1 \
MSGMERGE="$(CHECKER) msgmerge" \
MSGUNFMT="$(CHECKER) msgunfmt" \
MSGUNIQ="$(CHECKER) msguniq" \
+ RECODE="$(CHECKER) recode" \
OBJEXT='@OBJEXT@' EXEEXT='@EXEEXT@' \
LIBTOOL='@LIBTOOL@' \
CC='@CC@' CFLAGS='@CFLAGS@' \