fix OpenCC not work
This commit is contained in:
@@ -275,7 +275,7 @@ def get_data_from_json(file_number, oCC):
|
|||||||
if len(mapping_data.xpath('a[contains(@keyword, $name)]/@' + language, name=vars)) != 0:
|
if len(mapping_data.xpath('a[contains(@keyword, $name)]/@' + language, name=vars)) != 0:
|
||||||
return mapping_data.xpath('a[contains(@keyword, $name)]/@' + language, name=vars)[0]
|
return mapping_data.xpath('a[contains(@keyword, $name)]/@' + language, name=vars)[0]
|
||||||
else:
|
else:
|
||||||
return vars
|
raise IndexError('keyword not found')
|
||||||
for cc in cc_vars:
|
for cc in cc_vars:
|
||||||
if json_data[cc] == "" or len(json_data[cc]) == 0:
|
if json_data[cc] == "" or len(json_data[cc]) == 0:
|
||||||
continue
|
continue
|
||||||
@@ -303,20 +303,20 @@ def get_data_from_json(file_number, oCC):
|
|||||||
json_data[cc] = ADC_function.delete_all_elements_in_list("删除", json_data[cc])
|
json_data[cc] = ADC_function.delete_all_elements_in_list("删除", json_data[cc])
|
||||||
elif ccm == 3:
|
elif ccm == 3:
|
||||||
json_data[cc] = convert_list(info_mapping_data, "jp", json_data[cc])
|
json_data[cc] = convert_list(info_mapping_data, "jp", json_data[cc])
|
||||||
json_data[cc] = ADC_function.delete_list_all_elements("删除", json_data[cc])
|
json_data[cc] = ADC_function.delete_all_elements_in_list("删除", json_data[cc])
|
||||||
except:
|
except:
|
||||||
json_data[cc] = [oCC.convert(t) for t in json_data[cc]]
|
json_data[cc] = [oCC.convert(t) for t in json_data[cc]]
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
if ccm == 1:
|
if ccm == 1:
|
||||||
json_data[cc] = convert(info_mapping_data, "zh_cn", json_data[cc])
|
json_data[cc] = convert(info_mapping_data, "zh_cn", json_data[cc])
|
||||||
json_data[cc] = ADC_function.delete_list_all_elements("删除", json_data[cc])
|
json_data[cc] = ADC_function.delete_all_elements_in_list("删除", json_data[cc])
|
||||||
elif ccm == 2:
|
elif ccm == 2:
|
||||||
json_data[cc] = convert(info_mapping_data, "zh_tw", json_data[cc])
|
json_data[cc] = convert(info_mapping_data, "zh_tw", json_data[cc])
|
||||||
json_data[cc] = ADC_function.delete_list_all_elements("删除", json_data[cc])
|
json_data[cc] = ADC_function.delete_all_elements_in_list("删除", json_data[cc])
|
||||||
elif ccm == 3:
|
elif ccm == 3:
|
||||||
json_data[cc] = convert(info_mapping_data, "jp", json_data[cc])
|
json_data[cc] = convert(info_mapping_data, "jp", json_data[cc])
|
||||||
json_data[cc] = ADC_function.delete_list_all_elements("删除", json_data[cc])
|
json_data[cc] = ADC_function.delete_all_elements_in_list("删除", json_data[cc])
|
||||||
except IndexError:
|
except IndexError:
|
||||||
json_data[cc] = oCC.convert(json_data[cc])
|
json_data[cc] = oCC.convert(json_data[cc])
|
||||||
except:
|
except:
|
||||||
|
|||||||
Reference in New Issue
Block a user