Allow deep nested wording
This commit is contained in:
@@ -355,4 +355,3 @@ State = TypedDict('State',
|
|||||||
})
|
})
|
||||||
StateSet : TypeAlias = Dict[AppContext, State]
|
StateSet : TypeAlias = Dict[AppContext, State]
|
||||||
|
|
||||||
Wording : TypeAlias = Union[str, Dict[str, str]]
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user