[med-svn] r666 - trunk/community/website/locale

hanska-guest at alioth.debian.org hanska-guest at alioth.debian.org
Sat Oct 6 17:19:08 UTC 2007


Author: hanska-guest
Date: 2007-10-06 17:19:08 +0000 (Sat, 06 Oct 2007)
New Revision: 666

Modified:
   trunk/community/website/locale/add-locale
Log:
Mostly works, needs some fine-tuning (auto-commit, auto-add
new locale to /inc/locales.txt, ...)


Modified: trunk/community/website/locale/add-locale
===================================================================
--- trunk/community/website/locale/add-locale	2007-10-06 16:57:07 UTC (rev 665)
+++ trunk/community/website/locale/add-locale	2007-10-06 17:19:08 UTC (rev 666)
@@ -1,36 +1,35 @@
 #!/bin/sh
 
-set -x
+#set -x
 __ver=0.1
 __shell=$(getent passwd $(id -un) | cut -f7- -d:)
 
 [ -z "$__shell" ] && __shell=/bin/sh
 
 usage() {
-	echo  "$0 ver. $__ver\n\n
-Usage: $0 [ options ] locale\n\n
-Command\t\t\tAction\n
---no-option
--n\t\t\t\tDon't commit changes after
-\t\t\t\tclosing the editor"
+	echo "$(basename $0) ver. $__ver
+Usage: $(basename $0) [ options ] locale
+
+Command		Action
+--no-commit
+-n			Don't commit changes after
+			closing the editor"
+	exit 0
 }
 
-if [ -z "$(which msgfmt)" ]
-then
-	echo "[E]: You need to install the gettext package."
+need() {
+	echo "[E]: You need to install the $1 package."
 	exit 1
-else if [ -z "$(which svn)" ]
-then
-	echo "[E]: You need to install the subversion package."
-	exit 1
-fi
+}
 
+[ -z "$(which msgfmt)" ] && need gettext
+[ -z "$(which svn)" ] && need subversion
 [ "$#" -eq "0" ] && usage
 
 while [ "$#" -ge "1" ]
 do
 	case $1 in
-		--no-commit|-n)
+		"--no-commit"|"-n")
 			commit=0;
 			if [ -n "$2" ]
 			then
@@ -47,7 +46,7 @@
 done
 
 mkdir -pv $locale/LC_MESSAGES/
-cp -vrf messages.pot $locale/LC_MESSAGES/message.po
+cp -vrf messages.pot $locale/LC_MESSAGES/messages.po
 
 echo "$(basename $0):
 
@@ -59,9 +58,8 @@
 code of "999". This is typically done by exiting the shell with the command
 'exit 999'."
 
-sleep 10s
+$__shell -c "sleep 10s; sensible-editor $locale/LC_MESSAGES/messages.po" && __exit=0 || __exit="$?"
 
-$__shell -c "sensible-editor $locale/LC_MESSAGES/messages.po" && __exit=0 || __exit="$?"
 if [ "$__exit" -eq "999" ]
 then
 	echo "Shell exited with code 999, aborting."




More information about the debian-med-commit mailing list