Skip to content

Instantly share code, notes, and snippets.

@iGabyTM
Created December 11, 2021 12:43
Show Gist options
  • Save iGabyTM/a6f30123f125c35f7133d2121032a6bb to your computer and use it in GitHub Desktop.
Save iGabyTM/a6f30123f125c35f7133d2121032a6bb to your computer and use it in GitHub Desktop.
Fix romanian translation .SRT files
@echo off
python translations.py
import tkinter as tk
from tkinter import filedialog
def main():
root = tk.Tk()
root.withdraw()
file_path = filedialog.askopenfilename()
if file_path == '':
return
fin = open(file_path, 'rt')
lines = fin.readlines()
fin.close()
with open(file_path, 'wt', encoding='utf8') as file:
for line in lines:
file.write(line.replace('º', 'ș').replace('ª', 'Ș').replace('þ', 'ț').replace('Þ', 'Ț'))
file.close()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment