Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- def main():
- script_path = ""
- output_path = ""
- if len(sys.argv) >= 2:
- script_path = sys.argv[1]
- else:
- script_path = raw_input("Inserisci il percorso dello script: ")
- if len(sys.argv) >= 3:
- output_path = sys.argv[2]
- else:
- output_path = raw_input("Inserisci il nome del file lang di output: ")
- o_script = open(script_path,"r")
- w_lang = open(output_path,"w")
- w_lang.write("// Generato con easy lang creator 1.0\n\n")
- for line in o_script:
- line = line.strip()
- if line[0:1] != "#":
- if (line.find('"') != -1 and line.find("'") == -1) or (line.find("'") != -1 and line.find('"') == -1):
- print "Linea:\t\t" + line
- split = line.split('"')
- for i in range(len(split)):
- if split[i] != "" and i%2 != 0:
- print 'Stringa:\t"' + split[i] + '"'
- mod = raw_input('Traduzione:\t')
- if mod != "-1":
- w_lang.write('_oldmsg = "'+split[i]+'"\n')
- w_lang.write('_newmsg = "'+mod+'"\n')
- print "" #un a capo
- w_lang.write("\n")
- o_script.close()
- w_lang.close()
- print "File .lang creato con successo"
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement