add fallback for tr if collection not open
When syncing media on close, the collection may be closed before media syncing completes. A better solution in the future will be decouple translations from the collection object.
This commit is contained in:
parent
44053f0715
commit
ca0df4929d
@ -34,7 +34,10 @@ def locale_dir() -> str:
|
||||
def tr(group: StringsGroup, key: str, **kwargs: Union[str, int, float]) -> str:
|
||||
"""Shortcut to access translations from the backend.
|
||||
(Currently) requires an open collection."""
|
||||
return aqt.mw.col.backend.translate(group, key, **kwargs)
|
||||
if aqt.mw.col:
|
||||
return aqt.mw.col.backend.translate(group, key, **kwargs)
|
||||
else:
|
||||
return key
|
||||
|
||||
|
||||
def openHelp(section):
|
||||
|
Loading…
Reference in New Issue
Block a user