mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Chunk translation clean script to avoid too long url error (#43090)
This commit is contained in:
parent
68d757e5d2
commit
687923690f
@ -91,22 +91,25 @@ def run():
|
||||
print("No missing translations!")
|
||||
return 0
|
||||
|
||||
key_data = lokalise.keys_list(
|
||||
{"filter_keys": ",".join(missing_keys), "limit": 1000}
|
||||
)
|
||||
if len(key_data) != len(missing_keys):
|
||||
print(
|
||||
f"Lookin up key in Lokalise returns {len(key_data)} results, expected {len(missing_keys)}"
|
||||
)
|
||||
return 1
|
||||
# We can't query too many keys at once, so limit the number to 50.
|
||||
for i in range(0, len(missing_keys), 50):
|
||||
chunk = missing_keys[i : i + 50]
|
||||
|
||||
print(f"Deleting {len(missing_keys)} keys:")
|
||||
for key in missing_keys:
|
||||
print(" -", key)
|
||||
print()
|
||||
while input("Type YES to delete these keys: ") != "YES":
|
||||
pass
|
||||
key_data = lokalise.keys_list({"filter_keys": ",".join(chunk), "limit": 1000})
|
||||
if len(key_data) != len(chunk):
|
||||
print(
|
||||
f"Lookin up key in Lokalise returns {len(key_data)} results, expected {len(chunk)}"
|
||||
)
|
||||
return 1
|
||||
|
||||
print(lokalise.keys_delete_multiple([key["key_id"] for key in key_data]))
|
||||
print(f"Deleting {len(chunk)} keys:")
|
||||
for key in chunk:
|
||||
print(" -", key)
|
||||
print()
|
||||
while input("Type YES to delete these keys: ") != "YES":
|
||||
pass
|
||||
|
||||
print(lokalise.keys_delete_multiple([key["key_id"] for key in key_data]))
|
||||
print()
|
||||
|
||||
return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user