From 2d260a80fa4ab499a8441484d50c3028bf5069b1 Mon Sep 17 00:00:00 2001
From: walking <walking@mail.i2p>
Date: Sat, 12 Feb 2011 10:50:58 +0000
Subject: [PATCH] fix msgbundle under windows

---
 apps/routerconsole/java/build.xml          | 10 ++++------
 apps/routerconsole/java/bundle-messages.sh | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/apps/routerconsole/java/build.xml b/apps/routerconsole/java/build.xml
index 6e7d765aac..fdb976fbec 100644
--- a/apps/routerconsole/java/build.xml
+++ b/apps/routerconsole/java/build.xml
@@ -86,9 +86,8 @@
         <exec executable="sh" osfamily="mac" failifexecutionfails="false" >
             <arg value="./bundle-messages.sh" />
         </exec>
-        <exec executable="cmd" osfamily="windows" failifexecutionfails="false" >
-            <arg value="/c" />
-            <arg value="bundle-messages.bat" />
+        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
+            <arg value="./bundle-messages.sh" />
         </exec>
         <!-- jar again to get the latest messages_*.class files -->
         <jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
@@ -106,9 +105,8 @@
             <arg value="./bundle-messages.sh" />
             <arg value="-p" />
         </exec>
-        <exec executable="cmd" osfamily="windows" failifexecutionfails="true" >
-            <arg value="/c" />
-            <arg value="bundle-messages.bat" />
+        <exec executable="sh" osfamily="windows" failifexecutionfails="true" >
+            <arg value="./bundle-messages.sh" />
             <arg value="-p" />
         </exec>
     </target>
diff --git a/apps/routerconsole/java/bundle-messages.sh b/apps/routerconsole/java/bundle-messages.sh
index dd422bf064..c7ceed5d50 100755
--- a/apps/routerconsole/java/bundle-messages.sh
+++ b/apps/routerconsole/java/bundle-messages.sh
@@ -18,6 +18,17 @@ then
 	POUPDATE=1
 fi
 
+# on windows, one must specify the path of commnad find
+# since windows has its own retarded version of find.
+if which find|grep -q -i windows ; then
+	export PATH=.:/bin:/usr/local/bin:$PATH
+fi
+# Fast mode - update ondemond
+echo Placing a file named messages_{LangCode}.only in locale folder,
+echo will limit .po file update to the language specified by {LangCode}.
+LG2=$(find ../locale -iname messages_*.only|tail -1)
+[ LG2 ] && LG2=${LG2#../locale/messages_} && LG2=${LG2%.only}
+
 #
 # generate strings/Countries.java from ../../../installer/resources/countries.txt
 #
@@ -53,6 +64,11 @@ do
 	# get language
 	LG=${i#../locale/messages_}
 	LG=${LG%.po}
+	
+	# skip, if specified
+	if [ $LG2 ]; then
+		[ $LG != $LG2 ] && continue || echo INFO: Language update is set to [$LG2] only.
+	fi
 
 	if [ "$POUPDATE" = "1" ]
 	then
-- 
GitLab