diff --git a/ChangeLog b/ChangeLog index 8305b55f4..03afb8785 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-11-03 Henning Meier-Geinitz + + * README configure.in configure po/Makefile.in po/README: + Translations are now enabled by default if the gettext tools are + found. Use msgcat if available. Don't update the .po files + automatically. + 2002-10-31 Henning Meier-Geinitz * configure configure.in: Print installation directories. diff --git a/README b/README index a0ef13fb9..00fd49e1c 100644 --- a/README +++ b/README @@ -105,11 +105,10 @@ configure options, there are the following SANE specific options: configuration file. Please refer to the backend's man pages for details. ---enable-translations - Enable installation of backend options. Frontends can use these - translations for localized option titles and descriptions. GNU - gettext is necessary. This feature is isn't tested very well and - thus disabled by default. See po/README for details. +--disable-translations + Disable installation of translated backend options. If you get + errors in the po/ directory during build, use this option. + See po/README for details. In addition to these configuration options, there are some more SANE-specific options and many standard-options. To get a description of available options, diff --git a/configure b/configure index 727d4c467..2d352e93e 100755 --- a/configure +++ b/configure @@ -207,7 +207,7 @@ ac_help="$ac_help [default=no] This option is in no way related to --enable-scsi-directio" ac_help="$ac_help - --enable-translations install translations of backend options [default=no]" + --disable-translations don't install translations of backend options" ac_help="$ac_help --disable-local-backends turns off compilation of all backends but net" @@ -8621,14 +8621,180 @@ fi # Check whether --enable-translations or --disable-translations was given. if test "${enable_translations+set}" = set; then enableval="$enable_translations" - INSTALL_TRANSLATIONS=install-translations + + if eval "test x$enable_translation = xno"; then + INSTALL_TRANSLATIONS= + else + INSTALL_TRANSLATIONS=install-translations + fi + else - INSTALL_TRANSLATIONS= + INSTALL_TRANSLATIONS=install-translations fi +if eval "test x$INSTALL_TRANSLATIONS = xinstall-translations" ; then + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:8643: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:8679: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT="no" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "msgmerge", so it can be a program name with args. +set dummy msgmerge; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:8715: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGMERGE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGMERGE" in + /*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE="no" + ;; +esac +fi +MSGMERGE="$ac_cv_path_MSGMERGE" +if test -n "$MSGMERGE"; then + echo "$ac_t""$MSGMERGE" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "msgcat", so it can be a program name with args. +set dummy msgcat; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:8751: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGCAT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGCAT" in + /*) + ac_cv_path_MSGCAT="$MSGCAT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_MSGCAT="$MSGCAT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_MSGCAT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGCAT" && ac_cv_path_MSGCAT="no" + ;; +esac +fi +MSGCAT="$ac_cv_path_MSGCAT" +if test -n "$MSGCAT"; then + echo "$ac_t""$MSGCAT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + + + + if test x$MSGFMT = xno || test x$XGETTEXT = xno || test $MSGMERGE = no ; then + INSTALL_TRANSLATIONS= + echo "disabling translations" + else + echo "enabling translations" + fi +else + echo "disabling translations" +fi + + # Check whether --enable-local-backends or --disable-local-backends was given. if test "${enable_local_backends+set}" = set; then enableval="$enable_local_backends" @@ -8644,7 +8810,7 @@ fi # Extract the first word of "sane-config", so it can be a program name with args. set dummy sane-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:8648: checking for $ac_word" >&5 +echo "configure:8814: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_SANE_CONFIG_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8678,7 +8844,7 @@ else fi echo $ac_n "checking for sane_init in -lsane""... $ac_c" 1>&6 -echo "configure:8682: checking for sane_init in -lsane" >&5 +echo "configure:8848: checking for sane_init in -lsane" >&5 ac_lib_var=`echo sane'_'sane_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8686,7 +8852,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsane $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8917,6 +9083,10 @@ s%@SNAPSCAN@%$SNAPSCAN%g s%@DLL_PRELOAD@%$DLL_PRELOAD%g s%@PNM@%$PNM%g s%@INSTALL_TRANSLATIONS@%$INSTALL_TRANSLATIONS%g +s%@MSGFMT@%$MSGFMT%g +s%@XGETTEXT@%$XGETTEXT%g +s%@MSGMERGE@%$MSGMERGE%g +s%@MSGCAT@%$MSGCAT%g s%@SELECTED_BACKENDS@%$SELECTED_BACKENDS%g s%@SANE_CONFIG_PATH@%$SANE_CONFIG_PATH%g s%@DISTCLEAN_FILES@%$DISTCLEAN_FILES%g diff --git a/configure.in b/configure.in index bb862d6ad..717f8ba17 100644 --- a/configure.in +++ b/configure.in @@ -448,12 +448,38 @@ AC_ARG_ENABLE(parport-directio, ]) AC_ARG_ENABLE(translations, - [ --enable-translations install translations of backend options [default=no]], - INSTALL_TRANSLATIONS=install-translations, - INSTALL_TRANSLATIONS= + [ --disable-translations don't install translations of backend options], + [ + if eval "test x$enable_translation = xno"; then + INSTALL_TRANSLATIONS= + else + INSTALL_TRANSLATIONS=install-translations + fi + ], + INSTALL_TRANSLATIONS=install-translations ) AC_SUBST(INSTALL_TRANSLATIONS) +if eval "test x$INSTALL_TRANSLATIONS = xinstall-translations" ; then + AC_PATH_PROG(MSGFMT, msgfmt, no) + AC_PATH_PROG(XGETTEXT, xgettext, no) + AC_PATH_PROG(MSGMERGE, msgmerge, no) + AC_PATH_PROG(MSGCAT, msgcat, no) + AC_SUBST(MSGFMT) + AC_SUBST(XGETTEXT) + AC_SUBST(MSGMERGE) + AC_SUBST(MSGCAT) + if test x$MSGFMT = xno || test x$XGETTEXT = xno || test $MSGMERGE = no ; then + INSTALL_TRANSLATIONS= + echo "disabling translations" + else + echo "enabling translations" + fi +else + echo "disabling translations" +fi + + AC_ARG_ENABLE(local-backends, [ --disable-local-backends turns off compilation of all backends but net], [ diff --git a/po/Makefile.in b/po/Makefile.in index 18990dd04..a7cca1c07 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -41,9 +41,10 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ -MSGFMT = msgfmt -XGETTEXT = xgettext -MSGMERGE = msgmerge +MSGFMT = @MSGFMT@ +XGETTEXT = @XGETTEXT@ +MSGMERGE = @MSGMERGE@ +MSGCAT = @MSGCAT@ TMP_FILE_DIR = .tmp @@ -67,19 +68,16 @@ DISTFILES = Makefile.in README epson.de.po mustek.de.po matsushita.fr.po \ saneopts.*.po: ../include/sane/saneopts.h -# backend.lang.po -> backend.lang.mo; include saneopts.??.po while removing -# its msgid "" to avoid msgfmt errors -.po.mo: +# backend.lang.po -> backend.lang.mo; include saneopts.??.po +%.mo: @lang=$(subst .,,$(suffix $(basename $(subst install-,,$@)))) ; \ - echo generating $@ from $< and saneopts.$${lang}.po ; \ - (cat $< ; \ - awk 'BEGIN {empty_msgid = 0; empty_line = 0}; \ - /^msgid ""/ {empty_msgid = 1}; \ - {if (empty_msgid == 1) {if (/^$$/) {empty_line = 1}}} ; \ - {if (empty_line != 1) {sub(/^/, "#")} ; \ - print}' \ - saneopts.$${lang}.po ; \ - )| $(MSGFMT) -o $@ - + echo generating $@ from $*.po and saneopts.$${lang}.po ; \ + if test $(MSGCAT) = no ; then \ + $(MSGFMT) -o $@ $*.po saneopts.$${lang}.po ; \ + else \ + $(MSGCAT) --use-first $*.po saneopts.$${lang}.po \ + | $(MSGFMT) -o $@ - ; \ + fi # Sourcefiles -> backend.lang.po (updating po) diff --git a/po/README b/po/README index 413e06d4c..836cef5f8 100644 --- a/po/README +++ b/po/README @@ -1,19 +1,19 @@ -2002-01-24 +2002-11-03 This directory contains translations for the options of the SANE backends. -They are only used if configure is called with option --enable-translations. +They are only used if the gettext tools are found by configure. You will need GNU gettext: xgettext, msgfmt and msgmerge. The translations -are used at least by the frontend XSane. +are used at least by the frontends XSane and quiteinsane. What do you need to do if you want to: - Just read the description of SANE options in your language - * Use XSane or your favourite backend that supports translations, read the + * Use XSane or your favourite frontend that supports translations, read the documentation and set LANG to your local setting (e.g. de_DE for German language in Germany). - Update existing translations when the source code has changed - * cd po ; make + * cd po ; make backend.lang.po * Edit backend.lang.po, add/change translations. (with lang = your language, e.g. "de", and backend = your backend, e.g. mustek) * make ; make install @@ -39,7 +39,7 @@ What do you need to do if you want to: * Edit po/Makefile.in. Add a line "backend.*.po: yourfiles" where yourfiles is a space-separated list of all your files containing translatable text. Also add backend.lang.po to DISTFILES. - * ./configure --enable-translations + * ./configure * cd po ; make backend.lang.po-gen * see above, if the language isn't used by other backends. * Edit backend-lang.po, enter translations. Don't forget to edit the header. @@ -55,11 +55,6 @@ What do you need to do if you want to: * With other NLS implementations, converting the mo files may work. Bugs: -- This is the first attempt to support translations. It's probably very buggy - and is not very well tested. -- Documentation is not complete. -- I'm not sure if all the functions in Makefile.in work with older versions - of make. - I used sed to also include macros into *.pot. - All well known options are added to *.lang.po even if they are not used in the backend. \ No newline at end of file