This repository has been archived on 2024-12-19. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-19/src/tr.py

27 lines
517 B
Python
Raw Permalink Normal View History

2019-10-22 16:24:52 +02:00
"""
2021-03-03 17:14:16 +01:00
Slim layer providing environment agnostic _translate()
2019-10-22 16:24:52 +02:00
"""
2024-05-26 03:18:08 +02:00
from unqstr import ustr
2024-05-23 06:28:40 +02:00
try:
2021-03-04 15:15:41 +01:00
import state
except ImportError:
from . import state
2019-10-22 16:24:52 +02:00
2021-03-03 17:14:16 +01:00
def _tr_dummy(context, text, disambiguation=None, n=None):
2020-01-15 11:47:26 +01:00
# pylint: disable=unused-argument
2021-03-03 17:14:16 +01:00
return text
2019-10-22 16:24:52 +02:00
2021-03-03 17:14:16 +01:00
if state.enableGUI and not state.curses:
try:
from qtpy import QtWidgets, QtCore
2021-03-03 17:14:16 +01:00
except ImportError:
_translate = _tr_dummy
else:
_translate = QtWidgets.QApplication.translate
2021-03-03 17:14:16 +01:00
else:
_translate = _tr_dummy