chore: snapshot before performance optimization
This commit is contained in:
47
keep-notes/update_labels_dict.py
Normal file
47
keep-notes/update_labels_dict.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import json
|
||||
|
||||
def update_json(filepath, updates):
|
||||
with open(filepath, 'r+', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
for key, val in updates.items():
|
||||
keys = key.split('.')
|
||||
d = data
|
||||
for k in keys[:-1]:
|
||||
if k not in d: d[k] = {}
|
||||
d = d[k]
|
||||
d[keys[-1]] = val
|
||||
f.seek(0)
|
||||
json.dump(data, f, ensure_ascii=False, indent=2)
|
||||
f.truncate()
|
||||
|
||||
fa_updates = {
|
||||
'sidebar.editLabels': 'ویرایش برچسبها',
|
||||
'sidebar.edit': 'ویرایش یادداشت',
|
||||
'labels.confirmDeleteShort': 'تایید؟',
|
||||
'common.cancel': 'لغو',
|
||||
'common.delete': 'حذف',
|
||||
'labels.editLabels': 'ویرایش برچسبها',
|
||||
'labels.editLabelsDescription': 'برچسبهای خود را مدیریت کنید',
|
||||
'labels.newLabelPlaceholder': 'برچسب جدید...',
|
||||
'labels.loading': 'در حال بارگذاری...',
|
||||
'labels.noLabelsFound': 'برچسبی یافت نشد',
|
||||
'labels.changeColor': 'تغییر رنگ',
|
||||
'labels.deleteTooltip': 'حذف برچسب',
|
||||
}
|
||||
|
||||
fr_updates = {
|
||||
'labels.confirmDeleteShort': 'Confirmer ?',
|
||||
'common.cancel': 'Annuler',
|
||||
'common.delete': 'Supprimer'
|
||||
}
|
||||
|
||||
en_updates = {
|
||||
'labels.confirmDeleteShort': 'Confirm?',
|
||||
'common.cancel': 'Cancel',
|
||||
'common.delete': 'Delete'
|
||||
}
|
||||
|
||||
update_json('locales/fa.json', fa_updates)
|
||||
update_json('locales/fr.json', fr_updates)
|
||||
update_json('locales/en.json', en_updates)
|
||||
|
||||
Reference in New Issue
Block a user