(key: str, params=None)
| 96 | |
| 97 | |
| 98 | def t(key: str, params=None) -> str: |
| 99 | key = str(key) |
| 100 | params = dict(params or {}) |
| 101 | value = _deep_get(_load_catalog(_current_language), key) |
| 102 | if value is None and _current_language != DEFAULT_LANGUAGE: |
| 103 | value = _deep_get(_load_catalog(DEFAULT_LANGUAGE), key) |
| 104 | if value is None: |
| 105 | return key |
| 106 | if not isinstance(value, str): |
| 107 | return str(value) |
| 108 | try: |
| 109 | return value.format(**params) |
| 110 | except Exception: |
| 111 | return value |
| 112 | |
| 113 | |
| 114 | class LocalizationBridge(QObject): |
no test coverage detected