From: Bruno Haible Date: Wed, 17 Sep 2003 08:25:06 +0000 (+0000) Subject: Support for internationalized shell scripts. X-Git-Tag: v0.13~252 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b8caeca0247968c9f57ccf54e472d669058a51f;p=thirdparty%2Fgettext.git Support for internationalized shell scripts. --- diff --git a/ChangeLog b/ChangeLog index d8a2fab79..735161719 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-13 Bruno Haible + + * PACKAGING: Add envsubst related files and gettext.sh. + 2003-08-23 Bruno Haible * version.sh: Bump version number to 0.12.2. diff --git a/NEWS b/NEWS index 0d6e13c8e..06fa7dcd8 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,15 @@ -Version 0.12.2 - August 2003 +Version 0.12.2 - September 2003 * Programming languages support: - Shell: xgettext now also supports shell scripts. It recognizes invocations of - the programs 'gettext' and 'ngettext' as well as the GNU bash builtin - syntax $"...". + the programs 'gettext', 'ngettext', the functions 'eval_gettext', + 'eval_ngettext', as well as the deprecated GNU bash builtin syntax $"...". + New function library: + gettext.sh - shell functions for internationalized shell scripts. + New program: + envsubst - substitutes environment variables in shell format strings. - Perl: xgettext now also supports Perl. diff --git a/PACKAGING b/PACKAGING index 9a53831f2..1766dc3f4 100644 --- a/PACKAGING +++ b/PACKAGING @@ -50,10 +50,14 @@ following file list. $prefix/bin/gettext $prefix/bin/ngettext + $prefix/bin/envsubst + $prefix/bin/gettext.sh $prefix/share/man/man1/gettext.1 $prefix/share/man/man1/ngettext.1 + $prefix/share/man/man1/envsubst.1 $prefix/share/doc/gettext/gettext.1.html $prefix/share/doc/gettext/ngettext.1.html + $prefix/share/doc/gettext/envsubst.1.html $prefix/share/locale/*/LC_MESSAGES/gettext-runtime.mo $prefix/lib/libintl.* (not installed on glibc systems) diff --git a/gettext-runtime/NEWS b/gettext-runtime/NEWS index b96d478f4..7987c8cc9 100644 --- a/gettext-runtime/NEWS +++ b/gettext-runtime/NEWS @@ -1,8 +1,13 @@ -Version 0.12.2 - August 2003 +Version 0.12.2 - September 2003 * On those few platforms (NetBSD and Woe32) for which the native printf()/fprintf()/... functions don't support POSIX/XSI format strings with positions, replacements are provided through . + +* New function library: + gettext.sh - shell functions for internationalized shell scripts +* New program: + envsubst - substitutes environment variables in shell format strings Version 0.12 - May 2003 diff --git a/gettext-runtime/man/ChangeLog b/gettext-runtime/man/ChangeLog index 8db20cc87..b620b8567 100644 --- a/gettext-runtime/man/ChangeLog +++ b/gettext-runtime/man/ChangeLog @@ -1,3 +1,14 @@ +2003-09-13 Bruno Haible + + * envsubst.x: New file. + * Makefile.am (man_aux): Add envsubst.x. + (man_MAN1OTHER): New variable. + (man_MAN1): Add $(man_MAN1OTHER). + (man_HTMLOTHER): Add envsubst.1.html. + (EXTRA_DIST, MAINTAINERCLEANFILES): Add $(man_MAN1OTHER). + (envsubst.1): New rule. + (envsubst.1.html): New rule. + 2003-05-22 Bruno Haible * gettext-0.12.1 released. diff --git a/gettext-runtime/man/Makefile.am b/gettext-runtime/man/Makefile.am index c7e9f832d..8bbcdd2fb 100644 --- a/gettext-runtime/man/Makefile.am +++ b/gettext-runtime/man/Makefile.am @@ -29,13 +29,14 @@ EXTRA_DIST = # A manual page for each of the bin_PROGRAMS in src/Makefile.am. -man_aux = gettext.x ngettext.x +man_aux = gettext.x ngettext.x envsubst.x # Likewise, plus additional manual pages for the libintl functions. man_MAN1GEN = gettext.1 ngettext.1 man_MAN1IN = gettext.1.in ngettext.1.in -man_MAN1 = $(man_MAN1GEN) +man_MAN1OTHER = envsubst.1 +man_MAN1 = $(man_MAN1GEN) $(man_MAN1OTHER) man_MAN3 = gettext.3 ngettext.3 \ textdomain.3 bindtextdomain.3 bind_textdomain_codeset.3 man_MAN3IN = gettext.3.in ngettext.3.in \ @@ -46,13 +47,14 @@ man_MANS = $(man_MAN1) $(man_MAN3) $(man_MAN3LINK) man_HTMLGEN = gettext.1.html ngettext.1.html man_HTMLIN = gettext.1.html.in ngettext.1.html.in man_HTMLOTHER = \ +envsubst.1.html \ gettext.3.html ngettext.3.html \ textdomain.3.html bindtextdomain.3.html bind_textdomain_codeset.3.html man_HTML = $(man_HTMLGEN) $(man_HTMLOTHER) -EXTRA_DIST += help2man $(man_aux) $(man_MAN1IN) $(man_MAN3) $(man_MAN3IN) $(man_MAN3LINK) $(man_HTMLIN) $(man_HTMLOTHER) +EXTRA_DIST += help2man $(man_aux) $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) $(man_MAN3IN) $(man_MAN3LINK) $(man_HTMLIN) $(man_HTMLOTHER) CLEANFILES = $(man_MAN1GEN) $(man_HTMLGEN) -MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN3) $(man_HTMLIN) $(man_HTMLOTHER) +MAINTAINERCLEANFILES = $(man_MAN1IN) $(man_MAN1OTHER) $(man_MAN3) $(man_HTMLIN) $(man_HTMLOTHER) PERL = @PERL@ RM = rm -f @@ -92,6 +94,9 @@ gettext.1.in: gettext.x ngettext.1.in: ngettext.x IN_HELP2MAN=1 $(SHELL) x-to-1 "$(PERL)" "$(HELP2MAN)" ../src/ngettext$(EXEEXT) $(srcdir)/ngettext.x ngettext.1.in +envsubst.1: envsubst.x + $(SHELL) x-to-1 "$(PERL)" "$(HELP2MAN)" ../src/envsubst$(EXEEXT) $(srcdir)/envsubst.x envsubst.1 + # Depend on version.sh to get version number changes. $(man_MAN1): help2man $(top_srcdir)/../version.sh @@ -130,6 +135,10 @@ ngettext.1.html.in: ngettext.1.in $(MAN2HTML) `if test -f ngettext.1.in; then echo .; else echo $(srcdir); fi`/ngettext.1.in | sed -e '/CreationDate:/d' > t-$@ mv t-$@ $@ +envsubst.1.html: envsubst.1 + $(MAN2HTML) `if test -f envsubst.1; then echo .; else echo $(srcdir); fi`/envsubst.1 | sed -e '/CreationDate:/d' > t-$@ + mv t-$@ $@ + gettext.3.html: gettext.3.in $(MAN2HTML) $(srcdir)/gettext.3.in | sed -e '/CreationDate:/d' > t-$@ mv t-$@ $@ diff --git a/gettext-runtime/src/ChangeLog b/gettext-runtime/src/ChangeLog index aa834ed05..e31e0f6ad 100644 --- a/gettext-runtime/src/ChangeLog +++ b/gettext-runtime/src/ChangeLog @@ -1,3 +1,22 @@ +2003-09-13 Bruno Haible + + * envsubst.c: New file. + * gettext.sh: New file. + * Makefile.am (bin_PROGRAMS): Add envsubst. + (envsubst_SOURCES, envsubst_CFLAGS, envsubst_LDFLAGS): New variables. + (all-local): Depend on gettext.sh. + (install-data-local, uninstall-local): New rules, for gettext.sh. + * Makefile.msvc (PROGRAMS): Add envsubst.exe. + (envsubst_OBJECTS): New variable. + (envsubst.obj, envsubst.exe): New rules. + (install): Install also envsubst.exe and gettext.sh. + (uninstall): Uninstall also envsubst.exe and gettext.sh. + * Makefile.vms (PROGRAMS): Add envsubst.exe. + (envsubst_OBJECTS): New variable. + (envsubst.obj, envsubst.exe): New rules. + (install): Install also envsubst.exe and gettext.sh. + (uninstall): Uninstall also envsubst.exe and gettext.sh. + 2003-09-13 Bruno Haible Fix behaviour of " --help > /dev/full". diff --git a/gettext-runtime/src/Makefile.am b/gettext-runtime/src/Makefile.am index ba93e20a1..164915e1e 100644 --- a/gettext-runtime/src/Makefile.am +++ b/gettext-runtime/src/Makefile.am @@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = 1.5 gnits no-dependencies EXTRA_DIST = -bin_PROGRAMS = gettext ngettext +bin_PROGRAMS = gettext ngettext envsubst localedir = $(datadir)/locale @@ -35,6 +35,7 @@ DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ # Source dependencies. gettext_SOURCES = gettext.c ngettext_SOURCES = ngettext.c +envsubst_SOURCES = envsubst.c # Link dependencies. LDADD = ../lib/libgrt.a @LTLIBINTL@ @@ -42,11 +43,22 @@ LDADD = ../lib/libgrt.a @LTLIBINTL@ # Specify installation directory, for --enable-relocatable. gettext_CFLAGS = -DINSTALLDIR=\"$(bindir)\" ngettext_CFLAGS = -DINSTALLDIR=\"$(bindir)\" +envsubst_CFLAGS = -DINSTALLDIR=\"$(bindir)\" if RELOCATABLE_VIA_LD gettext_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)` ngettext_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)` +envsubst_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)` endif +# Special rule for installing gettext.sh in $(bindir). +# automake doesn't handle "bin_DATA = gettext.sh". +all-local: gettext.sh +install-data-local: all-local + $(mkinstalldirs) $(DESTDIR)$(bindir) + $(INSTALL_DATA) $(srcdir)/gettext.sh $(DESTDIR)$(bindir)/gettext.sh +uninstall-local: all-local + $(RM) $(DESTDIR)$(bindir)/gettext.sh + # Support for relocatability. RELOCATABLE_LIBRARY_PATH = $(libdir) RELOCATABLE_SRC_DIR = $(top_srcdir)/../gettext-tools/lib diff --git a/gettext-runtime/src/Makefile.msvc b/gettext-runtime/src/Makefile.msvc index f8e034274..a74d34dee 100644 --- a/gettext-runtime/src/Makefile.msvc +++ b/gettext-runtime/src/Makefile.msvc @@ -87,10 +87,11 @@ INSTALL_DATA = copy SHELL = /bin/sh -PROGRAMS = gettext.exe ngettext.exe +PROGRAMS = gettext.exe ngettext.exe envsubst.exe gettext_OBJECTS = gettext.obj ngettext_OBJECTS = ngettext.obj +envsubst_OBJECTS = envsubst.obj LDADD = all : $(PROGRAMS) @@ -101,18 +102,26 @@ gettext.obj : gettext.c ngettext.obj : ngettext.c $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c ngettext.c +envsubst.obj : envsubst.c + $(CC) $(INCLUDES) $(CFLAGS) -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -c envsubst.c + gettext.exe : $(gettext_OBJECTS) $(CC) $(MFLAGS) $(DEBUGFLAGS) $(gettext_OBJECTS) ..\lib\grt.lib ..\intl\intl.lib $(libdir)\iconv.lib $(LDADD) -Fegettext.exe ngettext.exe : $(ngettext_OBJECTS) $(CC) $(MFLAGS) $(DEBUGFLAGS) $(ngettext_OBJECTS) ..\lib\grt.lib ..\intl\intl.lib $(libdir)\iconv.lib $(LDADD) -Fengettext.exe +envsubst.exe : $(envsubst_OBJECTS) + $(CC) $(MFLAGS) $(DEBUGFLAGS) $(ngettext_OBJECTS) ..\lib\grt.lib ..\intl\intl.lib $(libdir)\iconv.lib $(LDADD) -Feenvsubst.exe + install : all force -mkdir $(prefix) -mkdir $(exec_prefix) -mkdir $(bindir) $(INSTALL_PROGRAM) gettext.exe $(bindir)\gettext.exe $(INSTALL_PROGRAM) ngettext.exe $(bindir)\ngettext.exe + $(INSTALL_PROGRAM) envsubst.exe $(bindir)\envsubst.exe + $(INSTALL_DATA) gettext.sh $(bindir)\gettext.sh installdirs : force -mkdir $(prefix) @@ -122,6 +131,8 @@ installdirs : force uninstall : force $(RM) $(bindir)\gettext.exe $(RM) $(bindir)\ngettext.exe + $(RM) $(bindir)\envsubst.exe + $(RM) $(bindir)\gettext.sh check : all diff --git a/gettext-runtime/src/Makefile.vms b/gettext-runtime/src/Makefile.vms index 662332832..c53527bd2 100644 --- a/gettext-runtime/src/Makefile.vms +++ b/gettext-runtime/src/Makefile.vms @@ -38,10 +38,11 @@ INSTALL_DATA = copy #### End of system configuration section. #### -PROGRAMS = gettext.exe, ngettext.exe +PROGRAMS = gettext.exe, ngettext.exe, envsubst.exe gettext_OBJECTS = gettext.obj ngettext_OBJECTS = ngettext.obj +envsubst_OBJECTS = envsubst.obj all : $(PROGRAMS) write sys$output "Nothing else to be done for 'all'." @@ -52,6 +53,9 @@ gettext.obj : gettext.c ngettext.obj : ngettext.c $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS),"INSTALLPREFIX=""$(prefix)]""","INSTALLDIR=""$(bindir)]""") ngettext.c +envsubst.obj : envsubst.c + $(CC) $(INCLUDES) $(CFLAGS) /define=($(DEFS),"INSTALLPREFIX=""$(prefix)]""","INSTALLDIR=""$(bindir)]""") envsubst.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 @@ -62,12 +66,17 @@ gettext.exe : $(gettext_OBJECTS),libiconv.opt ngettext.exe : $(ngettext_OBJECTS),libiconv.opt link /executable=ngettext.exe $(ngettext_OBJECTS),[-.lib]grt.olb/lib,[-.intl]intl.olb/lib,$(LDADD) +envsubst.exe : $(envsubst_OBJECTS),libiconv.opt + link /executable=envsubst.exe $(envsubst_OBJECTS),[-.lib]grt.olb/lib,[-.intl]intl.olb/lib,$(LDADD) + install : all create /directory $(prefix)] create /directory $(exec_prefix)] create /directory $(bindir)] $(INSTALL_PROGRAM) gettext.exe $(bindir)]gettext.exe $(INSTALL_PROGRAM) ngettext.exe $(bindir)]ngettext.exe + $(INSTALL_PROGRAM) envsubst.exe $(bindir)]envsubst.exe + $(INSTALL_DATA) gettext.sh $(bindir)]gettext.sh installdirs : create /directory $(prefix)] @@ -77,6 +86,8 @@ installdirs : uninstall : $(RM) $(bindir)]gettext.exe; $(RM) $(bindir)]ngettext.exe; + $(RM) $(bindir)]envsubst.exe; + $(RM) $(bindir)]gettext.sh; check : all write sys$output "Nothing else to be done for 'check'." diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index 19aa7acc6..548b6f0b4 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,3 +1,10 @@ +2003-09-13 Bruno Haible + + * lang-sh: Source gettext.sh. + (echo, eval_gettext, eval_ngettext): Remove definitions. + * lang-bash: Source gettext.sh. + (echo, eval_ngettext): Remove definitions. + 2003-09-13 Bruno Haible * format-sh-1: Update to match stricter format string definition. diff --git a/gettext-tools/tests/lang-bash b/gettext-tools/tests/lang-bash index 76459a586..b2899dcda 100755 --- a/gettext-tools/tests/lang-bash +++ b/gettext-tools/tests/lang-bash @@ -11,35 +11,15 @@ tmpfiles="$tmpfiles prog.sh" cat <<\EOF > prog.sh #! /bin/bash -# Find a way to echo strings without interpreting backslash. -if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then - echo='echo' -else - if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then - echo='printf %s\n' - else - echo_func () { - cat < prog.sh #! /bin/sh -# Find a way to echo strings without interpreting backslash. -if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then - echo='echo' -else - if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then - echo='printf %s\n' - else - echo_func () { - cat < 1);\n" msgid "'Your command, please?', asked the waiter." -msgstr "«Votre commande, s'il vous plait», dit le garçon." +msgstr "Votre commande, s'il vous plait, dit le gar�n." # Les gateaux allemands sont les meilleurs du monde. #, sh-format @@ -105,7 +79,7 @@ ${MSGFMT} -o fr/LC_MESSAGES/prog.mo fr.po tmpfiles="$tmpfiles prog.ok prog.out" : ${DIFF=diff} cat <<\EOF > prog.ok -«Votre commande, s'il vous plait», dit le garçon. +Votre commande, s'il vous plait, dit le gar�n. 2 morceaux de gateau EOF