heliomarpm / udemy-downloader-gui

A desktop application for downloading Udemy Courses
MIT License
1.03k stars 209 forks source link

Sync locale files with template.json #139

Closed mirusu400 closed 1 year ago

mirusu400 commented 1 year ago

Summary of the Pull Request

What is this about: I just synchronize locale files with template.json

Here is my python script that make this change:

import json
import os

def update(filename):
    with open('template.json', 'r', encoding="utf-8") as f:
        template_data = json.load(f)

    with open(filename, 'r', encoding="utf-8") as f:
        ko_data = json.load(f)

    out_dict = {}
    for key in template_data.keys():
        if key in ko_data.keys():
            out_dict[key] = ko_data[key]
        else:
            out_dict[key] = template_data[key]

    with open(filename, 'w', encoding="utf-8") as f:
        json.dump(out_dict, f, ensure_ascii=False, indent=2)

if __name__ == "__main__":
    for filename in os.listdir("./"):
        if filename.endswith(".json") and filename != "template.json" and filename != "meta.json":
            update(filename)

Quality Checklist

heliomarpm commented 1 year ago

Thanks @mirusu400