2.6.2. 将中文字符串翻译为英文字符串:transZhcnToEn
#------------------------------------------------------------------------------
# translate the Chinese Simplified(Zh-cn) string to English(en)
def transZhcnToEn(strToTrans) :
translatedStr = strToTrans;
transOK = False;
transErr = '';
if strIsAscii(strToTrans) :
transOK = True;
translatedStr = strToTrans;
else :
(transOK, translatedStr) = translateString(strToTrans, "zh-CN", "en");
return (transOK, translatedStr);
例 2.30. transZhcnToEn的使用范例
(transOK, translatedName) = transZhcnToEn(nameUtf8);