def convert_file()

in SSReader.py [0:0]


def convert_file(columnKey, row, columnValue, target, file, sheetIndex, initialPlaceHolder):

    # convert alphabets to sheet column index in int.
    columnValue, columnKey = ord(columnValue.lower()) - 97, ord(columnKey.lower()) - 97
    finalPlaceHolder = ""

    # TODO: is there better way to get the path?
    current_directory = os.path.dirname(os.path.realpath(__file__))
    file = (current_directory + "/" + file)
    workbook = xlrd.open_workbook(file)
    sheet = workbook.sheet_by_index(sheetIndex)

    if target == "ios":
        iosFile = open("Localizable.strings", 'w')
        finalPlaceHolder = "%@"
    elif target == "android":
        androidFile = open("strings.xml", 'w')
        androidFile.write("<resources>\n")
        finalPlaceHolder = "%s"

    for rowIndex in range(row, sheet.nrows):
        if sheet.cell_value(rowIndex, columnKey) != "":

            # if the cell contains number, convert to string
            value = str(sheet.cell_value(rowIndex, columnValue))
            value = special_character_replacement(value, target)

            if '{' in value:
                value = placeholder_replacement(sheet.cell_value(rowIndex, columnValue), initialPlaceHolder,
                                                finalPlaceHolder)

            # TODO: use the .format() function instead
            if target == "ios":
                writeValue = '\"' + sheet.cell_value(rowIndex, columnKey) + "\" = \"" + value + "\";\n"
                iosFile.write(writeValue)
            if target == "android":
                androidFile.write("\t<string name=\"" + sheet.cell_value(rowIndex, columnKey) + "\">"
                                  + value + "</string>\n")

    if target == "ios":
        iosFile.close()
    elif target == "android":
        androidFile.write("</resources>\n")
        androidFile.close()