Chunk translation clean script to avoid too long url error (#43090)
This commit is contained in:
parent
68d757e5d2
commit
687923690f
1 changed files with 18 additions and 15 deletions
|
@ -91,22 +91,25 @@ def run():
|
||||||
print("No missing translations!")
|
print("No missing translations!")
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
key_data = lokalise.keys_list(
|
# We can't query too many keys at once, so limit the number to 50.
|
||||||
{"filter_keys": ",".join(missing_keys), "limit": 1000}
|
for i in range(0, len(missing_keys), 50):
|
||||||
)
|
chunk = missing_keys[i : i + 50]
|
||||||
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
|
|
||||||
|
|
||||||
print(f"Deleting {len(missing_keys)} keys:")
|
key_data = lokalise.keys_list({"filter_keys": ",".join(chunk), "limit": 1000})
|
||||||
for key in missing_keys:
|
if len(key_data) != len(chunk):
|
||||||
print(" -", key)
|
print(
|
||||||
print()
|
f"Lookin up key in Lokalise returns {len(key_data)} results, expected {len(chunk)}"
|
||||||
while input("Type YES to delete these keys: ") != "YES":
|
)
|
||||||
pass
|
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
|
return 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue