Reworked translate function to be more accommodating

This commit is contained in:
DivineOmega 2013-06-21 13:55:09 +01:00
parent e7fffe7ecd
commit c2cfff2a2e

View File

@ -4058,27 +4058,18 @@ if __name__ == "__main__":
print 'Error message:', err print 'Error message:', err
os._exit(0) os._exit(0)
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text): # A non-QT version of _translate is defined below.
return QtGui.QApplication.translate(context, text)
except Exception as err:
print 'Error:', err
import bitmessageqt import bitmessageqt
bitmessageqt.run() bitmessageqt.run()
else: else:
def _translate(context, text): # A QT version of _translate is defined above.
if '%' in text:
return translateClass(context, text.replace('%','',1))
else:
return text
shared.printLock.acquire() shared.printLock.acquire()
print 'Running as a daemon. You can use Ctrl+C to exit.' print 'Running as a daemon. You can use Ctrl+C to exit.'
shared.printLock.release() shared.printLock.release()
while True: while True:
time.sleep(20) time.sleep(20)
def _translate(context, text):
return translateText(context, text)
def translateText(context, text): def translateText(context, text):
if not shared.safeConfigGetBoolean('bitmessagesettings', 'daemon'): if not shared.safeConfigGetBoolean('bitmessagesettings', 'daemon'):
try: try: