Edric Milaret | 45e26d2 | 2016-05-06 12:09:17 -0400 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import os |
| 4 | import shutil |
| 5 | |
| 6 | print ("Pulling translations") |
| 7 | |
| 8 | os.system("tx pull -af --minimum-perc=30") |
| 9 | |
| 10 | print ("Updating .pro file") |
| 11 | |
| 12 | translationFiles = [] |
| 13 | |
| 14 | for filename in os.listdir('./translations'): |
| 15 | translationFiles.append("translations/{0}".format(filename)) |
| 16 | |
| 17 | proFile = "RingWinClient.pro" |
| 18 | shutil.move(proFile, proFile + "~") |
| 19 | |
| 20 | destination = open(proFile, "w") |
| 21 | source = open(proFile + "~", "r") |
| 22 | for line in source: |
| 23 | if not ".ts" in line: |
| 24 | destination.write(line) |
| 25 | if "TRANSLATIONS = " in line: |
| 26 | for filename in translationFiles: |
| 27 | destination.write(" {0} \\\n".format(filename)) |
| 28 | |
| 29 | source.close() |
| 30 | destination.close() |
| 31 | os.remove(proFile + "~") |
| 32 | |
| 33 | print ("Updating translations") |
| 34 | |
| 35 | os.system("lupdate RingWinClient.pro") |
| 36 | |
| 37 | print ("All done you can commit now") |