Exemplo n.º 1
0
def process(csvFileName1, csvFileName2, outputFileName):
    (contentsMapList1, keyLists1, pathList1, dstLangList1, baselineLang1) = csvUtil.generateContentsMapListFromCSVFile(csvFileName1)
    (contentsMapList2, keyLists2, pathList2, dstLangList2, baselineLang2) = csvUtil.generateContentsMapListFromCSVFile(csvFileName2)
    if len(pathList1) == 0 or len(pathList2) == 0:
        return
    if baselineLang1 != baselineLang2:
        print "Baseline language of csv1 isn't equal to that of csv2."
        return
    try:
        outputFile = open(outputFileName, 'wb')
    except IOError, (errno, strerror):
        print "IOError: " + strerror
        print "OutputFile: '" + outputFileName + "' invalid"
        return
Exemplo n.º 2
0
def process(csvFileName):
    (contentsMapList, keyLists, pathList, dstLangList, baselineLang) = csvUtil.generateContentsMapListFromCSVFile(
        csvFileName
    )
    for i in range(0, len(contentsMapList)):
        contentsMap = contentsMapList[i]
        baselineName = pathList[i]
        print "Processing: " + baselineName
        for j in range(0, len(dstLangList)):
            dstLang = dstLangList[j]
            (flag, dstFileName) = fileUtil.getDstXMLFileNameFromBaselineXMLFileName(baselineName, dstLang)
            dstFile = open(dstFileName + SUFFIX_TMP, "wb")
            xmlUtil.writeBackDstXMLFile(contentsMap, j + 1, dstFile, baselineName)
            keepSpecialChars(dstFileName + SUFFIX_TMP, dstFileName)
            print "Destination file : " + dstFileName + " is updated."
Exemplo n.º 3
0
def process(csvFileName):
    (contentsMapList, keyLists, pathList, dstLangList,
     baselineLang) = csvUtil.generateContentsMapListFromCSVFile(csvFileName)
    for i in range(0, len(contentsMapList)):
        contentsMap = contentsMapList[i]
        baselineName = pathList[i]
        print "Processing: " + baselineName
        for j in range(0, len(dstLangList)):
            dstLang = dstLangList[j]
            (flag,
             dstFileName) = fileUtil.getDstXMLFileNameFromBaselineXMLFileName(
                 baselineName, dstLang)
            dstFile = open(dstFileName + SUFFIX_TMP, 'wb')
            xmlUtil.writeBackDstXMLFile(contentsMap, j + 1, dstFile,
                                        baselineName)
            keepSpecialChars(dstFileName + SUFFIX_TMP, dstFileName)
            print "Destination file : " + dstFileName + " is updated."