Fixed messed up whitespaces
parent
5104c2b586
commit
b1ac8ade6d
|
|
@ -49,7 +49,7 @@ into google sheets.
|
||||||
|
|
||||||
If the --rev revision already contains a translation for the text, it
|
If the --rev revision already contains a translation for the text, it
|
||||||
will be included in the spreadsheet for reference.
|
will be included in the spreadsheet for reference.
|
||||||
|
|
||||||
Normally you would want --rev_base to be the last revision to have
|
Normally you would want --rev_base to be the last revision to have
|
||||||
translations added, and --rev to be the tip of the current
|
translations added, and --rev to be the tip of the current
|
||||||
project. You can find the last commit with translation work using "git log --grep INTL- | head"
|
project. You can find the last commit with translation work using "git log --grep INTL- | head"
|
||||||
|
|
@ -66,7 +66,6 @@ translate_attribs = [
|
||||||
"label",
|
"label",
|
||||||
"label_selected",
|
"label_selected",
|
||||||
"tool_tip",
|
"tool_tip",
|
||||||
"default_text",
|
|
||||||
"ignoretext",
|
"ignoretext",
|
||||||
"yestext",
|
"yestext",
|
||||||
"notext",
|
"notext",
|
||||||
|
|
@ -243,7 +242,7 @@ def find_deletions(mod_tree, base_tree, lang, args, f):
|
||||||
mod_filename = transl_filename.replace("/xui/{}/".format(lang), "/xui/{}/".format(args.base_lang))
|
mod_filename = transl_filename.replace("/xui/{}/".format(lang), "/xui/{}/".format(args.base_lang))
|
||||||
#print("checking",transl_filename,"against",mod_filename)
|
#print("checking",transl_filename,"against",mod_filename)
|
||||||
try:
|
try:
|
||||||
mod_blob = mod_tree[mod_filename]
|
mod_blob = mod_tree[mod_filename]
|
||||||
except:
|
except:
|
||||||
print(" delete file", transl_filename, file=f)
|
print(" delete file", transl_filename, file=f)
|
||||||
continue
|
continue
|
||||||
|
|
@ -258,7 +257,7 @@ def find_deletions(mod_tree, base_tree, lang, args, f):
|
||||||
if not elt_key in mod_dict:
|
if not elt_key in mod_dict:
|
||||||
if lines == 0:
|
if lines == 0:
|
||||||
print(" in file", transl_filename, file=f)
|
print(" in file", transl_filename, file=f)
|
||||||
lines += 1
|
lines += 1
|
||||||
print(" delete element", elt_key, file=f)
|
print(" delete element", elt_key, file=f)
|
||||||
else:
|
else:
|
||||||
transl_elt = transl_dict[elt_key]
|
transl_elt = transl_dict[elt_key]
|
||||||
|
|
@ -267,14 +266,14 @@ def find_deletions(mod_tree, base_tree, lang, args, f):
|
||||||
if not a in mod_elt.attrib:
|
if not a in mod_elt.attrib:
|
||||||
if lines == 0:
|
if lines == 0:
|
||||||
print(" in file", transl_filename, file=f)
|
print(" in file", transl_filename, file=f)
|
||||||
lines += 1
|
lines += 1
|
||||||
print(" delete attribute", a, "from", elt_key, file=f)
|
print(" delete attribute", a, "from", elt_key, file=f)
|
||||||
if transl_elt.text and (not mod_elt.text):
|
if transl_elt.text and (not mod_elt.text):
|
||||||
if lines == 0:
|
if lines == 0:
|
||||||
print(" in file", transl_filename, file=f)
|
print(" in file", transl_filename, file=f)
|
||||||
lines += 1
|
lines += 1
|
||||||
print(" delete text from", elt_key, file=f)
|
print(" delete text from", elt_key, file=f)
|
||||||
|
|
||||||
def save_translation_file(per_lang_data, aux_data, outfile):
|
def save_translation_file(per_lang_data, aux_data, outfile):
|
||||||
|
|
||||||
langs = sorted(per_lang_data.keys())
|
langs = sorted(per_lang_data.keys())
|
||||||
|
|
@ -302,8 +301,8 @@ def save_translation_file(per_lang_data, aux_data, outfile):
|
||||||
worksheet.set_column('A:B', 60, wrap_format)
|
worksheet.set_column('A:B', 60, wrap_format)
|
||||||
worksheet.set_column('C:C', 60, wrap_unlocked_format)
|
worksheet.set_column('C:C', 60, wrap_unlocked_format)
|
||||||
worksheet.set_column('D:E', 40, wrap_unlocked_format)
|
worksheet.set_column('D:E', 40, wrap_unlocked_format)
|
||||||
worksheet.set_column('F:F', 50, wrap_format)
|
worksheet.set_column('F:F', 50, wrap_format, {'hidden': True})
|
||||||
worksheet.set_column('G:H', 30, wrap_format)
|
worksheet.set_column('G:H', 30, wrap_format, {'hidden': True})
|
||||||
|
|
||||||
# Lock the top row (column headers) in place while scrolling
|
# Lock the top row (column headers) in place while scrolling
|
||||||
worksheet.freeze_panes(1, 0)
|
worksheet.freeze_panes(1, 0)
|
||||||
|
|
@ -311,14 +310,14 @@ def save_translation_file(per_lang_data, aux_data, outfile):
|
||||||
|
|
||||||
# Reference info, not for translation
|
# Reference info, not for translation
|
||||||
for aux, data in list(aux_data.items()):
|
for aux, data in list(aux_data.items()):
|
||||||
df = pd.DataFrame(data, columns = ["Key", "Value"])
|
df = pd.DataFrame(data, columns = ["Key", "Value"])
|
||||||
df.to_excel(writer, index=False, sheet_name=aux)
|
df.to_excel(writer, index=False, sheet_name=aux)
|
||||||
worksheet = writer.sheets[aux]
|
worksheet = writer.sheets[aux]
|
||||||
worksheet.set_column('A:A', 50, bold_wrap_format)
|
worksheet.set_column('A:A', 50, bold_wrap_format)
|
||||||
worksheet.set_column('B:B', 80, wrap_format)
|
worksheet.set_column('B:B', 80, wrap_format)
|
||||||
|
|
||||||
print("Writing", outfile)
|
print("Writing", outfile)
|
||||||
writer.close()
|
writer.save()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
|
@ -402,7 +401,7 @@ if __name__ == "__main__":
|
||||||
if args.deleted:
|
if args.deleted:
|
||||||
deletion_file = "Translate_deletions.txt"
|
deletion_file = "Translate_deletions.txt"
|
||||||
print("Saving deletion info to", deletion_file)
|
print("Saving deletion info to", deletion_file)
|
||||||
with open(deletion_file,"w", encoding="utf-8") as f:
|
with open(deletion_file,"w") as f:
|
||||||
for lang in langs:
|
for lang in langs:
|
||||||
find_deletions(mod_tree, base_tree, lang, args, f)
|
find_deletions(mod_tree, base_tree, lang, args, f)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue