Updated translation scripts, we're going in with guns blazing...

pull/14/head
Tim Su 14 years ago
parent d77c7ef12b
commit 91e44b668b

@ -14,19 +14,18 @@
limitations under the License. limitations under the License.
--> -->
<!-- Translation Note: <!--
Guidelines to those translating the resources Translation Note: Guidelines to those translating the resources
1) Quality over Quantity: the quality of the phrases is important not the number of phrases used in any given
languages. Dynamic Equivalence not necessary literal translation but
2) Dynamic Equivalence not necessary literal translation but capture the idea and create the same desired effect capture the idea and create the same desired effect
-->
Goal: Maximize the chance that users will perform the task while
minimizing the annoyance.
-->
<resources> <resources>
<!--
Goal: Maximize the chance that they will perform the task while minimizing the annoyance.-->
<string-array name="reminders"> <string-array name="reminders">
<!-- reminders: Make these < 20 chars so the task name is displayed --> <!-- reminders: Make these < 20 chars so the task name is displayed -->
<item>Hi there! Have a sec?</item> <item>Hi there! Have a sec?</item>

@ -194,7 +194,7 @@
<string name="taskList_nonag_reminder">Select an Action:</string> <string name="taskList_nonag_reminder">Select an Action:</string>
<string name="taskList_postpone_count">Times You\'ve Postponed: %d</string> <string name="taskList_postpone_count">Times You\'ve Postponed: %d</string>
<string name="taskList_postpone_dialog">Postpone for how long?</string> <string name="taskList_postpone_dialog">Postpone for how long?</string>
<string name="taskList_cleanup_dialog">"Delete completed tasks older than # days:"</string> <string name="taskList_cleanup_dialog">Delete completed tasks older than # days:</string>
<!-- TaskEdit --> <!-- TaskEdit -->
<skip /> <skip />
@ -246,7 +246,7 @@
<string name="repeat_help_dialog"> <string name="repeat_help_dialog">
To use repeats, set at least one of the deadlines above. When you complete this task, the deadline will be automatically advanced. To use repeats, set at least one of the deadlines above. When you complete this task, the deadline will be automatically advanced.
\n\n \n\n
If you don\'t want to see the new task right after you complete the old one, you should use the "Hide Until" field, which will also be advanced automatically. If you don\'t want to see the new task right after you complete the old one, you should use the \"Hide Until\" field, which will also be advanced automatically.
\n \n
</string> </string>
<string name="repeat_help_hide">Don\'t Show Help Anymore</string> <string name="repeat_help_hide">Don\'t Show Help Anymore</string>

@ -36,8 +36,8 @@ if [ ! -e /usr/bin/gettext ]; then
fi fi
# Set the languages here (po -> name of .po file. res -> name of res folder) # 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") 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") 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. #Change the dirs where the files are located.
launchpad_po_files_dir="translations" launchpad_po_files_dir="translations"
@ -68,7 +68,24 @@ function export_xml2po
${xml2po} -a -l "${po_lang[i]}" -o \ ${xml2po} -a -l "${po_lang[i]}" -o \
"${launchpad_pot_file_dir}"/"${resource_file}".pot \ "${launchpad_pot_file_dir}"/"${resource_file}".pot \
"${android_xml_files_res_dir}"/"${resource_file}".xml "${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
done
done done
} }
function usage function usage

@ -228,12 +228,17 @@ def stringForEntity(node):
return result return result
# for writing in a po file
def escapePoString(text): def escapePoString(text):
return text.replace('\\','\\\\').replace('"', "\\\"").replace("'","\\'").replace("\n","\\n").replace("\t","\\t") return text.replace("\\'","'").replace('\\','\\\\').replace('\\\\"', '\\"').replace("\n","\\n").replace("\t","\\t")
# for turning xml into raw resource
def unEscapeXmlString(text):
return text.replace('\\"','"').replace("\\'","'")
def unEscapePoString(text): # for writing in an xml file
return text.replace('\\"', '"').replace("\\'","'").replace('\\\\','\\') def escapeXmlString(text):
return text.replace('"','\\"').replace("'","\\'")
def getTranslation(text, spacepreserve = 0): def getTranslation(text, spacepreserve = 0):
"""Returns a translation via gettext for specified snippet. """Returns a translation via gettext for specified snippet.
@ -241,7 +246,8 @@ def getTranslation(text, spacepreserve = 0):
text should be a string to look for, spacepreserve set to 1 text should be a string to look for, spacepreserve set to 1
when spaces should be preserved. when spaces should be preserved.
""" """
#print >>sys.stderr,"getTranslation('%s')" % (text.encode('utf-8')) text = unEscapeXmlString(text)
# print >>sys.stderr,"getTranslation('%s')" % (text.encode('utf-8'))
text = normalizeString(text, not spacepreserve) text = normalizeString(text, not spacepreserve)
if (text.strip() == ''): if (text.strip() == ''):
return text return text
@ -249,7 +255,6 @@ def getTranslation(text, spacepreserve = 0):
if gt: if gt:
res = gt.ugettext(text.decode('utf-8')) res = gt.ugettext(text.decode('utf-8'))
return res return res
return text return text
def myAttributeSerialize(node): def myAttributeSerialize(node):
@ -516,7 +521,8 @@ def processElementTag(node, replacements, restart = 0):
if not translation: if not translation:
translation = outtxt.decode('utf-8') translation = outtxt.decode('utf-8')
if worth and mark_untranslated: node.setLang('C') if worth and mark_untranslated: node.setLang('C')
translation = escapeXmlString(translation)
if restart or worth: if restart or worth:
i = 0 i = 0
while i < len(myrepl): while i < len(myrepl):
@ -624,9 +630,9 @@ def tryToUpdate(allargs, lang):
print >>sys.stderr, "OVDI!" print >>sys.stderr, "OVDI!"
command = allargs[0] command = allargs[0]
args = allargs[1:] args = allargs[1:]
opts, args = getopt.getopt(args, 'avhm:ket:o:p:u:', opts, args = getopt.getopt(args, 'avhm:ket:o:p:u:r:',
['automatic-tags','version', 'help', 'keep-entities', 'extract-all-entities', 'merge', 'translation=', ['automatic-tags','version', 'help', 'keep-entities', 'extract-all-entities', 'merge', 'translation=',
'output=', 'po-file=', 'update-translation=' ]) 'output=', 'po-file=', 'update-translation=', "reuse=" ])
for opt, arg in opts: for opt, arg in opts:
if opt in ('-a', '--automatic-tags'): if opt in ('-a', '--automatic-tags'):
command += " -a" command += " -a"
@ -634,6 +640,8 @@ def tryToUpdate(allargs, lang):
command += " -k" command += " -k"
elif opt in ('-e', '--extract-all-entities'): elif opt in ('-e', '--extract-all-entities'):
command += " -e" command += " -e"
elif opt in ('-r', '--reuse'):
origxml = arg
elif opt in ('-m', '--mode'): elif opt in ('-m', '--mode'):
command += " -m %s" % arg command += " -m %s" % arg
elif opt in ('-o', '--output'): elif opt in ('-o', '--output'):

Loading…
Cancel
Save