1
0
mirror of https://github.com/immich-app/immich.git synced 2024-11-24 08:52:28 +02:00

chore(mobile): remove unused translation keys (#13335)

This commit is contained in:
Alex 2024-10-10 16:53:33 +07:00 committed by GitHub
parent 4ce49e4666
commit ee461e5910
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 532 additions and 660 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,24 @@
#!/usr/bin/env python3
import json
import subprocess
def main():
with open('assets/i18n/en-US.json', 'r') as f:
with open('assets/i18n/en-US.json', 'r+') as f:
data = json.load(f)
keys_to_delete = []
for k in data.keys():
print(k)
sp = subprocess.run(['sh', '-c', f'grep -r --include="*.dart" "{k}"'])
sp = subprocess.run(['sh', '-c', f'grep -q -r --include="*.dart" "{k}"'])
if sp.returncode != 0:
print("Not found in source code!")
return 1
print("Not found in source code, key:", k)
keys_to_delete.append(k)
for k in keys_to_delete:
del data[k]
f.seek(0)
f.truncate()
json.dump(data, f, indent=4)
if __name__ == '__main__':
main()

View File

@ -1,31 +0,0 @@
#!/usr/bin/env python3
import json
import subprocess
def main():
print("CHECK GERMAN TRANSLATIONS")
with open('assets/i18n/de-DE.json', 'r') as f:
data = json.load(f)
for k in data.keys():
print(k)
sp = subprocess.run(['sh', '-c', f'grep -r --include="./assets/i18n/en-US.json" "{k}"'])
if sp.returncode != 0:
print(f"Outdated Key! {k}")
return 1
print("CHECK FRENCH TRANSLATIONS")
with open('assets/i18n/fr-FR.json', 'r') as f:
data = json.load(f)
for k in data.keys():
print(k)
sp = subprocess.run(['sh', '-c', f'grep -r --include="./assets/i18n/en-US.json" "{k}"'])
if sp.returncode != 0:
print(f"Outdated Key! {k}")
return 1
if __name__ == '__main__':
main()