import json import os def update_locale(file, updates): if not os.path.exists(file): return with open(file, 'r', encoding='utf-8') as f: data = json.load(f) if 'notes' not in data: data['notes'] = {} for k, v in updates.items(): data['notes'][k] = v with open(file, 'w', encoding='utf-8') as f: json.dump(data, f, indent=2, ensure_ascii=False) fa_updates = { 'modified': 'ویرایش شده', 'created': 'ایجاد شده' } en_updates = { 'modified': 'Modified', 'created': 'Created' } fr_updates = { 'modified': 'Modifiée', 'created': 'Créée' } update_locale('locales/fa.json', fa_updates) update_locale('locales/en.json', en_updates) update_locale('locales/fr.json', fr_updates)