Bug 51755

Summary: i18n issues with systemd-logind's inhibit API
Product: systemd Reporter: David Zeuthen (not reading bugmail) <zeuthen>
Component: generalAssignee: systemd-bugs
Status: NEW --- QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: mclasen, piotrdrag
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description David Zeuthen (not reading bugmail) 2012-07-05 10:05:55 UTC
<davidz> mezcaler1: so udisks now allows you to clear data before formatting a disk (in various ways, write zeroes or using ATA secure erase). Bottom-line is that these operations easily take hours....

<davidz> mezcaler1: so the natural thing to do is to use http://www.freedesktop.org/wiki/Software/systemd/inhibit

<davidz> mezcaler1: however... I'm a system-level process... so the @who and @why parameters are suspect

<davidz> mezcaler1: in terms of i18n and l10n
<davidz> (geek-speak for grown ups)

<davidz> mezcaler1: so... I'd say that this API is kinda busted. I wonder how open you are to repairing it...

<davidz> mezcaler1: one way to repair it could be to impose a protocol on the strings... for example, could mandate that i18n:gettext-domain=udisks2;gettext-message=Hello%20World means: use gettext(3) from the client app with gettext-domain 'udisks2' and untranslated string "Hello World"

<davidz> mezcaler1: that's sorta how polkit does it and it can be made to work fine

<davidz> mezcaler1: notably you would be able to do this (almost) without breaking your API....
Comment 1 David Zeuthen (not reading bugmail) 2012-07-05 10:24:15 UTC
Kay also mentioned that this is a problem in multi-seat environments - for example, if you have two seats, one in en_US.UTF-8 and one in da_DK.UTF-8 and the latter is burning a CD you don't want to see a Danish message saying "Er ved at brænde en CD, vent lige et øjeblik fætter!" in the en_US session...
Comment 2 David Zeuthen (not reading bugmail) 2012-07-05 13:43:56 UTC
Just for the record, here's the udisks commit that adds support for systemd inhibitor locks

http://cgit.freedesktop.org/udisks/commit/?id=f698c0efd0d8b6f0c35284e028df3cbad4cdaf81
Comment 3 David Zeuthen (not reading bugmail) 2012-07-05 13:50:14 UTC
Btw, to support non-trivial and more useful inhibitor messages, the protocol should support strings like

 i18n:gettext-domain=udisks2;gettext-message=Formatting%20Device$(device);variable.device=/dev/sda1

The client will use gettext(3) to expand this to

 Formatting Device $(device)
 Formatterer enhed $(device)   # da_DK
 Formatierungseinrichtung $(device)

and then the client also replaces all instances of $(foo) with the value of variable.foo so we get

 Formatting Device /dev/sda1
 Formatterer enhed /dev/sda1   # da_DK
 Formatierungseinrichtung /dev/sda1

Again, this is pretty much how polkit works, see

 http://people.freedesktop.org/~david/gnome-disks-ata-secure-erase-confirmation.png
 http://people.freedesktop.org/~david/udisks2-translations-pt_BR.png

for an example.
Comment 4 Lennart Poettering 2012-07-06 06:32:41 UTC
Hmm, so we actually do maintain a system locale these days which we pass to all system services. I'd simply assume that system services use that locale for all their messages. 

This would of course mean that if the system locale is "fr_FR" and the session locale is "de_DE" and you try to reboot, then you'll see a french app blocking your reboot, but i'd claim that is OK, no?

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.