Ejemplo n.º 1
0
def translist(soupstr, from_lang, to_lang):
    soupstr_list = re.split(r"\n+", soupstr)
    soupstr_list = [x.strip() for x in soupstr_list]
    soupstr_list = [x for x in soupstr_list if x]
    listlen = len(soupstr_list)
    trans_list = [None] * listlen
    for i in range(listlen):
        trans_list[i] = transString(soupstr_list[i], from_lang, to_lang)

    return "\n".join(trans_list)
Ejemplo n.º 2
0
def marksoup(soupstr, from_lang, to_lang, countlimit=25):
    soupstr_list = re.split(r"\n+", soupstr)
    soupstr_list = [x.strip() for x in soupstr_list if len(x.strip()) > countlimit]
    listlen = len(soupstr_list)
    trans_list = [None] * listlen

    for i in range(listlen):
        trans_list[i] = transString(soupstr_list[i], from_lang, to_lang)

    markuplist = marklist(soupstr_list, trans_list)
    markup = "\n".join(markuplist)
    return markup