Project

General

Profile

Bug #15160

tails-documentation broken for locales not translated in the Greeter

Added by anonym 9 months ago. Updated 9 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Internationalization
Target version:
Start date:
01/09/2018
Due date:
% Done:

100%

QA Check:
Pass
Feature Branch:
Type of work:
Code
Blueprint:
Starter:
Affected tool:
Greeter

Description

See e.g.:

$ LANG=fa_IR.utf-8 tails-documentation 
Traceback (most recent call last):
  File "/usr/local/bin/tails-documentation", line 102, in <module>
    helpwindow = DocumentationWindow(uri)
  File "/usr/lib/python3/dist-packages/tailsgreeter/gui.py", line 1112, in __init__
    TranslatableWindow.__init__(self, self)
  File "/usr/lib/python3/dist-packages/tailsgreeter/language.py", line 110, in __init__
    tailsgreeter.config.locales_path)       # NOQA: E128
  File "/usr/lib/python3.5/gettext.py", line 524, in translation
    raise OSError(ENOENT, 'No translation file found for domain', domain)
FileNotFoundError: [Errno 2] No translation file found for domain: 'tails-greeter'

(Note that we don't have any translations for the Greeter for fa*.)

The failing code is:

self.translation = gettext.translation(tailsgreeter.__appname__,
        tailsgreeter.config.locales_path)       # NOQA: E128

The fix is to add fallback=True.


Related issues

Blocks Tails - Feature #13245: Core work 2018Q1: Foundations Team Resolved 06/29/2017

History

#1 Updated by anonym 9 months ago

#2 Updated by anonym 9 months ago

  • % Done changed from 0 to 20

I'd like to ship this workaround (which doesn't require fixing Tails Greeter) in Tails 3.5:

--- a/config/chroot_local-includes/usr/local/bin/tails-documentation
+++ b/config/chroot_local-includes/usr/local/bin/tails-documentation
@@ -99,7 +99,15 @@ except StopIteration:
 if '..' in uri.split(os.sep):
     sys.exit('error: cannot escape from {}'.format(wiki_path))

-helpwindow = DocumentationWindow(uri)
+# Work around #15160 in the tails-greeter code base
+try:
+    helpwindow = DocumentationWindow(uri)
+except FileNotFoundError as e:
+    if "No translation file found for domain: 'tails-greeter'" in str(e):
+        os.environ['LANG'] = 'en_US.UTF-8'
+        helpwindow = DocumentationWindow(uri)
+    else:
+        raise(e)
 helpwindow.connect("delete-event", Gtk.main_quit)
 helpwindow.window.set_title(gettext.gettext('Tails documentation'))
 helpwindow.show()

If this workaround is implemented, I'll open a new ticket for the actual bug in Tails Greeter.

#3 Updated by intrigeri 9 months ago

My understanding is that the real fix (in the Greeter) is a one liner, so I don't understand why we would instead add a more complex workaround, file a new ticket, implement the real fix later, and track the fact we need to revert the workaround. Looks like lots of busy work to me just to postpone building a new Greter package, no?

#4 Updated by anonym 9 months ago

intrigeri wrote:

My understanding is that the real fix (in the Greeter) is a one liner, so I don't understand why we would instead add a more complex workaround, file a new ticket, implement the real fix later, and track the fact we need to revert the workaround. Looks like lots of busy work to me just to postpone building a new Greter package, no?

For me, making a new Greeter release takes more time and feels riskier (too many moving parts compared to simply committing code to Git) so this workaround didn't seem so crazy this time. However, now I realized that there is #13437 so I have to make a Greeter release any way so never mind.

#5 Updated by anonym 9 months ago

  • Target version changed from Tails_3.5 to Tails_3.6

#6 Updated by intrigeri 9 months ago

Wasn't this fixed in Tails 3.5?

#7 Updated by anonym 9 months ago

intrigeri wrote:

Wasn't this fixed in Tails 3.5?

Yes, I have no idea how I messed this one up.

#8 Updated by anonym 9 months ago

  • Status changed from In Progress to Fix committed
  • Assignee deleted (anonym)
  • Target version changed from Tails_3.6 to Tails_3.5
  • % Done changed from 20 to 100
  • QA Check set to Pass

#9 Updated by intrigeri 9 months ago

  • Status changed from Fix committed to Resolved

I'm told this is fixed in 3.5.

Also available in: Atom PDF