From fd09e395a78e74ea1197125727dbab4f907fdb76 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Sat, 5 Jun 2010 02:18:44 -0700 Subject: [PATCH] Seems like this set of scripts works for the tests... --- bin/androidxml2po.bash | 25 +++++++++---------------- bin/xml2po.py | 3 ++- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/bin/androidxml2po.bash b/bin/androidxml2po.bash index 07b853f80..0a0ad8fb5 100755 --- a/bin/androidxml2po.bash +++ b/bin/androidxml2po.bash @@ -36,8 +36,8 @@ if [ ! -e /usr/bin/gettext ]; then fi # Set the languages here (po -> name of .po file. res -> name of res folder) -po_lang=( "ca" "cs" ) # "de" "es" "fr" "id" "it" "ja" "ko" "nb" "nl" "pl" "pt" "ru" "sv" "tr" "zh_CN" "zh_TW") -res_lang=("ca" "cs" ) # "de" "es" "fr" "id" "it" "ja" "ko" "nb" "nl" "pl" "pt" "ru" "sv" "tr" "zh-rCN" "zh-rTW") +po_lang=( "ca" ) #"cs" ) # "de" "es" "fr" "id" "it" "ja" "ko" "nb" "nl" "pl" "pt" "ru" "sv" "tr" "zh_CN" "zh_TW") +res_lang=("ca" ) #"cs" ) # "de" "es" "fr" "id" "it" "ja" "ko" "nb" "nl" "pl" "pt" "ru" "sv" "tr" "zh-rCN" "zh-rTW") #Change the dirs where the files are located. launchpad_po_files_dir="translations" @@ -51,8 +51,9 @@ xml2po="`dirname $0`/xml2po.py" function import_po2xml { for resource_file in $android_xml_filenames; do + echo "Importing .xml from .pot: $resource_file" for (( i=0 ; i<${#po_lang[*]} ; i=i+1 )); do - echo "Importing .xml from .po for "${resource_file}-${po_lang[i]}"" + echo " Importing .xml from .po for "${resource_file}-${po_lang[i]}"" mkdir -p "${android_xml_files_res_dir}"-"${res_lang[i]}" ${xml2po} -a -l "${po_lang[i]}" -p "${launchpad_po_files_dir}"/"${resource_file}"-"${po_lang[i]}".po \ "${android_xml_files_res_dir}"/"${resource_file}".xml > "${android_xml_files_res_dir}"-"${res_lang[i]}"/"${resource_file}".xml @@ -70,19 +71,11 @@ function export_xml2po "${android_xml_files_res_dir}"/"${resource_file}".xml for (( i=0 ; i<${#po_lang[*]} ; i=i+1 )); do - if [ -e "${launchpad_po_files_dir}"/"${resource_file}"-"${po_lang[i]}".po ] ; then - echo "Exporting .xml to updated .po for "${po_lang[i]}"" - if [ -e "${android_xml_files_res_dir}"-"${res_lang[i]}"/"${resource_file}".xml ] ; then - ${xml2po} -a \ - -r "${android_xml_files_res_dir}"-"${res_lang[i]}"/"${resource_file}".xml \ - -u "${launchpad_po_files_dir}"/"${resource_file}"-"${po_lang[i]}".po \ - "${android_xml_files_res_dir}"/"${resource_file}".xml - else - ${xml2po} -a \ - -u "${launchpad_po_files_dir}"/"${resource_file}"-"${po_lang[i]}".po \ - "${android_xml_files_res_dir}"/"${resource_file}".xml - fi - fi + echo " Exporting .xml to updated .po for "${resource_file}-${po_lang[i]} + ${xml2po} -a \ + -r "${android_xml_files_res_dir}"-"${res_lang[i]}"/"${resource_file}".xml \ + "${android_xml_files_res_dir}"/"${resource_file}".xml > \ + "${launchpad_po_files_dir}"/"${resource_file}"-"${po_lang[i]}".po done done diff --git a/bin/xml2po.py b/bin/xml2po.py index 94456f268..f261e5e0b 100755 --- a/bin/xml2po.py +++ b/bin/xml2po.py @@ -521,7 +521,8 @@ def processElementTag(node, replacements, restart = 0): if not translation: translation = outtxt.decode('utf-8') if worth and mark_untranslated: node.setLang('C') - translation = escapeXmlString(translation) + else: + translation = escapeXmlString(translation) if restart or worth: i = 0