Translations are now enabled by default if the gettext tools are found. Use

msgcat if available. Don't update the .po files automatically.
DEVEL_2_0_BRANCH-1
Henning Geinitz 2002-11-03 16:14:27 +00:00
rodzic 7b590a0cde
commit 22fbc9a070
6 zmienionych plików z 236 dodań i 41 usunięć

Wyświetl plik

@ -1,3 +1,10 @@
2002-11-03 Henning Meier-Geinitz <henning@meier-geinitz.de>
* 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 <henning@meier-geinitz.de> 2002-10-31 Henning Meier-Geinitz <henning@meier-geinitz.de>
* configure configure.in: Print installation directories. * configure configure.in: Print installation directories.

9
README
Wyświetl plik

@ -105,11 +105,10 @@ configure options, there are the following SANE specific options:
configuration file. Please refer to the backend's man pages for configuration file. Please refer to the backend's man pages for
details. details.
--enable-translations --disable-translations
Enable installation of backend options. Frontends can use these Disable installation of translated backend options. If you get
translations for localized option titles and descriptions. GNU errors in the po/ directory during build, use this option.
gettext is necessary. This feature is isn't tested very well and See po/README for details.
thus disabled by default. See po/README for details.
In addition to these configuration options, there are some more SANE-specific In addition to these configuration options, there are some more SANE-specific
options and many standard-options. To get a description of available options, options and many standard-options. To get a description of available options,

184
configure vendored
Wyświetl plik

@ -207,7 +207,7 @@ ac_help="$ac_help
[default=no] This option is in no way related to [default=no] This option is in no way related to
--enable-scsi-directio" --enable-scsi-directio"
ac_help="$ac_help 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 ac_help="$ac_help
--disable-local-backends turns off compilation of all backends but net" --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. # Check whether --enable-translations or --disable-translations was given.
if test "${enable_translations+set}" = set; then if test "${enable_translations+set}" = set; then
enableval="$enable_translations" enableval="$enable_translations"
INSTALL_TRANSLATIONS=install-translations
if eval "test x$enable_translation = xno"; then
INSTALL_TRANSLATIONS=
else
INSTALL_TRANSLATIONS=install-translations
fi
else else
INSTALL_TRANSLATIONS= INSTALL_TRANSLATIONS=install-translations
fi 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. # Check whether --enable-local-backends or --disable-local-backends was given.
if test "${enable_local_backends+set}" = set; then if test "${enable_local_backends+set}" = set; then
enableval="$enable_local_backends" 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. # Extract the first word of "sane-config", so it can be a program name with args.
set dummy sane-config; ac_word=$2 set dummy sane-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 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 if eval "test \"`echo '$''{'ac_cv_path_SANE_CONFIG_PATH'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -8678,7 +8844,7 @@ else
fi fi
echo $ac_n "checking for sane_init in -lsane""... $ac_c" 1>&6 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_%'` ac_lib_var=`echo sane'_'sane_init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -8686,7 +8852,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lsane $LIBS" LIBS="-lsane $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 8690 "configure" #line 8856 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -8697,7 +8863,7 @@ int main() {
sane_init() sane_init()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:8701: \"$ac_link\") 1>&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* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -8917,6 +9083,10 @@ s%@SNAPSCAN@%$SNAPSCAN%g
s%@DLL_PRELOAD@%$DLL_PRELOAD%g s%@DLL_PRELOAD@%$DLL_PRELOAD%g
s%@PNM@%$PNM%g s%@PNM@%$PNM%g
s%@INSTALL_TRANSLATIONS@%$INSTALL_TRANSLATIONS%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%@SELECTED_BACKENDS@%$SELECTED_BACKENDS%g
s%@SANE_CONFIG_PATH@%$SANE_CONFIG_PATH%g s%@SANE_CONFIG_PATH@%$SANE_CONFIG_PATH%g
s%@DISTCLEAN_FILES@%$DISTCLEAN_FILES%g s%@DISTCLEAN_FILES@%$DISTCLEAN_FILES%g

Wyświetl plik

@ -448,12 +448,38 @@ AC_ARG_ENABLE(parport-directio,
]) ])
AC_ARG_ENABLE(translations, AC_ARG_ENABLE(translations,
[ --enable-translations install translations of backend options [default=no]], [ --disable-translations don't install translations of backend options],
INSTALL_TRANSLATIONS=install-translations, [
INSTALL_TRANSLATIONS= if eval "test x$enable_translation = xno"; then
INSTALL_TRANSLATIONS=
else
INSTALL_TRANSLATIONS=install-translations
fi
],
INSTALL_TRANSLATIONS=install-translations
) )
AC_SUBST(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, AC_ARG_ENABLE(local-backends,
[ --disable-local-backends turns off compilation of all backends but net], [ --disable-local-backends turns off compilation of all backends but net],
[ [

Wyświetl plik

@ -41,9 +41,10 @@ INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@ INSTALL_DATA = @INSTALL_DATA@
MSGFMT = msgfmt MSGFMT = @MSGFMT@
XGETTEXT = xgettext XGETTEXT = @XGETTEXT@
MSGMERGE = msgmerge MSGMERGE = @MSGMERGE@
MSGCAT = @MSGCAT@
TMP_FILE_DIR = .tmp 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 saneopts.*.po: ../include/sane/saneopts.h
# backend.lang.po -> backend.lang.mo; include saneopts.??.po while removing # backend.lang.po -> backend.lang.mo; include saneopts.??.po
# its msgid "" to avoid msgfmt errors %.mo:
.po.mo:
@lang=$(subst .,,$(suffix $(basename $(subst install-,,$@)))) ; \ @lang=$(subst .,,$(suffix $(basename $(subst install-,,$@)))) ; \
echo generating $@ from $< and saneopts.$${lang}.po ; \ echo generating $@ from $*.po and saneopts.$${lang}.po ; \
(cat $< ; \ if test $(MSGCAT) = no ; then \
awk 'BEGIN {empty_msgid = 0; empty_line = 0}; \ $(MSGFMT) -o $@ $*.po saneopts.$${lang}.po ; \
/^msgid ""/ {empty_msgid = 1}; \ else \
{if (empty_msgid == 1) {if (/^$$/) {empty_line = 1}}} ; \ $(MSGCAT) --use-first $*.po saneopts.$${lang}.po \
{if (empty_line != 1) {sub(/^/, "#")} ; \ | $(MSGFMT) -o $@ - ; \
print}' \ fi
saneopts.$${lang}.po ; \
)| $(MSGFMT) -o $@ -
# Sourcefiles -> backend.lang.po (updating po) # Sourcefiles -> backend.lang.po (updating po)

Wyświetl plik

@ -1,19 +1,19 @@
2002-01-24 2002-11-03
This directory contains translations for the options of the SANE backends. 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 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: What do you need to do if you want to:
- Just read the description of SANE options in your language - 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 documentation and set LANG to your local setting (e.g. de_DE for German
language in Germany). language in Germany).
- Update existing translations when the source code has changed - 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 * Edit backend.lang.po, add/change translations. (with lang = your
language, e.g. "de", and backend = your backend, e.g. mustek) language, e.g. "de", and backend = your backend, e.g. mustek)
* make ; make install * 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 * Edit po/Makefile.in. Add a line "backend.*.po: yourfiles" where
yourfiles is a space-separated list of all your files containing yourfiles is a space-separated list of all your files containing
translatable text. Also add backend.lang.po to DISTFILES. translatable text. Also add backend.lang.po to DISTFILES.
* ./configure --enable-translations * ./configure
* cd po ; make backend.lang.po-gen * cd po ; make backend.lang.po-gen
* see above, if the language isn't used by other backends. * see above, if the language isn't used by other backends.
* Edit backend-lang.po, enter translations. Don't forget to edit the header. * 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. * With other NLS implementations, converting the mo files may work.
Bugs: 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. - I used sed to also include macros into *.pot.
- All well known options are added to *.lang.po even if they are not used - All well known options are added to *.lang.po even if they are not used
in the backend. in the backend.