Author Topic: Keyboard shortcut and C::B translation problem  (Read 996 times)

Online gd_on

  • Regular
  • ***
  • Posts: 456
Keyboard shortcut and C::B translation problem
« on: June 05, 2019, 07:51:28 pm »
Some svn numbers ago, a change has been introduced in keyboard shortcuts.
In my configuration, I have 2 (new ?) duplicated shortcuts (Ctrl-P and Ctrl-Shift-.).
I can try to correct these setting if my C::B is configured in English. Settings/Editor.../KeybordShortcuts displays something where I can try to solve the conficts. (see image-1)
But, if my C::B interface is set to "French" the equivalent of this settings (Paramètres/Éditeur.../Raccourcis clavier) displays an empty window. (see image-2)
More, even if I correct the settings in the english C::B version, when I set C::B to French, the 1rst time it's OK, but if I save the configuration, the conflicts seems to appear again.
Not clear ...

What could be the problem ?

gd_on

Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 or Std 8.1 in C:\MinGW64

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2379
Re: Keyboard shortcut and C::B translation problem
« Reply #1 on: June 05, 2019, 10:44:59 pm »
Quote
In my configuration, I have 2 (new ?) duplicated shortcuts (Ctrl-P and Ctrl-Shift-.).
I had this error too. Two times exactly...

Offline sodev

  • Regular
  • ***
  • Posts: 295
Re: Keyboard shortcut and C::B translation problem
« Reply #2 on: June 05, 2019, 11:26:48 pm »
Yep, i had these two conflicts as well and simply fixed them by removing one of the bindings.

However i can observe a strange behavior whenever i select the configuration page for the keybindings, i can see how some sort of initial layout is created but then erased and some other layout is created. You can see the redraw only briefly, but this shouldn't happen, plus it doesn't happen on the other pages. So either there are done serious layout changes without freezing the gui or you have some errors in the layout like conflicting ID's or overlapping grid items, these sometimes cause these strange effects as well.

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2150
Re: Keyboard shortcut and C::B translation problem
« Reply #3 on: June 06, 2019, 04:56:30 am »
How can I set CodeBlocks to french to debug the problem ?

Online gd_on

  • Regular
  • ***
  • Posts: 456
Re: Keyboard shortcut and C::B translation problem
« Reply #4 on: June 06, 2019, 09:55:31 am »
The last available translation file is within http://forums.codeblocks.org/index.php/topic,1022.msg156981.html#msg156981.
Put simply the .mo file in "Your CB installation"\share\CodeBlocks\locale\fr_FR (for me it's C:\Program Files\CodeBlocks_wx312_64\share\CodeBlocks\locale\fr_FR). You'll probably have to create the subdir locale\fr_FR)
Start C::B. Then in Settings/Environment/View choose Language French which is normally now available.
Restart C::B. That's all. :D

gd_on

PS : with previous versions it worked. see the image. Note also that some strings are not translated : may be macros _T() or wxT() was used instead of _()
It was still OK in svn 11707.
« Last Edit: June 06, 2019, 10:12:08 am by gd_on »
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 or Std 8.1 in C:\MinGW64

Online gd_on

  • Regular
  • ***
  • Posts: 456
Re: Keyboard shortcut and C::B translation problem
« Reply #5 on: June 07, 2019, 11:46:47 am »
I have identified the problem. It's at line 195 in cbkeybinder.cpp.
The test : if (label == wxT("Keyboard shortcuts") ) is in default because the label title was created in cbKeyConfigPanel.h at line 30 with wxString GetTitle() const { return _("Keyboard shortcuts"); }.
So, if C::B is configurated in English, no problem, but in French, as the translated string exists, the comparison fails.
It works by simply changing the test by : if (label == _("Keyboard shortcuts") ).

I have also made a patch by changing several wxT() by _(). Not sure that all are useful or needed (especially those used for debugging tests).

Nevertheless, if I compare with previous version, and even in English version, it seems that items at the top of the window are missing (items concerning key profiles). May be normal when conversion to new format not done, but I'm not sure.

gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 or Std 8.1 in C:\MinGW64

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2150
Re: Keyboard shortcut and C::B translation problem
« Reply #6 on: June 07, 2019, 07:28:13 pm »
Thank you gd_on. I'll test and search for other _T() and _() misfits.

Keybinder 1.0 was written before the /p (/personality) feature were added.
That feature makes the multiple profiles within Keybinder obsolete.
To implement multiple keybinding profiles, the user only needs to use a different /personality and create a different set of key bindings.

Keybinder honors personalities by stowing the kebindings in ~Home or %appdata%\CodeBlocks in "<personality>.cbKeybinder02.conf" files.
 

Online gd_on

  • Regular
  • ***
  • Posts: 456
Re: Keyboard shortcut and C::B translation problem
« Reply #7 on: June 07, 2019, 08:16:54 pm »
OK.
There is probably the same kind of error at line 592/593 in clKeyboardManager.cpp : the chain "Configure editor" is translated and the test certainly fails.
Nevertheless I tried to change the "_T(" by "_(" on thoses lines, but it's not sufficient apparently :'(. Need further tests...

gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 or Std 8.1 in C:\MinGW64

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2150
Re: Keyboard shortcut and C::B translation problem
« Reply #8 on: June 08, 2019, 09:54:32 pm »
Fixed as far as I can determine. Head rev 11716
I did not allow translation of the "LOGIT" debugging messages since I need to read English while debugging in French.

Online gd_on

  • Regular
  • ***
  • Posts: 456
Re: Keyboard shortcut and C::B translation problem
« Reply #9 on: June 10, 2019, 05:19:20 pm »
OK. I was effectively not sure that strings used only for debugging need to be translated.
Nevertheless, there is probably still something somewhere which is not correct : when starting C::B in English, as mentioned previously, I obtain a message telling that there are 2 keyboards conflicts : OK, why not. But when I start C::B in French, even when the conflict has not been solved, I have no such messages. As told in my last message, I thought this could come from line 592/593 in clKeyboardManager.cpp (not included in my patch, sorry). And this test at line 592 is a little bit strange : is it really correct ? Could it be correct (or return true) when C::B is in English and not if C::B is in French (so return false) ?

gd_on

PS : It's now OK in French. The dialog was disabled (by a Don't annoy me again ...). It was not disabled in English... certainly because comparison is made directly on the strings and not on the ID of the dialog.
« Last Edit: June 11, 2019, 02:28:44 pm by gd_on »
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.2 (64 bits) compiled by TDM 4.9.2 or Std 8.1 in C:\MinGW64

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: Keyboard shortcut and C::B translation problem
« Reply #10 on: June 10, 2019, 08:00:23 pm »
I plan to fix the conflicts soon. Any opinions about the changes in accelerators?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2150
Re: Keyboard shortcut and C::B translation problem
« Reply #11 on: June 12, 2019, 08:31:41 pm »
I plan to fix the conflicts soon. Any opinions about the changes in accelerators?

Quote
Quote from: killerbot on June 10, 2019, 05:36:01 am
indeed, what is the official statement on this, what do we suggest.
I think Pecan, you are best suited on this topic ?
Yes, head actually contains those accelerator conflicts. It's not new, it's just that cbKeyBinder 2.0 now catches them.  The second accelerator of the conflicts will never be executed and the user never knew it.

I suggest that "File/New/Empty file" be changed to Ctrl-N .

"Show/Tooltip" is defined as Alt-Shift-Space; so I suggest that "Edit/Previous call tip" be changed to Alt-Shift-P and "Edit/Next call tip" be changed to Alt-Shift-N for consistency in that area of the menus.

I suggest that "Search/Open Include file" be changed to Ctrl-Shift-O .

Except for Ctrl-N, the above suggested accelerlators are not currently being used.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: Keyboard shortcut and C::B translation problem
« Reply #12 on: June 12, 2019, 08:42:52 pm »
I'm not sure I get a conflict on New file.

Btw: there is this report https://sourceforge.net/p/codeblocks/tickets/840/ and I also had some error messages about bindings failing to load/save.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2150
Re: Keyboard shortcut and C::B translation problem
« Reply #13 on: June 14, 2019, 05:16:29 pm »
I'm not sure I get a conflict on New file.

Btw: there is this report https://sourceforge.net/p/codeblocks/tickets/840/ and I also had some error messages about bindings failing to load/save.

Sorry, my error, I was using a modified personality.

So, I suggest that "Edit/Previous Call tip" be changed to use Ctrl-Shift-P .
And that "Search/Open include file: be changed to use Ctrl-Shift-O


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11825
    • Travis build status
Re: Keyboard shortcut and C::B translation problem
« Reply #14 on: June 14, 2019, 10:09:57 pm »
I don't like that Next call tip will be ctrl-n and prev call tip would be ctrl-shift-p. I'd rather change both. Or just remove the shortcuts. I didn't know these existed, I'm using up and down arrows, they work just fine, not sure what is the benefit of using the shortcuts.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]