MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / translateText

Function translateText

src/tr.py:19–39  ·  view source on GitHub ↗
(context, text, n = None)

Source from the content-addressed store, hash-verified

17 return translateText(context, text, n)
18
19def translateText(context, text, n = None):
20 try:
21 is_daemon = shared.thisapp.daemon
22 except AttributeError: # inside the plugin
23 is_daemon = False
24 if not is_daemon:
25 try:
26 from PyQt4 import QtCore, QtGui
27 except Exception as err:
28 print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon'
29 print 'Error message:', err
30 os._exit(0)
31 if n is None:
32 return QtGui.QApplication.translate(context, text)
33 else:
34 return QtGui.QApplication.translate(context, text, None, QtCore.QCoreApplication.CodecForTr, n)
35 else:
36 if '%' in text:
37 return translateClass(context, text.replace('%','',1))
38 else:
39 return text

Callers 2

connect_pluginFunction · 0.90
_translateFunction · 0.85

Calls 1

translateClassClass · 0.85

Tested by

no test coverage detected