mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 06:31:58 +00:00
chore(mobile): remove unused translation keys (#13335)
This commit is contained in:
parent
4ce49e4666
commit
ee461e5910
3 changed files with 532 additions and 660 deletions
File diff suppressed because it is too large
Load diff
|
@ -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()
|
|
@ -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()
|
Loading…
Reference in a new issue