import json
import os

def fix_common():
    path = os.path.join("src", "locales", "translations.json")
    with open(path, "r", encoding="utf-8") as f:
        data = json.load(f)

    if "common" not in data: data["common"] = {}
    
    def set_all(key, en, me, ru, ua):
        data["common"][key] = {
            "en": en,
            "me": me,
            "ru": ru,
            "ua": ua
        }

    set_all("or", "or", "ili", "или", "або")
    set_all("back", "Back", "Nazad", "Назад", "Назад")
    set_all("pending", "Pending...", "Na čekanju...", "Ожидание...", "Очікування...")
    set_all("default", "Default", "Podrazumijevano", "По умолчанию", "За замовчуванням")
    set_all("orderId", "Order #{id}", "Narudžba #{id}", "Заказ #{id}", "Замовлення #{id}")

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

if __name__ == "__main__":
    fix_common()
