Bug #15160

tails-documentation broken for locales not translated in the Greeter

Added by anonym 2018-01-09 14:13:56 . Updated 2020-04-15 06:02:16 .

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

100%

Feature Branch:
Type of work:
Code
Blueprint:

Starter:
Affected tool:
Welcome Screen
Deliverable for:

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.


Subtasks


Related issues

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

History

#1 Updated by anonym 2018-01-09 15:23:57

#2 Updated by anonym 2018-01-22 09:59:06

  • % 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 <del><a class='issue tracker-1 status-3 priority-4 priority-default closed child' href='/code/issues/15160' title='tails-documentation broken for locales not translated in the Greeter'>Bug #15160</a></del> 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 2018-01-22 10:07:36

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 2018-01-22 10:16:36

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 Bug #13437 so I have to make a Greeter release any way so never mind.

#5 Updated by anonym 2018-01-23 19:52:54

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

#6 Updated by intrigeri 2018-01-24 08:59:15

Wasn’t this fixed in Tails 3.5?

#7 Updated by anonym 2018-01-24 09:06:37

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 2018-01-24 09:09:45

  • 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 2018-01-26 15:03:28

  • Status changed from Fix committed to Resolved

I’m told this is fixed in 3.5.

#10 Updated by intrigeri 2020-04-15 06:02:16

  • Affected tool changed from Greeter to Welcome Screen