Allow deep nested wording

This commit is contained in:
henryruhs
2025-04-19 19:43:35 +02:00
parent b6156f6073
commit 5ebefb6831
2 changed files with 7 additions and 10 deletions

View File

@@ -355,4 +355,3 @@ State = TypedDict('State',
}) })
StateSet : TypeAlias = Dict[AppContext, State] StateSet : TypeAlias = Dict[AppContext, State]
Wording : TypeAlias = Union[str, Dict[str, str]]

View File

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