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.
-->
<!-- 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.
2) Dynamic Equivalence not necessary literal translation but capture the idea and create the same desired effect
-->
<!--
Translation Note: Guidelines to those translating the resources
Dynamic Equivalence not necessary literal translation but
capture the idea and create the same desired effect
Goal: Maximize the chance that users will perform the task while
minimizing the annoyance.
-->
<resources>
<!--
Goal: Maximize the chance that they will perform the task while minimizing the annoyance.-->
<string-array name="reminders">
<!-- reminders: Make these < 20 chars so the task name is displayed -->
<item>Hi there! Have a sec?</item>

@ -194,7 +194,7 @@
<string name="taskList_nonag_reminder">Select an Action:</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_cleanup_dialog">"Delete completed tasks older than # days:"</string>
<string name="taskList_cleanup_dialog">Delete completed tasks older than # days:</string>
<!-- TaskEdit -->
<skip />
@ -246,7 +246,7 @@
<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.
\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
</string>
<string name="repeat_help_hide">Don\'t Show Help Anymore</string>

@ -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"
@ -68,7 +68,24 @@ function export_xml2po
${xml2po} -a -l "${po_lang[i]}" -o \
"${launchpad_pot_file_dir}"/"${resource_file}".pot \
"${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
}
function usage

@ -228,12 +228,17 @@ def stringForEntity(node):
return result
# for writing in a po file
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):
return text.replace('\\"', '"').replace("\\'","'").replace('\\\\','\\')
# for writing in an xml file
def escapeXmlString(text):
return text.replace('"','\\"').replace("'","\\'")
def getTranslation(text, spacepreserve = 0):
"""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
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)
if (text.strip() == ''):
return text
@ -249,7 +255,6 @@ def getTranslation(text, spacepreserve = 0):
if gt:
res = gt.ugettext(text.decode('utf-8'))
return res
return text
def myAttributeSerialize(node):
@ -516,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)
if restart or worth:
i = 0
while i < len(myrepl):
@ -624,9 +630,9 @@ def tryToUpdate(allargs, lang):
print >>sys.stderr, "OVDI!"
command = allargs[0]
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=',
'output=', 'po-file=', 'update-translation=' ])
'output=', 'po-file=', 'update-translation=', "reuse=" ])
for opt, arg in opts:
if opt in ('-a', '--automatic-tags'):
command += " -a"
@ -634,6 +640,8 @@ def tryToUpdate(allargs, lang):
command += " -k"
elif opt in ('-e', '--extract-all-entities'):
command += " -e"
elif opt in ('-r', '--reuse'):
origxml = arg
elif opt in ('-m', '--mode'):
command += " -m %s" % arg
elif opt in ('-o', '--output'):

Loading…
Cancel
Save