[MPlayer-dev-eng] [PATCH] fixing installation of localized manpages

Andreas Hess jaska at gmx.net
Wed Feb 19 12:22:37 CET 2003


Hi!

Before we continue to babble forever about this topic, I made a patch,
that hopefully makes everyone happy (at least it should make everyone
happy who thinks, that current behaviour sucks).

With this patch it's possible to give a white space or comma separated
list of languages you want, e.g. --language="en de pl hu it ru" or
--language=en,de,pl,hu,it,ru . The first is always the language that's
used for GUI and (debug) messages. If no --language is given, configure
honors a possible existing $LINGUAS, and --language=all is supported
too. If no --language is given and $LINGUAS is not set, then configure
defaults to the english messages and man pages.


Andreas
-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /cvsroot/mplayer/main/Makefile,v
retrieving revision 1.255
diff -u -r1.255 Makefile
--- Makefile	17 Feb 2003 13:06:03 -0000	1.255
+++ Makefile	19 Feb 2003 11:22:49 -0000
@@ -246,26 +246,23 @@
 	-ln -sf $(PRG) $(BINDIR)/gmplayer
 endif
 	if test ! -d $(MANDIR)/man1 ; then mkdir -p $(MANDIR)/man1; fi
-	$(INSTALL) -c -m 644 DOCS/en/mplayer.1 $(MANDIR)/man1/mplayer.1
-	@if [ -n "$(LANGUAGES)" ]; then \
-	    for i in $(LANGUAGES); do \
-		if [ -f DOCS/$$i/mplayer.1 ]; then \
-		    echo "Installing manual for language $$i" ; \
-		    mkdir -p $(MANDIR)/$$i/man1 ; \
-		    $(INSTALL) -c -m 644 DOCS/$$i/mplayer.1 $(MANDIR)/$$i/man1/mplayer.1 ; \
+	for i in $(LANGUAGES); do \
+		if test "$$i" = en ; then \
+			$(INSTALL) -c -m 644 DOCS/en/mplayer.1 $(MANDIR)/man1/mplayer.1 ; \
+		else \
+			mkdir -p $(MANDIR)/$$i/man1 ; \
+			$(INSTALL) -c -m 644 DOCS/$$i/mplayer.1 $(MANDIR)/$$i/man1/mplayer.1 ; \
 		fi ; \
-	    done ; \
-	fi
+	done
 ifeq ($(MENCODER),yes)
 	$(INSTALL) -m 755 $(INSTALLSTRIP) $(PRG_MENCODER) $(BINDIR)/$(PRG_MENCODER)
-	ln -sf mplayer.1 $(MANDIR)/man1/mencoder.1
-	@if [ -n "$(LANGUAGES)" ]; then \
-	    for i in $(LANGUAGES); do \
-		if [ -f DOCS/$$i/mplayer.1 ]; then \
-		    ln -sf mplayer.1 $(MANDIR)/$$i/man1/mencoder.1 ; \
+	for i in $(LANGUAGES); do \
+		if test "$$i" = en ; then \
+			ln -sf mplayer.1 $(MANDIR)/man1/mencoder.1 ; \
+		else \
+			ln -sf mplayer.1 $(MANDIR)/$$i/man1/mencoder.1 ; \
 		fi ; \
-	    done ; \
-	fi
+	done
 endif
 	@if test ! -d $(DATADIR) ; then mkdir -p $(DATADIR) ; fi
 	@if test ! -d $(DATADIR)/font ; then mkdir -p $(DATADIR)/font ; fi
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.665
diff -u -r1.665 configure
--- configure	17 Feb 2003 18:21:01 -0000	1.665
+++ configure	19 Feb 2003 11:22:54 -0000
@@ -234,8 +234,12 @@
   --target=PLATFORM      target platform (i386-linux, arm-linux, etc)
   --enable-static        build a statically linked binary. Set further linking
                          options with --enable-static="-lslang -lncurses"
-  --language=xx          select a language (for translated messages/gui) [en]
-                         (Available: $LANGUAGES)
+  --language=xx          a white space or comma separated list of languages
+                         for translated man pages, the first language is the
+                         primary and therefore used for translated messages
+                         and gui (also the environment variable \$LINGUAS is
+                         honored) [en]
+                         (Available: $LANGUAGES all)
   --enable-shared-pp     install & use shared postprocessing lib
   --install-path=PATH    the path to a custom install program (useful if
                          your OS uses a GNU-incompatible install utility by
@@ -293,10 +297,6 @@
 done # for parm in ...
 
 
-# set up LANGUAGES
-test "$LINGUAS" || LINGUAS=`cd DOCS;/bin/ls -d ??` 2>/dev/null
-LANGUAGES=`echo $LINGUAS | sed 's/en//g' | sed 's/^ *//'`
-
 # 1st pass checking for vital options
 _install=install
 _ranlib=ranlib
@@ -1044,7 +1044,7 @@
 _zr=auto
 _bl=no
 _largefiles=no
-_language=en
+#_language=en
 _shm=auto
 _linux_devfs=no
 _i18n=auto
@@ -1264,7 +1264,7 @@
   --disable-sortsub) _sortsub=no ;;
 
   --language=*)
-    LINGUAS=`echo $ac_option | cut -d '=' -f 2`
+    _language=`echo $ac_option | cut -d '=' -f 2`
     ;;
   --with-libdvdnav=*)
     _dvdnavdir=`echo $ac_option | cut -d '=' -f 2`
@@ -1580,7 +1580,6 @@
 fi
 if test "$_i18n" = yes ; then
   _def_i18n='#define USE_I18N 1'
-#  LINGUAS='en' # force help_mp-en.h
 else
   _def_i18n='#undef USE_I18N'
 fi
@@ -1612,15 +1611,24 @@
 
 
 echocheck "language"
-test -z "$LINGUAS" && LINGUAS="en"
-if test -f "help/help_mp-${LINGUAS}.h" ; then
-  echores "using ${LINGUAS}"
-else
-  echores "${LINGUAS} not found, using en"
-  LINGUAS="en"
+test -z "$_language" && _language=$LINGUAS
+test -z "$_language" && _language=en
+if test "$_language" = all ; then
+  _language=en
+else
+  LANGUAGES=`echo $_language | sed 's/,/ /g'`
+  _language=`echo $LANGUAGES | cut -d ' ' -f 1`
+  if not test -f "help/help_mp-${_language}.h" ; then
+    echo -n "$_language not found, "
+    _language=en
+  fi
 fi
-_mp_help="help/help_mp-${LINGUAS}.h"
-test -f $_mp_help || die "$_mp_help not found"
+for i in $LANGUAGES ; do
+  test -f "DOCS/$i/mplayer.1" || LANGUAGES=`echo $LANGUAGES | sed "s/$i *//g" | sed 's/ *$//'`
+done
+echores "using $_language (man pages: $LANGUAGES)"
+_mp_help="help/help_mp-${_language}.h"
+#test -f $_mp_help || die "$_mp_help not found"
 
 echocheck "enable sighandler"
 if test "$_sighandler" = yes ; then
@@ -4811,8 +4819,7 @@
 # -------- Generated by configure -----------
 
 LANG = C
-LINGUAS = $LINGUAS
-LANGUAGES = $LANGUAGES
+LANGUAGES=$LANGUAGES
 TARGET_OS = $system_name
 DESTDIR =
 prefix = \$(DESTDIR)$_prefix


More information about the MPlayer-dev-eng mailing list