]> hydra-www.ietfng.org Git - android-vcpass-oisafe/commitdiff
Translations: Update scripts to export .po files according to new Launchpad scheme.
authorpeli0101 <peli0101@72b678ce-9140-0410-bee8-679b907dd61a>
Sat, 14 Nov 2009 16:10:40 +0000 (16:10 +0000)
committerpeli0101 <peli0101@72b678ce-9140-0410-bee8-679b907dd61a>
Sat, 14 Nov 2009 16:10:40 +0000 (16:10 +0000)
git-svn-id: http://openintents.googlecode.com/svn/trunk/Safe@2387 72b678ce-9140-0410-bee8-679b907dd61a

translations/androidxml2po.bash

index d40dcad76cbde0984f894253df06a93caa9877cf..aa2de48355df0a2ee5ef6f030f64372ec42a98e6 100644 (file)
@@ -3,6 +3,8 @@
 #Wrapper for xml2po for android and launchpad: Import .xml's from .po's, or export/update .po's from string.xml's. Run from the /res directory. Provide a string with value "translator-credits" for Launchpad.
 #Copyright 2009 by pjv. Licensed under GPLv3.
 
+# Nov 14, 2009: Peli: Modified export_xml2po to work with new Launchpad scheme.
+
 #Set the languages here (long version is the android resource append string).
 short_lang=("de" "es" "fr") #do not include template language ("en" usually).
 #="nl" "de" "fr" "ar" "es" "he" "hu" "id" "it" "pl" "pt_BR" "ru" "sv" "zh_CN"
@@ -15,6 +17,8 @@ android_xml_files_res_dir="../res/values"
 #Change the typical filenames.
 launchpad_po_filename="safe"
 android_xml_filename="strings"
+#Export directory of merged .po files. MUST not start with ".", or msgmerge will complain.
+export_po="export_po"
 #Location of xml2po
 xml2po="xml2po"
 
@@ -33,18 +37,26 @@ function export_xml2po
 echo "Exporting .xml to .pot"
 ${xml2po} -a -l "${short_lang[i]}" -o "${launchpad_pot_file_dir}"/"${launchpad_po_filename}".pot "${android_xml_files_res_dir}"/"${android_xml_filename}".xml
 
+# Create clean export folder for exported .po files:
+echo "Making export folder: ${export_po}"
+mkdir -p "${export_po}"
+rm "${export_po}"/*
+
 for (( i=0 ; i<${#short_lang[*]} ; i=i+1 )) ;
 do
     if [ -e "${launchpad_po_files_dir}"/"${launchpad_po_filename}"-"${short_lang[i]}".po ] ; then
+           # Create separate copy, because Launchpad exports "project-xx.po" but imports "xx.po"
        echo "Exporting .xml to updated .po for "${short_lang[i]}""
-       echo "Making temporary folder: .tmp."${launchpad_po_files_dir}""
-       mkdir -p .tmp."${launchpad_po_files_dir}"
+               cp "${launchpad_po_files_dir}"/"${launchpad_po_filename}"-"${short_lang[i]}".po "${short_lang[i]}".po
        if [ -e "${android_xml_files_res_dir}"-"${long_lang[i]}"/"${android_xml_filename}".xml ] ; then
-               ${xml2po} -a -u "${launchpad_po_files_dir}"/"${launchpad_po_filename}"-"${short_lang[i]}".po "${android_xml_files_res_dir}"/"${android_xml_filename}".xml
+               #${xml2po} -a -u "${launchpad_po_files_dir}"/"${launchpad_po_filename}"-"${short_lang[i]}".po "${android_xml_files_res_dir}"/"${android_xml_filename}".xml
+            ${xml2po} -a -u "${short_lang[i]}".po "${android_xml_files_res_dir}"/"${android_xml_filename}".xml
         else
-               ${xml2po} -a -u "${launchpad_po_files_dir}"/"${launchpad_po_filename}"-"${short_lang[i]}".po "${android_xml_files_res_dir}"/"${android_xml_filename}".xml
+                   echo "-"
+               #${xml2po} -a -u "${launchpad_po_files_dir}"/"${launchpad_po_filename}"-"${short_lang[i]}".po "${android_xml_files_res_dir}"/"${android_xml_filename}".xml
         fi
-    fi 
+               mv "${short_lang[i]}".po "${export_po}"/"${short_lang[i]}".po
+    fi
 done
 }