[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r15043: Script for setting Pidgin language and removing redundant lo (torbrowser/trunk/build-scripts)
Author: sjm217
Date: 2008-06-08 16:03:31 -0400 (Sun, 08 Jun 2008)
New Revision: 15043
Added:
torbrowser/trunk/build-scripts/patch-pidgin-language.sh
Log:
Script for setting Pidgin language and removing redundant locales
Added: torbrowser/trunk/build-scripts/patch-pidgin-language.sh
===================================================================
--- torbrowser/trunk/build-scripts/patch-pidgin-language.sh (rev 0)
+++ torbrowser/trunk/build-scripts/patch-pidgin-language.sh 2008-06-08 20:03:31 UTC (rev 15043)
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+###
+### Set language code in Pidgin config file
+###
+### Copyright 2008 Steven J. Murdoch <http://www.cl.cam.ac.uk/users/sjm217/>
+### See LICENSE for licensing information
+###
+### $Id: patch-vidalia-language.sh 13521 2008-02-15 12:37:49Z sjm217 $
+###
+
+## Parse command line
+FILENAME=$1
+MOZLANG=$2
+PIDGINLOCALEDIR=$3
+GTKLOCALEDIR=$4
+
+## Handle exceptions where Mozilla language definition doesn't equal Vidalia's
+case "$MOZLANG" in
+ 'en-US') LANGCODE='en'
+ ;;
+ 'es-ES') LANGCODE='es'
+ ;;
+ 'fa-IR') LANGCODE='fa'
+ ;;
+ 'pt-PT') LANGCODE='pt'
+ ;;
+ 'zh-CN') LANGCODE='zh_CN'
+ ;;
+ *) LANGCODE="$MOZLANG"
+ ;;
+esac
+
+## Backup original file
+ORIGFILENAME=$FILENAME.orig
+mv "$FILENAME" "$ORIGFILENAME"
+
+## Replace LanguageCode value with $LANGCODE
+sed -c "s/PIDGINLOCALE/$LANGCODE/" "$ORIGFILENAME" > "$FILENAME"
+
+## Remove backup
+rm -f "$ORIGFILENAME"
+
+## Remove languages we don't need
+find "$PIDGINLOCALEDIR" -mindepth 1 -maxdepth 1 -not -iname $LANGCODE -print0 | xargs -0 rm -fr
+find "$GTKLOCALEDIR" -mindepth 1 -maxdepth 1 -not -iname $LANGCODE -print0 | xargs -0 rm -fr