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:
parent
d2cebfad67
commit
9c0b467d68
19 changed files with 4 additions and 73 deletions
scripts
|
@ -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())
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue