Skip to content

Commit c0ccaf4

Browse files
committed
fix: Update translate file
1 parent d9e087b commit c0ccaf4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

assets/flutter_i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@
441441
"auto_sync_successful_notification_text": "Moonchain wallet has been successfully synced your ring data",
442442
"already_synced_notification_title": "Oops, Already synced ℹ️",
443443
"already_synced_notification_text": "Moonchain wallet tried to sync your ring data, But looks like you have synced the ring data today.",
444-
"auto_sync_failed": "Blueberry Ring aut-sync has been failed ❌, Please try again.",
444+
"auto_sync_failed": "Blueberry Ring aut-sync failed ❌, Please try again.",
445445
"no_rings_owned_notification": "Looks like this wallet doesn't own any Blueberry Rings. ℹ️",
446446
"syncing_data_from_ring": "Syncing data from Blueberry Ring #{0}. ⛏️",
447447
"already_synced_ring": "Blueberry Ring #{0}: Already synced. ℹ️",

translations/translate.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def main():
5252
"ja": "Japanese",
5353
"ru": "Russian"
5454
}
55+
5556
# Read the input JSON file
5657
with open('../assets/flutter_i18n/en.json', 'r') as file:
5758
en_data = json.load(file)
@@ -68,15 +69,24 @@ def main():
6869
# Find keys that are present in en.json but not in the current language file
6970
new_entries = {key: en_data[key] for key in en_data if key not in lang_data}
7071

72+
# Find keys that are present in the current language file but not in en.json
73+
unused_keys = [key for key in lang_data if key not in en_data]
74+
75+
# Remove unused keys from lang_data
76+
for key in unused_keys:
77+
del lang_data[key]
78+
7179
# Translate the new entries
7280
for key, value in new_entries.items():
7381
lang_data[key] = translate(value, lang_name)
74-
time.sleep(10) # Pause for a bit between each translation r
82+
time.sleep(10) # Pause for a bit between each translation request
83+
84+
# Write the updated language data back to the file
7585
with open(f'../assets/flutter_i18n/{lang_code}.json', 'w') as file:
7686
json.dump(lang_data, file, ensure_ascii=False, indent=4)
7787

7888
print(f"Translation to {lang_name} complete. Check the '{lang_code}.json' file.")
89+
print(f"Added {len(new_entries)} new entries and removed {len(unused_keys)} unused entries.")
7990

8091
if __name__ == '__main__':
8192
main()
82-

0 commit comments

Comments
 (0)