Samba i18n patches

Rafal Szczesniak mimir at spin.ict.pwr.wroc.pl
Tue Aug 14 13:36:01 GMT 2001


Here are patches for selecting international man pages.
This code assumes that current man pages are in
docs/manpages/en directory instead of docs/manpages
directly. The same applies to installed files
(man/ -> man/en/).
Existing shortcomings of this implementation:
 1) List of available languages is not generated
    automatically i.e. by probing docs/manpages/ contents

 2) Language specifiers (given by user) are not validated.

It's been tested using man -L <locale> <manpage>. Didn't
properly configure system locale, yet.


feedbacks are, of course, welcome
cheers,

Rafal 'Mimir' Szczesniak <mimir at spin.ict.pwr.wroc.pl>   |
*BSD, Linux and Samba                                  /
______________________________________________________/

-------------- next part --------------
--- HEAD4-ja/source/configure.in	Sun Aug 12 15:43:34 2001
+++ HEAD4-ja-modified/source/configure.in	Mon Aug 13 23:03:24 2001
@@ -2074,6 +2074,30 @@
 )
 
 #################################################
+# choose native language(s) of man pages
+AC_MSG_CHECKING(chosen man pages' language(s))
+AC_ARG_WITH(manpages-langs,
+[  --with-manpages-langs={en,ja,pl}  Choose man pages' language(s). (en)],
+[ case "$withval" in
+  yes|no)
+    AC_MSG_WARN(--with-manpages-langs called without argument - will use default)
+    manlangs="en"
+  ;;
+  *)
+    manlangs="$withval"
+  ;;
+  esac
+
+  AC_MSG_RESULT($manlangs)
+  manlangs=${manlangs//,/ }   # replacing commas with spaces to produce a list
+  AC_SUBST(manlangs)],
+
+  [manlangs="en"
+  AC_MSG_RESULT($manlangs)
+  AC_SUBST(manlangs)]
+)
+
+#################################################
 # these tests are taken from the GNU fileutils package
 AC_CHECKING(how to get filesystem space usage)
 space=no
@@ -2285,7 +2309,7 @@
 PACKAGE=i18n_swat
 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
 AC_SUBST(PACKAGE)
-ALL_LINGUAS="en ja"
+ALL_LINGUAS="en ja pl"
 AM_GNU_GETTEXT
 
 AC_ARG_WITH(spinlocks, [  --with-spinlocks        use spin locks instead of fcntl locks ])
-------------- next part --------------
--- HEAD4-ja/source/Makefile.in	Sun Aug 12 17:41:17 2001
+++ HEAD4-ja-modified/source/Makefile.in	Mon Aug 13 21:51:16 2001
@@ -75,6 +75,10 @@
 intlsubdirs = po intl
 top_srcdir = @top_srcdir@
 
+# man pages language(s)
+man_langs = "@manlangs@"
+
+
 PASSWD_FLAGS = -DPASSWD_PROGRAM=\"$(PASSWD_PROGRAM)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATE_DIR)\"
 FLAGS1 = $(CFLAGS) -Iinclude -I$(srcdir)/include -I$(srcdir)/ubiqx -I$(srcdir)/smbwrapper $(CPPFLAGS) -DLOGFILEBASE=\"$(LOGFILEBASE)\"
 FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"  
@@ -680,12 +684,12 @@
 	@$(SHELL) $(srcdir)/script/revert.sh $(BINDIR) $(PROGS) $(SCRIPTS)
 
 installman:
-	@$(SHELL) $(srcdir)/script/installman.sh $(MANDIR) $(srcdir) "@ROFF@"
+	@$(SHELL) $(srcdir)/script/installman.sh $(MANDIR) $(srcdir) $(man_langs) "@ROFF@"
 
 uninstall: uninstallman uninstallbin uninstallscripts
 
 uninstallman:
-	@$(SHELL) $(srcdir)/script/uninstallman.sh $(MANDIR) $(srcdir)
+	@$(SHELL) $(srcdir)/script/uninstallman.sh $(MANDIR) $(srcdir) $(man_langs)
 
 uninstallbin:
 	@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SPROGS)
-------------- next part --------------
--- HEAD4-ja/source/script/installman.sh	Tue Nov 17 21:50:05 1998
+++ HEAD4-ja-modified/source/script/installman.sh	Mon Aug 13 23:06:59 2001
@@ -1,50 +1,59 @@
 #!/bin/sh
 #5 July 96 Dan.Shearer at unisa.edu.au  removed hardcoded values
+#
+# 13 Aug 2001  Rafal Szczesniak <mimir at spin.ict.pwr.wroc.pl>
+#   modified to accomodate international man pages (inspired
+#   by Japanese edition's approach)
 
 MANDIR=$1
 SRCDIR=$2/
-if [ $# -ge 3 ] ; then
-  GROFF=$3                    # sh cmd line, including options 
+langs=$3
+
+if [ $# -ge 4 ] ; then
+  GROFF=$4                    # sh cmd line, including options 
 fi
 
-echo Installing man pages in $MANDIR
 
-for d in $MANDIR $MANDIR/man1 $MANDIR/man5 $MANDIR/man7 $MANDIR/man8; do
-if [ ! -d $d ]; then
-mkdir $d
-if [ ! -d $d ]; then
-  echo Failed to make directory $d, does $USER have privileges?
-  exit 1
-fi
-fi
-done
+for lang in $langs; do
+    echo Installing \"$lang\" man pages in $MANDIR/$lang
 
-for sect in 1 5 7 8 ; do
-  for m in $MANDIR/man$sect ; do
-    for s in $SRCDIR../docs/manpages/*$sect; do
-      FNAME=$m/`basename $s`
+    langdir=$MANDIR/$lang
+    for d in $MANDIR $langdir $langdir/man1 $langdir/man5 $langdir/man7 $langdir/man8; do
+	if [ ! -d $d ]; then
+	    mkdir $d
+	    if [ ! -d $d ]; then
+		echo Failed to make directory $d, does $USER have privileges?
+		exit 1
+	    fi
+	fi
+    done
+
+    for sect in 1 5 7 8 ; do
+	for m in $langdir/man$sect ; do
+	    for s in $SRCDIR../docs/manpages/$lang/*$sect; do
+	    FNAME=$m/`basename $s`
  
-       # Test for writability.  Involves 
-       # blowing away existing files.
+	    # Test for writability.  Involves 
+	    # blowing away existing files.
  
-       if (rm -f $FNAME && touch $FNAME); then
-         rm $FNAME
-         if [ "x$GROFF" = x ] ; then
-           cp $s $m              # Copy raw nroff 
-         else
-           echo "\t$FNAME"       # groff'ing can be slow, give the user
-                                 #   a warm fuzzy.
-           $GROFF $s > $FNAME    # Process nroff, because man(1) (on
-                                 #   this system) doesn't .
-         fi
-         chmod 0644 $FNAME
-       else
-         echo Cannot create $FNAME... does $USER have privileges?
-       fi
+	    if (rm -f $FNAME && touch $FNAME); then
+		rm $FNAME
+		if [ "x$GROFF" = x ] ; then
+		    cp $s $m            # Copy raw nroff 
+		else
+		    echo "\t$FNAME"     # groff'ing can be slow, give the user
+					#   a warm fuzzy.
+		    $GROFF $s > $FNAME  # Process nroff, because man(1) (on
+					#   this system) doesn't .
+		fi
+		chmod 0644 $FNAME
+	    else
+		echo Cannot create $FNAME... does $USER have privileges?
+	    fi
+	    done
+	done
     done
-  done
 done
-
 cat << EOF
 ======================================================================
 The man pages have been installed. You may uninstall them using the command
-------------- next part --------------
--- HEAD4-ja/source/script/uninstallman.sh	Fri Nov 27 22:32:08 1998
+++ HEAD4-ja-modified/source/script/uninstallman.sh	Mon Aug 13 23:07:44 2001
@@ -1,20 +1,28 @@
 #!/bin/sh
 #4 July 96 Dan.Shearer at UniSA.edu.au
+#
+# 13 Aug 2001  Rafal Szczesniak <mimir at spin.ict.pwr.wroc.pl>
+#   modified to accomodate international man pages (inspired
+#   by Japanese edition's approach)
+
 
 MANDIR=$1
 SRCDIR=$2
+langs=$3
 
-echo Uninstalling man pages from $MANDIR
+for lang in $langs; do
+  echo Uninstalling \"$lang\" man pages from $MANDIR/$lang
 
-for sect in 1 5 7 8 ; do
-  for m in $MANDIR/man$sect ; do
-    for s in $SRCDIR/../docs/manpages/*$sect; do
-      FNAME=$m/`basename $s`
-      if test -f $FNAME; then
-        echo Deleting $FNAME
-        rm -f $FNAME 
-        test -f $FNAME && echo Cannot remove $FNAME... does $USER have privileges?   
-      fi
+  for sect in 1 5 7 8 ; do
+    for m in $MANDIR/$lang/man$sect ; do
+      for s in $SRCDIR/../docs/manpages/$lang/*$sect; do
+        FNAME=$m/`basename $s`
+	if test -f $FNAME; then
+	  echo Deleting $FNAME
+	  rm -f $FNAME 
+	  test -f $FNAME && echo Cannot remove $FNAME... does $USER have privileges?   
+        fi
+      done
     done
   done
 done


More information about the samba-technical mailing list