Code::Blocks

User forums => Using Code::Blocks => Topic started by: gd_on on June 05, 2019, 07:51:28 pm

Title: Keyboard shortcut and C::B translation problem
Post by: gd_on 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

Title: Re: Keyboard shortcut and C::B translation problem
Post by: BlueHazzard 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...
Title: Re: Keyboard shortcut and C::B translation problem
Post by: sodev 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.
Title: Re: Keyboard shortcut and C::B translation problem
Post by: Pecan on June 06, 2019, 04:56:30 am
How can I set CodeBlocks to french to debug the problem ?
Title: Re: Keyboard shortcut and C::B translation problem
Post by: gd_on 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.
Title: Re: Keyboard shortcut and C::B translation problem
Post by: gd_on 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
Title: Re: Keyboard shortcut and C::B translation problem
Post by: Pecan 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.
 
Title: Re: Keyboard shortcut and C::B translation problem
Post by: gd_on 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
Title: Re: Keyboard shortcut and C::B translation problem
Post by: Pecan 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.
Title: Re: Keyboard shortcut and C::B translation problem
Post by: gd_on 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.
Title: Re: Keyboard shortcut and C::B translation problem
Post by: oBFusCATed on June 10, 2019, 08:00:23 pm
I plan to fix the conflicts soon. Any opinions about the changes in accelerators?
Title: Re: Keyboard shortcut and C::B translation problem
Post by: Pecan 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.
Title: Re: Keyboard shortcut and C::B translation problem
Post by: oBFusCATed 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.
Title: Re: Keyboard shortcut and C::B translation problem
Post by: Pecan 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

Title: Re: Keyboard shortcut and C::B translation problem
Post by: oBFusCATed 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.
Title: Re: Keyboard shortcut and C::B translation problem
Post by: Pecan on June 15, 2019, 01:32:04 am
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.

Ok, just get rid of them if nobody else objects. I've never used them myself.
It's also probable that nobody else uses them either, since there's been no complaints that they don't work.
Title: Re: Keyboard shortcut and C::B translation problem
Post by: gd_on on June 15, 2019, 02:41:40 pm
In menuutils.cpp, line 940 and 941 there is the same string. The extracting tool using xgettext see these two lines as only one, with twice the same string proposed for translation and separated by a \n. In this case, in a wxASSERT, I suppose that only the english string is needed, not the translated one. May be a better code could be :
Code: [Select]
    wxASSERT_MSG(data == NULL,
                wxT("wxMenuShortcutWalker does not use the 'data' parameter") // English only.
        );

and keep wxT (or _T) to be wx 2.8 compatible.

gd_on
Title: Re: Keyboard shortcut and C::B translation problem
Post by: Pecan on June 15, 2019, 08:41:24 pm
In menuutils.cpp, line 940 and 941 there is the same string. The extracting tool using xgettext see these two lines as only one, with twice the same string proposed for translation and separated by a \n. In this case, in a wxASSERT, I suppose that only the english string is needed, not the translated one. May be a better code could be :
Code: [Select]
    wxASSERT_MSG(data == NULL,
                wxT("wxMenuShortcutWalker does not use the 'data' parameter") // English only.
        );

and keep wxT (or _T) to be wx 2.8 compatible.

gd_on
Fixed head rev 11742