Install po files for all available languages. Only for GnuPG-2. The
authorWerner Koch <wk@gnupg.org>
Thu, 20 Mar 2008 18:19:31 +0000 (18:19 +0000)
committerWerner Koch <wk@gnupg.org>
Thu, 20 Mar 2008 18:19:31 +0000 (18:19 +0000)
de.po for gpg will not be installed anymore.

ChangeLog
src/Makefile.am
src/inst-gnupg.nsi
src/inst-gnupg2.nsi
src/potomo [new file with mode: 0755]
src/uninst-gnupg2.nsi

index 3128563..37f6923 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-03-20  Werner Koch  <wk@g10code.com>
 
+       * src/potomo: New.
+       * src/Makefile.am (gpg4win_pkg_gnupg_post_install): Remove mo file
+       creation.
+       (gpg4win_pkg_gnupgw_post_install): Convert po files.
+       (EXTRA_DIST): Include potomo.
+       * src/inst-gnupg2.nsi: Install all available mo files.
+       
        * src/inst-gnupg2.nsi: Do not install com-certs.pem.
 
 2008-03-19  Werner Koch  <wk@g10code.com>
index 5606bc3..06518dd 100644 (file)
@@ -22,7 +22,7 @@ EXTRA_DIST = pkg-config gpg4win.nsi gpg4win-src.nsi config.site \
         installer-options.ini.in libiconv.def libintl.def loreley.mid \
         gpg4win-splash.wav gpgwrap.c exdll.h g4wihelp.c g4wihelp.nsi \
         inst-sections.nsi installer.nsi installer-finish.nsi  \
-        qt.conf kleowrap.c                                    \
+        qt.conf kleowrap.c potomo                             \
         inst-gpg4win.nsi          uninst-gpg4win.nsi         \
         inst-atk.nsi               uninst-atk.nsi            \
         inst-cairo.nsi            uninst-cairo.nsi           \
@@ -97,19 +97,19 @@ man -Tlatin1 -l $$$${pkgidir}/share/man/man1/gpgv.1 | \
  sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/gpgv.man; \
 man -Tlatin1 -l $$$${pkgidir}/share/man/man7/gnupg.7 | \
  sed `printf "s/_\b//g;s/\b.//g"` | \
- sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man7/gnupg.man; \
-for i in de; do \
- msgfmt --output-file=$$$${pkgidir}/share/gnupg/$$$${i}.mo \
-                               $$$${pkgsdir}/po/$$$${i}.po; \
- done)
+ sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man7/gnupg.man)
 endef
 
 
 # The fields FAQ and faq.html conflict with those in GnuPG1.
-# For now removes them.
+# For now remove them.
 define gpg4win_pkg_gnupg2_post_install 
 ( rm $$$${pkgidir}/share/gnupg/FAQ; \
-  rm $$$${pkgidir}/share/gnupg/faq.html )
+  rm $$$${pkgidir}/share/gnupg/faq.html; \
+  for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
+     $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
+                      $$$${pkgidir}/share/gnupg/$$$${i}.mo ; \
+  done)
 endef
 
 
index ff28c04..ff38f98 100644 (file)
@@ -59,8 +59,13 @@ ${MementoSection} "GnuPG" SEC_gnupg
   # Install the language files for gpg.  Note that the PO files are
   # required to be UTF-8 encoded and that the post-install macro in
   # Makefile.am needs to build them.
-  SetOutPath "$INSTDIR\gnupg.nls"
-  File "${prefix}/share/gnupg/de.mo"
+
+  # Note that we do not install the mo files for gpg1 anymore.  This
+  # is because the build systems can't cope with it (stow conflicts)
+  # and becuase translations for the server version are usually not
+  # required.  Instead we install the gnupg2 mo files.
+  #SetOutPath "$INSTDIR\gnupg.nls"
+
 
   # If requested, install the configured gpg.conf.
   Var /GLOBAL ConfigGPGConf
index 37b596a..52ddb00 100644 (file)
@@ -77,8 +77,8 @@ ${MementoSection} "GnuPG2" SEC_gnupg2
   # Install the language files for gpg.  Note that the PO files are
   # required to be UTF-8 encoded and that the post-install macro in
   # Makefile.am needs to build them.
-#  SetOutPath "$INSTDIR\gnupg2.nls"
-#  File "${prefix}/share/gnupg2/de.mo"
+  SetOutPath "$INSTDIR\gnupg2.nls"
+  File /nonfatal "${prefix}/share/gnupg/*.mo"
 
   # If requested, install the configuration files.
   ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
diff --git a/src/potomo b/src/potomo
new file mode 100755 (executable)
index 0000000..2c2be83
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+# potomo - Convert a .po file to an utf-8 encoded .mo file.
+#
+# This script is used to create the mo files for applications using
+# the simplegetext implementaion as used by GnuPG and some other
+# tools.  That gettext can only cope with utf-8 encoded mo files; thus
+# we make this sure while creating the mo.  A vonversion is not done
+# if the source file does not exist or if it is not newer than the mo
+# file. 
+
+if [ "$1" = "--get-linguas" -a $# -eq 2 ]; then
+   if [ ! -f "$2/LINGUAS" ]; then
+       echo "potomo: directory '$2' has no LINGUAS file" >&2
+       exit 1
+   fi
+   echo $(sed -e "/^#/d" -e "s/#.*//" "$2"/LINGUAS)
+   exit 0
+fi
+
+if [ $# -ne 2 ]; then
+  echo "usage: potomo infile.po outfile.mo" >&2
+  exit 1
+fi
+infile="$1"
+outfile="$2"
+
+if [ ! -f "$infile" ]; then
+  echo "potomo: '$infile' not found - ignored" 2>&1
+  exit 0
+fi
+
+if [ "$outfile" -nt "$infile" ]; then
+  echo "potomo: '$outfile' is newer than source - keeping" 2>&1
+  exit 0
+fi
+  
+fromset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' \
+         "$infile"`
+
+case "$fromset" in 
+    utf8|utf-8|UTF8|UTF-8) 
+        echo "potomo: '$infile' keeping $fromset" >&2 
+        msgfmt --output-file="$outfile" "$infile"
+        ;;   
+    *)
+        echo "potomo: '$infile' converting from $fromset to utf-8" >&2
+        iconv --silent --from-code=$fromset --to-code=utf-8 < "$infile" |\
+            sed "/^\"Content-Type:/ s/charset=[a-zA-Z0-9_-]*/charset=utf-8/"|\
+            msgfmt --output-file="$outfile" -
+        ;;
+esac
+
index a8cd69e..23c745e 100644 (file)
@@ -60,8 +60,8 @@ Section "-un.gnupg2"
   RMDir  "$INSTDIR\etc\gnupg"
   RMDir  "$INSTDIR\etc"
 
-#  Delete "$INSTDIR\gnupg.nls\de.mo"
-#  RMDir  "$INSTDIR\gnupg.nls"
+  Delete "$INSTDIR\gnupg.nls\*.mo"
+  RMDir  "$INSTDIR\gnupg.nls"
 
   RMDir "$INSTDIR"