1
0
Fork 0
mirror of https://github.com/Andre0512/hon.git synced 2025-05-21 18:35:10 -04:00

Remove invalid translation keys

This commit is contained in:
Andre Basche 2023-04-22 21:42:16 +02:00
parent d2cebfad67
commit 9c0b467d68
19 changed files with 4 additions and 73 deletions

View file

@ -1,5 +1,6 @@
import asyncio
import json
import re
from pathlib import Path
from pyhon import HonAPI
@ -146,13 +147,14 @@ def load_key(full_key, json_data, fallback=None):
def load_keys(full_key, json_data):
blacklist = ["description", "\n", "_recipe_", "_guided_"]
blacklist = ["description", "_recipe_", "_guided_"]
first, last = full_key.split(".")
data = json_data.get(first, {}).get(last, {})
return {
key.lower(): value
for key, value in data.items()
if not any(b in key.lower() for b in blacklist)
and re.findall("^[a-z0-9-_]+$", key.lower())
}