Allow deep nested wording

This commit is contained in:
henryruhs
2025-04-19 19:37:04 +02:00
parent ff645b9069
commit b6156f6073
2 changed files with 11 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
from typing import Any, Dict, Optional
from facefusion.types import Wording
WORDING : Dict[str, Any] =\
{
'conda_not_activated': 'Conda is not activated',
@@ -341,13 +343,13 @@ WORDING : Dict[str, Any] =\
}
def get(key: str) -> Optional[str]:
current = WORDING
def get(notation : str) -> Optional[Wording]:
wording = WORDING
for fragment in key.split('.'):
if fragment in current:
current = current.get(fragment)
for fragment in notation.split('.'):
if fragment in wording:
wording = wording.get(fragment)
else:
return None
return current
return wording