tools/translations_status

Dimitrie O. Paun dpaun at rogers.com
Sat Sep 20 10:36:43 CDT 2003


Here is a little script that can help translators
to keep their languages up to date. It already
helped get the French translation updated :)))

ChangeLog
    New tool for displaying the translation status.

--- /dev/null	2003-01-30 05:24:37.000000000 -0500
+++ tools/translations_status	2003-09-20 11:34:05.000000000 -0400
@@ -0,0 +1,65 @@
+#!/bin/sh
+# Copyright 2003 Dimitire O. Paun
+# Simply run it from the root of your wine CVS tree:
+#    $ tools/tools/translations_status
+
+MASTER_LANG=En
+MASTER_FILES=`find . -name "*$MASTER_LANG.rc"`
+
+list_translations()
+{
+    MASTER_FILE=$1
+    TRANSLATIONS=`ls ${MASTER_FILE%$MASTER_LANG.rc}??.rc`
+    for translation in $TRANSLATIONS; do
+        LANG=`echo "$translation" | sed 's/.*\(..\)\.rc/\1/'`
+        if [ "$LANG" != 'xx' ]; then echo "$LANG"; fi
+    done
+}
+
+seconds_since_epoch()
+{
+    FILE="$1"
+    STATUS="`cvs status $FILE 2>/dev/null | grep 'Working revision:'`"
+    if ! echo "$STATUS" | grep -q "No entry for"; then
+        DATE="`echo "$STATUS" | sed 's/[^0-9]*[^ ]* *//'`"
+        date -d "$DATE" '+%s'
+    fi
+}
+
+
+echo "Legend:"
+echo "  '.' -- translation appears to be uptodate"
+echo "  'x' -- translation needs updating"
+echo "  '?' -- unknown status (file not under CVS control)"
+echo "  ' ' -- translation missing"
+echo "Master language is $MASTER_LANG"
+echo
+
+ALL_LANGS=`(for file in $MASTER_FILES; do list_translations "$file"; done) | sort -u`
+
+echo "  Module / Language      " $ALL_LANGS
+
+for master in $MASTER_FILES; do
+    MASTER_TIMESTAMP=`seconds_since_epoch "$master"`
+    APP=`echo "${master%/*}" | sed 's/..//'`
+    printf "%25s" "$APP"
+    for lang in $ALL_LANGS; do
+	LANG_FILE="${master%$MASTER_LANG.rc}$lang.rc"
+	if [ -f "$LANG_FILE" ]; then
+            if [ -z $MASTER_TIMESTAMP ]; then
+	        STATUS="?"
+	    else
+	    	LANG_TIMESTAMP=`seconds_since_epoch "$LANG_FILE"`
+	    	if [ "$LANG_TIMESTAMP" -lt "$MASTER_TIMESTAMP" ]; then
+		    STATUS="x"
+	    	else
+		    STATUS="."
+	    	fi
+	    fi
+	else
+	    STATUS=" "
+	fi
+	echo -n " $STATUS "
+    done
+    echo
+done


-- 
Dimi.




More information about the wine-devel mailing list