Commit 3edb3f30 authored by intrigeri's avatar intrigeri

Electrum & Upgrader wrappers: fix internationalization support, by setting the...

Electrum & Upgrader wrappers: fix internationalization support, by setting the text domain correctly

Closes #17758

Fixes regressions introduced respectively in
e7005fb2 and
ca69ea2e, while porting these programs
to Python.
parent a8a9c6e5
......@@ -14,14 +14,14 @@ goodcrypto.com converted from bash to python and added basic tests.
<BLANKLINE>
"""
import gettext
import os
import sys
import subprocess
from gettext import gettext
import sh
os.environ['TEXTDOMAIN'] = 'tails'
translation = gettext.translation("tails", '/usr/share/locale', fallback=True)
_ = translation.gettext
HOME_DIR = os.environ['HOME']
CONF_DIR = os.path.join(HOME_DIR, '.electrum')
......@@ -59,14 +59,14 @@ def verify_start():
True
"""
disabled_text = gettext('Persistence is disabled for Electrum')
warning_text = gettext(
disabled_text = _('Persistence is disabled for Electrum')
warning_text = _(
"When you reboot Tails, all of Electrum's data will be lost, including your Bitcoin wallet.\nIt is strongly recommended to only run Electrum when its persistence feature is activated.")
question_text = gettext('Do you want to start Electrum anyway?')
question_text = _('Do you want to start Electrum anyway?')
dialog_msg = ('<b><big>{}</big></b>\n\n{}\n\n{}\n'.
format(disabled_text, warning_text, question_text))
launch_text = gettext('_Launch')
exit_text = gettext('_Exit')
launch_text = _('_Launch')
exit_text = _('_Exit')
# results 0 == True; 1 == False; 5 == Timeout
results = sh.zenity('--question', '--title', '', '--default-cancel',
......
......@@ -14,16 +14,18 @@ goodcrypto.com converted from bash to python and added basic tests.
<BLANKLINE>
"""
import gettext
import os
import sys
import time
from gettext import gettext
import sh
import psutil
os.environ['PATH'] = '/usr/local/bin:/usr/bin:/bin'
os.environ['TEXTDOMAIN'] = 'tails'
translation = gettext.translation("tails", '/usr/share/locale', fallback=True)
_ = translation.gettext
CMD = os.path.basename(sys.argv[0])
# While running iuk.git:features/frontend:
......@@ -32,7 +34,7 @@ CMD = os.path.basename(sys.argv[0])
MIN_AVAILABLE_MEMORY = (200 * 1024 * 1024) # In Bytes
RUN_AS_USER = 'tails-upgrade-frontend'
ERROR_MESSAGE = gettext('''<b>Not enough memory available to check for upgrades.</b>
ERROR_MESSAGE = _('''<b>Not enough memory available to check for upgrades.</b>
Make sure this system satisfies the requirements for running Tails.
See file:///usr/share/doc/tails/website/doc/about/requirements.en.html
......@@ -70,8 +72,8 @@ def main(*args):
def error(msg):
"""Show error and exit."""
cli_text = '{}: {} {}'.format(CMD, gettext('error:'), msg)
dialog_text = '''<b><big>{}</big></b>\n\n{}'''.format(gettext('Error'),
cli_text = '{}: {} {}'.format(CMD, _('error:'), msg)
dialog_text = '''<b><big>{}</big></b>\n\n{}'''.format(_('Error'),
msg)
print(cli_text, file=sys.stderr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment