[Debian-l10n-commits] r1067 - in /dl10n/trunk/compendiums: ./ LINGUAS charset-tests convert_or_remove createcompendium gen_compendiums l10n.conf msg2utf8 msglib.sh svn-commit.tmp update_fs

bubulle at users.alioth.debian.org bubulle at users.alioth.debian.org
Sun Jul 20 13:34:24 UTC 2008


Author: bubulle
Date: Sun Jul 20 13:34:24 2008
New Revision: 1067

URL: http://svn.debian.org/wsvn/?sc=1&rev=1067
Log:
Add compendiums scripts

Added:
    dl10n/trunk/compendiums/
    dl10n/trunk/compendiums/LINGUAS
    dl10n/trunk/compendiums/charset-tests   (with props)
    dl10n/trunk/compendiums/convert_or_remove   (with props)
    dl10n/trunk/compendiums/createcompendium   (with props)
    dl10n/trunk/compendiums/gen_compendiums   (with props)
    dl10n/trunk/compendiums/l10n.conf   (with props)
    dl10n/trunk/compendiums/msg2utf8   (with props)
    dl10n/trunk/compendiums/msglib.sh
    dl10n/trunk/compendiums/svn-commit.tmp
    dl10n/trunk/compendiums/update_fs   (with props)

Added: dl10n/trunk/compendiums/LINGUAS
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/LINGUAS?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/LINGUAS (added)
+++ dl10n/trunk/compendiums/LINGUAS Sun Jul 20 13:34:24 2008
@@ -1,0 +1,1 @@
+ar be bg bn bs ca cs da de dz el eo es et eu fi fr gl gu he hi hr hu id it ja ka km ko ku lt lv mk ml nb ne nl nn pa pl pt pt_BR ro ru sk sl sq sv ta th tl tr uk vi wo zh_CN zh_TW 

Added: dl10n/trunk/compendiums/charset-tests
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/charset-tests?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/charset-tests (added)
+++ dl10n/trunk/compendiums/charset-tests Sun Jul 20 13:34:24 2008
@@ -1,0 +1,8 @@
+#!/bin/sh -e
+
+for PO in $*
+do
+	echo "Stats for ${PO}:" &&
+	msgfmt --statistics -o /dev/null "${PO}" || exit $?
+	msgcat -o /dev/null "${PO}" || exit $?
+done

Propchange: dl10n/trunk/compendiums/charset-tests
------------------------------------------------------------------------------
    svn:executable = *

Added: dl10n/trunk/compendiums/convert_or_remove
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/convert_or_remove?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/convert_or_remove (added)
+++ dl10n/trunk/compendiums/convert_or_remove Sun Jul 20 13:34:24 2008
@@ -1,0 +1,17 @@
+#!/bin/sh
+# converts a po file to utf-8 or removes it
+# also it validates the file or removes it
+
+if ./msg2utf8 "$1"
+then
+	if ./charset-tests "$1" >/dev/null 2>&1
+	then
+		echo "I: $1: is included in compendium"
+	else
+		echo "E: $1: file failed the tests, removed"
+	fi
+else
+	echo "E: $1: file removed from compilation"
+	rm -f "$1" "$1.utf"
+fi
+

Propchange: dl10n/trunk/compendiums/convert_or_remove
------------------------------------------------------------------------------
    svn:executable = *

Added: dl10n/trunk/compendiums/createcompendium
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/createcompendium?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/createcompendium (added)
+++ dl10n/trunk/compendiums/createcompendium Sun Jul 20 13:34:24 2008
@@ -1,0 +1,35 @@
+#!/bin/bash
+
+# To guarantee that files may be written by the group
+umask 002
+
+GENCOMPENDIUMPATH=${GENCOMPENDIUMPATH='.'}
+
+. "$GENCOMPENDIUMPATH"/l10n.conf
+
+[ $# = 1 ] && MSGLANG=$1 || exit 1
+
+find "$SITEDIR" -name "*_${MSGLANG}.po.gz" -exec cp {} "$POTMPDIR" \;
+gunzip "$POTMPDIR"/*
+RESULTS="$RESULTS/$MSGLANG"
+mkdir -p "$RESULTS"
+
+exec &>"$RESULTS/$STAMP.log"
+# for some odd reason convert_or_remove needs to be an external file
+# maybe because find doesn't have it defined in its environment
+find "$POTMPDIR" -name *.po -exec ./convert_or_remove {} \;
+msgcat -o "$RESULTS/compendium-$MSGLANG-stamp$STAMP.po" $POTMPDIR/*.po
+# In order to be useful, the latest compendium needs to be used by users
+ln -sf "$RESULTS/compendium-$MSGLANG-stamp$STAMP.po" "$RESULTS/compendium-$MSGLANG-LATEST.po"
+
+RESULT=$?
+
+# enable when code is stable
+rm -fr "$POTMPDIR"
+
+if [ "$RESULT" = "0" ]
+then
+	echo "III: generated $RESULTS/compendium-$MSGLANG-stamp$STAMP.po"
+else
+	echo "EEE: failed to generate $RESULTS/compendium-$MSGLANG-stamp$STAMP.po"
+fi

Propchange: dl10n/trunk/compendiums/createcompendium
------------------------------------------------------------------------------
    svn:executable = *

Added: dl10n/trunk/compendiums/gen_compendiums
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/gen_compendiums?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/gen_compendiums (added)
+++ dl10n/trunk/compendiums/gen_compendiums Sun Jul 20 13:34:24 2008
@@ -1,0 +1,15 @@
+#!/bin/bash
+#set -x
+#set -e
+
+export GENCOMPENDIUMPATH="/org/dl10n-stuff/bin/compendium_creator"
+
+cd "$GENCOMPENDIUMPATH"
+
+. "$GENCOMPENDIUMPATH"/l10n.conf
+
+for LL in $COMPENDIUM_LANGS ; do
+	"$GENCOMPENDIUMPATH"/createcompendium $LL
+done
+
+rmdir $POTMPDIR || true

Propchange: dl10n/trunk/compendiums/gen_compendiums
------------------------------------------------------------------------------
    svn:executable = *

Added: dl10n/trunk/compendiums/l10n.conf
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/l10n.conf?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/l10n.conf (added)
+++ dl10n/trunk/compendiums/l10n.conf Sun Jul 20 13:34:24 2008
@@ -1,0 +1,15 @@
+#!/bin/bash
+
+#po stuff:
+export POSITEDIR=/org/dl10n-stuff/www/po/unstable/
+
+#po-debconf stuff
+export PODEBCONFTGZ='/org/dl10n-stuff/www/po-debconf.tar.gz'
+export SITEDIR=/org/dl10n-stuff/www-debian-l10n/compendiums
+
+[ -z "$NOTMPYET" ] && export POTMPDIR=`mktemp -d /tmp/cpd${MSGLANG}.XXXXXXXXXX` && NOTMPYET=no || true
+export RESULTS="/org/dl10n-stuff/www-debian-l10n/compendiums/$MSGLANG/po/"
+
+export STAMP=`date +%Y%m%d`
+
+export COMPENDIUM_LANGS="ar be bg bn bs ca cs da de dz el eo es et eu fi fr gl gu he hi hr hu id it ja ka km ko ku lt lv mk ml nb ne nl nn pa pl pt pt_BR ro ru sk sl sq sv ta th tl tr uk vi wo zh_CN zh_TW"

Propchange: dl10n/trunk/compendiums/l10n.conf
------------------------------------------------------------------------------
    svn:executable = *

Added: dl10n/trunk/compendiums/msg2utf8
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/msg2utf8?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/msg2utf8 (added)
+++ dl10n/trunk/compendiums/msg2utf8 Sun Jul 20 13:34:24 2008
@@ -1,0 +1,29 @@
+#!/bin/sh
+#set -x
+set -e
+
+help ()
+{
+    echo "$0 accepts only one parameter"
+}
+
+[ $# = 1  ] || help
+
+notutf8 ()
+{
+    if [ -x /usr/bin/isutf8 ]
+    then
+        /usr/bin/isutf8 "$1" && return 1 || return 0
+    fi
+    [ -z "`file "$1" | grep -v UTF-8`" ] && return 1 || return 0
+}
+
+if notutf8 "$1"
+then
+    echo "W: $1: was not UTF-8 encoded"
+    msgconv -t utf-8 "$1" > "$1.utf" && 
+        cat "$1.utf" | \
+        sed 's#Content-Type:\ text/plain;\ charset=.*\n"$#Content-Type: text/plain; charset=UTF-8\n"#' > "$1"
+else
+    echo "I: $1: already UTF-8 encoded"
+fi

Propchange: dl10n/trunk/compendiums/msg2utf8
------------------------------------------------------------------------------
    svn:executable = *

Added: dl10n/trunk/compendiums/msglib.sh
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/msglib.sh?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/msglib.sh (added)
+++ dl10n/trunk/compendiums/msglib.sh Sun Jul 20 13:34:24 2008
@@ -1,0 +1,21 @@
+imsg ()
+{
+	echo "I: $*"
+}
+
+emsg ()
+{
+	echo "E: $*"
+}
+
+wmsg ()
+{
+	echo "W: $*"
+}
+
+emsgx ()
+{
+	RET=$1 && shift
+	emsg $*
+	exit $RET
+}

Added: dl10n/trunk/compendiums/svn-commit.tmp
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/svn-commit.tmp?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/svn-commit.tmp (added)
+++ dl10n/trunk/compendiums/svn-commit.tmp Sun Jul 20 13:34:24 2008
@@ -1,0 +1,13 @@
+Add compendium scripts
+--Cette ligne, et les suivantes ci-dessous, seront ignorées--
+
+A    .
+AM   msg2utf8
+A    LINGUAS
+AM   createcompendium
+A    msglib.sh
+AM   charset-tests
+AM   update_fs
+AM   gen_compendiums
+AM   convert_or_remove
+AM   l10n.conf

Added: dl10n/trunk/compendiums/update_fs
URL: http://svn.debian.org/wsvn/dl10n/trunk/compendiums/update_fs?rev=1067&op=file
==============================================================================
--- dl10n/trunk/compendiums/update_fs (added)
+++ dl10n/trunk/compendiums/update_fs Sun Jul 20 13:34:24 2008
@@ -1,0 +1,10 @@
+#!/bin/bash
+
+# To guarantee that files may be written by the group
+umask 002
+
+GENCOMPENDIUMPATH=${GENCOMPENDIUMPATH-'.'}
+. "$GENCOMPENDIUMPATH"/l10n.conf
+
+rm -fr "$SITEDIR" && mkdir -p "$SITEDIR" || exit 1
+tar xfz "$PODEBCONFTGZ" -C "$SITEDIR"

Propchange: dl10n/trunk/compendiums/update_fs
------------------------------------------------------------------------------
    svn:executable = *




More information about the Debian-l10n-commits mailing list