Bug Hunting Session
Bug 50415 - Shortcut names are not localized on Linux
Summary: Shortcut names are not localized on Linux
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Localization (show other bugs)
Version:
(earliest affected)
3.5.3 release
Hardware: All Linux (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:3.7.0 target:3.5.5 target:3.6....
Keywords: regression
Depends on:
Blocks: 34638 mab3.5
  Show dependency treegraph
 
Reported: 2012-05-28 01:17 UTC by Petr Mladek
Modified: 2016-05-20 04:31 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenthot showing the problem (184.13 KB, image/png)
2012-05-28 01:17 UTC, Petr Mladek
Details
Screenshot for the Italian UI (76.18 KB, image/png)
2012-05-28 12:48 UTC, Valter Mura
Details
Output of SalDisplay::GetKeyboardName (1.16 KB, text/x-csrc)
2012-05-30 09:49 UTC, Thomas Arnhold
Details
Screenshots with German UI and German keyboard on Linux. It shows the differences between 3.5.3 and 3.5.4. (54.78 KB, image/png)
2012-05-31 09:49 UTC, Petr Mladek
Details
Gedit screenshot in German UI (48.28 KB, image/png)
2012-06-01 08:05 UTC, Petr Mladek
Details
Proposed patch (3.71 KB, patch)
2012-06-04 09:01 UTC, Thomas Arnhold
Details
Proposed patch (16.88 KB, patch)
2012-06-04 09:04 UTC, Thomas Arnhold
Details
Proposed patch (16.61 KB, patch)
2012-06-04 09:23 UTC, Thomas Arnhold
Details
Estonian translations (1.72 KB, patch)
2012-07-02 03:45 UTC, Mihkel Tõnnov
Details
Fix for a typo in Norwegian translations (362 bytes, patch)
2012-07-02 03:49 UTC, Mihkel Tõnnov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Mladek 2012-05-28 01:17:18 UTC
Created attachment 62153 [details]
Screenthot showing the problem

The strings describing menu shortcuts are not longer localized in LO-3.5.4 on Linux.

Steps to reproduce:

1. run libreoffice in German locales, for example:
   LANG=de_DE.UTF-8 libreoffice3.6
2. Open the menu "Datei"  (File)
3. See the shortcut for "Speichern unter" (Save as)

Result: "Control+Shift+S"

Expected result: "Ctrl+Maiusc+S"
 
It is a regression in 3.5.4. It worked well in LO-.3.5.3.

It is most likely caused by http://cgit.freedesktop.org/libreoffice/core/commit/vcl?h=libreoffice-3-5-4&id=8d9e2d9a211f710e91ac7c607fea25895282d245
Comment 1 Petr Mladek 2012-05-28 01:19:10 UTC
Bjorn, Arnold, could we revert the commit or somehow fix it?
Comment 2 Valter Mura 2012-05-28 12:48:07 UTC
Created attachment 62178 [details]
Screenshot for the Italian UI
Comment 3 Björn Michaelsen 2012-05-29 02:22:25 UTC
I have no instant idea for a fix.

Well, since the commit en passant fixed this crasher (thanks to Caolan for noting):

 https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/818761

I wonder which is more valuable: localized shortcuts or a crasher.

IMHO keeping the crasher out, which might cause data-loss, even if it is rare, should have priority.

Of course, for 3.6 we need a sane fix anyway.
Comment 4 Thomas Arnhold 2012-05-30 09:48:11 UTC
Petr, with LANG=de_DE.UTF-8 libreoffice3.6 you can't reproduce this bug. Try this with libreoffice 3.5.3 and it will fail too. The translation of those keys was dependent on the keyboard layout, not the locale setting. As Bjoern mentioned in his commit:

lp#818761: removing the problematic call to GetKeyboardName() as
getKeysymReplacementName only provides the name of the key named
as given by the l10n of the _keyboard_ (not the locale) e.g. a
german keyboard would name "Ctrl" instead as "Strg". Assuming
this change to be safe as getKeysymReplacementName falls back to
English names anyway.

The replacement table was called with ::vcl_sal::getKeysymReplacementName.

On master I deleted the table: http://cgit.freedesktop.org/libreoffice/core/commit/?id=2233aa52da14ec85331aee1163b885fe9a9fb507

The problem itself lies at SalDisplay::GetKeyboardName:

// try X keyboard extension
if( (pXkbDesc = XkbGetKeyboard( GetDisplay(), XkbAllComponentsMask, XkbUseCoreKbd )) )
{
const char* pAtom = NULL;
if( pXkbDesc->names->groups[0] )
{
    pAtom = XGetAtomName( GetDisplay(), pXkbDesc->names->groups[0] );
    m_aKeyboardName = pAtom;
    XFree( (void*)pAtom );
}

--> The keyboard name was extracted from the current keyboard layout. So you have to change your keyboard layout to get a translation of keys with libo 3.5.3.
Comment 5 Thomas Arnhold 2012-05-30 09:49:15 UTC
Created attachment 62294 [details]
Output of SalDisplay::GetKeyboardName

Use: gcc -L /usr/lib/X11/ -lX11 -o keysym keysym.c
Comment 6 Petr Mladek 2012-05-31 09:49:38 UTC
Created attachment 62341 [details]
Screenshots with German UI and German keyboard on Linux. It shows the differences between 3.5.3 and 3.5.4.

I am sorry, I am probably dumb. Please look at the attached screenshot and see the differences between LibreOffice-3.5.3 and 3.5.4 on Linux.

I have started the application the following way:

export LANG=de_DE.UTF-8
setxkbmap de
libreoffice3.6

I guess that 3.5.4 is wrong. I do not have a real German keyboard around but I guess that the physical key has the label "Strg" and not "Ctrl". So, German users might have troubles to find the "Ctrl" key by their fingers.

Or did I miss something? How should I do the right test?
Comment 7 Björn Michaelsen 2012-06-01 04:17:40 UTC
possibly related: https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1007320
Comment 8 Björn Michaelsen 2012-06-01 04:23:55 UTC
IMHO, we still should not ask the keyboard, but just use the UI language for the shortcuts. Someone using a US layout with a german UI should not be troubled to map Ctrl to Strg (as with doing such things, he is basically asking for it).
Comment 9 Thomas Arnhold 2012-06-01 04:46:21 UTC
Petr: Right, you have to use setxkbmap to reproduce it, I could have described this easier. Sorry.
Comment 10 Caolán McNamara 2012-06-01 06:09:31 UTC
what-does-gnome-do ?
Comment 11 Petr Mladek 2012-06-01 08:05:39 UTC
Created attachment 62378 [details]
Gedit screenshot in German UI

It seems that GNOME applications localize the shortcuts together with the UI. They ignore the selected keyboard.

See the screenshot of gedit. It is taken with LANG=de_DE.UTF-8. It does not depend on the keyboard. gedit shows "Strg" with both "de" and "us" keyboards.
Comment 12 Petr Mladek 2012-06-01 08:10:17 UTC
Thomas, please read my comment #6. I have used setxkbmap and it did not help. LO shows "Ctrl" instead of "Strg" even with "de" keyboard.

Thomas, are you able to see "Strg" with LO-3.5.4 on Linux?
If yes, what exeact steps are you using?
Comment 13 Thomas Arnhold 2012-06-01 08:20:50 UTC
Petr: Hrm. I have to use setxkbmap with 3.5.3 to change the locale of the keybindings. With 3.5.4 setxkbmap doesn't have any effect.

3.5.3:
setxkbmap de
LANG=de_DE.UTF-8 libreoffice
-> works

3.5.4:
setxkbmap de
LANG=de_DE.UTF-8 libreoffice
-> doesn't work

But setxkbmap is mandatory to change it with 3.5.3 and earlier. With 3.5.4 there is no possibility to change it at all. This is all I wanted to say.
Comment 14 Petr Mladek 2012-06-01 09:13:25 UTC
IMHO, people using German UI usually also use German keyboard. So, they are used to having the shortcuts translated. They might be confused by the new behavior.

Is there any chance to fix it, so it shows translated shortcuts in translated UI again?

I do not mind if you put back the keyboard detection or if you avoid dependency on the keyboard.


Side note: I am not sure how serious this bug is. Developers and old computer users do not mind because they are used to these translation problems. Though, normal and modern users might get annoyed if it is translated in many other application these days. We want to be modern, ...  Note that it is pretty visible. It is in the main menus...
Comment 15 Björn Michaelsen 2012-06-01 09:19:22 UTC
As to bug importance: At least on Debian/Ubuntu it pales compared to: https://bugs.freedesktop.org/show_bug.cgi?id=47798 which is also an l10n issue (which might be Debian/Ubuntu only though).
Comment 16 Thomas Arnhold 2012-06-01 10:23:49 UTC
IMHO we could fix this by using ::vcl_sal::getKeysymReplacementName() again and make it depend on the LANG setting, not by keyboard detection. This would be the most consistent solution in the first place.
Comment 17 Petr Mladek 2012-06-04 02:47:16 UTC
(In reply to comment #16)
> IMHO we could fix this by using ::vcl_sal::getKeysymReplacementName() again and
> make it depend on the LANG setting, not by keyboard detection. This would be
> the most consistent solution in the first place.

Sounds good to me. It will behave the same way like GNOME applications.
Could you please cook up a patch for this?
Comment 18 Thomas Arnhold 2012-06-04 09:01:30 UTC
Created attachment 62521 [details]
Proposed patch
Comment 19 Thomas Arnhold 2012-06-04 09:04:23 UTC
Created attachment 62522 [details]
Proposed patch
Comment 20 Thomas Arnhold 2012-06-04 09:23:40 UTC
Created attachment 62523 [details]
Proposed patch

* remove some unused solaris definitions
* use OUString instead of String
Comment 21 Not Assigned 2012-06-05 08:49:26 UTC
Thomas Arnhold committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=76dcd76509ec0b2078a95f282e09696a8e91cbb0

fdo#50415 and fdo#34638 Fix Shortcut names are not localized on Linux
Comment 22 Mihkel Tõnnov 2012-06-05 09:28:09 UTC
1) Why "target:3.7.0" and not 3.6.0 and 3.5.5?

2) Reading the patch, I noticed translations for only some of the languages LibO supports. Does that mean that all others use the English fallbacks, even if some of the key names should always be translated (e.g. "Space", "Left", "Right", etc.)?
Comment 23 Björn Michaelsen 2012-06-05 11:01:22 UTC
Mikhel: 1) Because -3-6 was branched today 2) because this fixed the regression, but does not more that earlier versions did.

For the issues you note: Patches welcome!
Comment 24 Björn Michaelsen 2012-06-05 11:08:07 UTC
Also: For backporting the fix to -3-5 (which would make the friendly bot add "target:3.5.5" right now) the patch needs at least a signoff. Yours on the developer mailing list is welcome.
Comment 25 Thomas Arnhold 2012-06-05 12:23:28 UTC
Mikhel: This is just the behavior like it was before 3.5.4. This is not optimal, but at least it's translated. Feel free to add more translations, if you need them :)

Björn: I'll adjust the patch for 3.5 and 3.6 and post it on the dev list.
Comment 26 Not Assigned 2012-06-06 04:15:35 UTC
Thomas Arnhold committed a patch related to this issue.
It has been pushed to "libreoffice-3-5":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=309a5aad968f7c12d8317c91d44c3e1122c7fe78&g=libreoffice-3-5

fdo#50415 and fdo#34638 Fix Shortcut names are not localized on Linux


It will be available in LibreOffice 3.5.5.
Comment 27 Not Assigned 2012-06-06 04:16:27 UTC
Thomas Arnhold committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5548b62a3c22cc3338d09e22f1c663a91981deef&g=libreoffice-3-6

fdo#50415 and fdo#34638 Fix Shortcut names are not localized on Linux


It will be available in LibreOffice 3.6.
Comment 28 Mihkel Tõnnov 2012-07-02 03:45:44 UTC
Created attachment 63695 [details]
Estonian translations

Added patch (works for 3.6 and master) to add Estonian translations.
Comment 29 Mihkel Tõnnov 2012-07-02 03:49:43 UTC
Created attachment 63696 [details]
Fix for a typo in Norwegian translations

Found a typo in Norwegian translation while working on the Estonian one. (Patch works for 3.6 and master.)

It would be nice if someone with necessary power could commit these two patches to 3.6 and master.
Comment 30 Björn Michaelsen 2012-07-02 04:18:45 UTC
quickly reopening so the patches do not get lost.
Comment 31 Not Assigned 2012-07-02 07:01:44 UTC
Mihkel Tõnnov committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=cedec66271037acbd643a00cc2af492c62b09682

Estonian translation for keyboard shortcuts (fdo#50415)
Comment 32 Not Assigned 2012-07-02 07:02:12 UTC
Mihkel Tõnnov committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3af10435bf2ba53d77eadab61692918eb536258f

typo in Norwegian translations of keyboard shortcuts (fdo#50415)
Comment 33 Not Assigned 2012-07-02 07:02:46 UTC
Mihkel Tõnnov committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=be7d91f5bf174de25df167791e9204ee9f9e365b&g=libreoffice-3-6

Estonian translation for keyboard shortcuts (fdo#50415)


It will be available in LibreOffice 3.6.
Comment 34 Not Assigned 2012-07-02 07:03:12 UTC
Mihkel Tõnnov committed a patch related to this issue.
It has been pushed to "libreoffice-3-6":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=8a6a068326dbebe3e29a3f22794ef84a09266453&g=libreoffice-3-6

typo in Norwegian translations of keyboard shortcuts (fdo#50415)


It will be available in LibreOffice 3.6.
Comment 35 Petr Mladek 2012-07-02 07:05:22 UTC
Both patches looked fine => pushed into master and 3-6 branch => let's close the bug again.

Thanks a lot for the patches. Just a small hint. It would be easier if you provided the patches with commit messages. You just commit locally and generate the patches using "git format-patch" :-)
Comment 36 Mihkel Tõnnov 2012-07-02 07:11:01 UTC
I'll try to remember that :)
Thanks for committing them!
Comment 37 Rainer Bielefeld Retired 2012-08-03 09:11:00 UTC
We need exact and correct target information for automated lists in Wiki and LibO Web Site.
Comment 38 Not Assigned 2013-01-04 16:05:46 UTC
Jesus Corrius committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5dcb323352b175bfdcd994c4941433df98ffd4dd

fdo#50415: Add Catalan translations of keyboard shortcuts



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 39 Not Assigned 2013-01-04 16:11:45 UTC
Jesus Corrius committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d4f4aff77ad99083baf4150be358ec72c5918a07&h=libreoffice-4-0

fdo#50415: Add Catalan translations of keyboard shortcuts


It will be available in LibreOffice 4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 40 Not Assigned 2013-01-22 16:44:08 UTC
Aurimas Fišeras committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=67eaa6c9f1cb599c158df008ccb75afb60bb8bef

Add Lithuanian translations of keyboard shortcuts (related to fdo#50415)



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 41 Jean-Baptiste Faure 2016-05-20 04:31:56 UTC
Added regression keyword from description.