Wish: Oportunity to localize accelerator keys.

forum.wishlist (2000-2005) & forum.gupta.wishlist (2005-2010)
NewsgroupServer
Robot
Robot
Posts: 118939
Joined: 24 Feb 2017, 12:00
Location: World wide

Wish: Oportunity to localize accelerator keys.

Post by NewsgroupServer » 16 Oct 2007, 15:20

 Posted by:  Sören Gellendin 

english -> deutsch

Ctrl -> Strg
Shift -> Umschalt
Enter -> Eingabe
.
.
etc.

Uwe van der Horst
Site Admin
Site Admin
Germany
Posts: 59
Joined: 05 Mar 2017, 14:21
Location: Wetter (Ruhr), Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by Uwe van der Horst » 30 May 2017, 07:42

After nearly 10 years: Has anyone found a trick how to do this?
Best regards,
Uwe van der Horst
Advo-web GmbH

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 123
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Wish: Oportunity to localize accelerator keys.

Post by Jeff Luther » 30 May 2017, 19:39

Uwe -- Let me be sure I understand what you want: You wan to change a menu accelerator prompt, like "Ctrl+F" to "Strg+F". Is this what you want?

If so, I thought I had that 'trick' you are asking for: Use the CDK to modify a menu item's 'Keyboard Accelerator' string during runtime. I kluge'd down my CDKTutorial sample but it's not working:
>> The first PB in the test case returns the correct value for a named menu item's Ctrl+F accelerator in the form. I display various parts of the menu code, including the current accelerator.

>> The CDK has a GetSet pair of functions which generally work fine, but in the case of the accelerator the CDK's SetAttribute() call is failing. I don't know why and the only guess I can make is perhaps TD does a lookup (???) to check the list of valid keybd. accelerators and for my U.S. PC "Strg+F" isn't valid? A real guess as to why this code doesn't work. :shock:

Maybe on your German machine it will work? At least, some code is there for your own testing. Turn on animate before clicking the Change PB to see the code. Let us know if you figure out what is wrong.

The enclosed test case is written in TD v5.2, same as original CDK tutorial app.
You do not have the required permissions to view the files attached to this post.
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

H3PO4
Germany
Posts: 30
Joined: 10 Mar 2017, 07:53
Location: Rohlstorf, Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by H3PO4 » 31 May 2017, 07:14

Hi Jeff,

on my german machine the sample also fails.

We are changing the accelerator text strings by replacing them with

Set sText = VisMenuGetText(hWndForm,hMenu,0)
Set sText = VisStrSubstitute( sText, "Ctrl+", "Strg+" )
Call VisMenuSetText( hWndForm, hMenu, 0, sText )
(very simplified example...) ;-)

Best regards
Henning

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 123
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Wish: Oportunity to localize accelerator keys.

Post by Jeff Luther » 31 May 2017, 20:00

So a menu name of yours might look something like this?

Code: Select all

Menu Item: Menu &One	Ctrl+O
That is, the name contains a "Ctrl+O" tabbed to the right and your VisMenu & VisStr code would change the name/title of the menu to this?

Code: Select all

Menu Item: Menu &One	Strg+O
If so, then clicking Ctrl+O would not pop up that menu -- unless I am missing something -- because Ctrl+O is part of the name/title and not the keyboard accelerator.
Kindly clarify, if you would. Maybe I am just missing something. :?

BTW, I played with this idea a bit and for anyone who wants code to at least change the menu titles like Henning mentions, here is code that will, for example, change the submenu names' subtext "Ctrl" to "Strg" under a popup menu:

Code: Select all

Set hMenu = VisMenuGetHandle( hWndForm )
Set hPopupMenu = VisMenuGetPopupHandle (hMenu, 0 )
Set nMenu = 0
Set nMenusTotal = VisMenuGetCount( hPopupMenu )
While nMenu < nMenusTotal
	Set sText = VisMenuGetText( hWndForm, hPopupMenu, nMenu )
	Set sText = VisStrSubstitute( sText, "Ctrl+", "Strg+" )
	Call VisMenuSetText( hWndForm, hPopupMenu, nMenu, sText )
	!
	Set nMenu = nMenu+1
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

H3PO4
Germany
Posts: 30
Joined: 10 Mar 2017, 07:53
Location: Rohlstorf, Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by H3PO4 » 01 Jun 2017, 04:43

Jeff,

the change would not make sense, if the accelerator does not work afterwards.

But changing only the menutext does not make the accelerator invalid.

See your sample below...

Best regards
Henning
You do not have the required permissions to view the files attached to this post.

Uwe van der Horst
Site Admin
Site Admin
Germany
Posts: 59
Joined: 05 Mar 2017, 14:21
Location: Wetter (Ruhr), Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by Uwe van der Horst » 01 Jun 2017, 14:53

Hi Jeff,
hi Henning,
Jeff Luther wrote:
30 May 2017, 19:39
Let me be sure I understand what you want: You wan to change a menu accelerator prompt, like "Ctrl+F" to "Strg+F". Is this what you want?
Yes, this is exactly what I want for the menu of my MDI-Window.
H3PO4 wrote:
01 Jun 2017, 04:43
But changing only the menutext does not make the accelerator invalid.
You are right, changing the menu text does not effect the accelerator.
H3PO4 wrote:
31 May 2017, 07:14
We are changing the accelerator text strings by replacing them with

Set sText = VisMenuGetText(hWndForm,hMenu,0)
Set sText = VisStrSubstitute( sText, "Ctrl+", "Strg+" )
Call VisMenuSetText( hWndForm, hMenu, 0, sText )
Yes, this works. Now my menu has "German" keyboard shortcuts and the accelerators are still valid.
BUT: I have to use recursion to translate all my menu items one by one - and this takes many time on my (local!) testsystem - about 5 seconds for my main menu.
As speed is much more important I will make no changes here. But thank you for looking into this.
AcceleratorTranslation.png
You do not have the required permissions to view the files attached to this post.
Best regards,
Uwe van der Horst
Advo-web GmbH

H3PO4
Germany
Posts: 30
Joined: 10 Mar 2017, 07:53
Location: Rohlstorf, Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by H3PO4 » 02 Jun 2017, 08:03

Hello Uwe,

5 seconds - that is a long time for changing text in menus.

We use it as a workaround, our menus may not have as much entries as yours.

The 'real' solution would be that OpenText uses the 'local' values like Microsoft does...

Best wishes for the Pfingsten-Holidays
Henning

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 52
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by thomas.uttendorfer » 02 Jun 2017, 15:02

Hi folks,
we translate our large MDI-Menu using the menu functions from user32.dll (see list below).
With those we translate hundreds of menu item texts from german to english and it takes a small fraction of a second.
Maybe have a try with them.
Regards Thomas
  • GetMenu
  • GetSubMenu
  • InsertMenuA
  • DeleteMenu
  • RemoveMenu
  • AppendMenuA
  • GetMenuItemCount
  • GetMenuStringA
  • GetMenuState
  • GetMenuItemID
  • ModifyMenuA
  • EnableMenuItem
Thomas Uttendorfer
[ frevel & fey ] Software-System GmbH
https://thomasuttendorfer.wordpress.com/

H3PO4
Germany
Posts: 30
Joined: 10 Mar 2017, 07:53
Location: Rohlstorf, Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by H3PO4 » 07 Jun 2017, 14:29

Hi Uwe,

attached is a very small sample, that shows, how to use the ModifyMenu-function from the windows sdk.

I took an example from the great Team Developer Sample Vault (thanks Dave) and played around.

On my machine the translation of 19 menus with submenus lastet not longer than 2 hundreds of a second...

HTH
Henning
You do not have the required permissions to view the files attached to this post.

Jeff Luther
Site Admin
Site Admin
United States of America
Posts: 123
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California

Re: Wish: Oportunity to localize accelerator keys.

Post by Jeff Luther » 07 Jun 2017, 16:42

Thanks for the sample, Henning.

NOTE TO EVERYONE -- the attached text file was saved in TD v6.2 and I found it very interesting that when I opened and tried to compile it in v6.3 that all the menu entries failed with 'duplicate' errors for the menu declarations. Very odd!!!

I back-converted it to v5.2 using my convert utility: viewtopic.php?f=27&t=104
and it now can open and run with TD 5.2, 6.x or 7.0.
You do not have the required permissions to view the files attached to this post.
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

EwaldP
Austria
Posts: 57
Joined: 07 Mar 2017, 08:00
Location: Austria

Re: Wish: Oportunity to localize accelerator keys.

Post by EwaldP » 08 Jun 2017, 06:39

I also noticed, but I deleted them by hand because I have no 6.2 installed.
Ewald P. Palmetshofer
EDV-Hausleitner GmbH
4020 Linz
www.edv-hausleitner.at

Uwe van der Horst
Site Admin
Site Admin
Germany
Posts: 59
Joined: 05 Mar 2017, 14:21
Location: Wetter (Ruhr), Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by Uwe van der Horst » 08 Jun 2017, 12:42

@Henning: Your sample works as fast as the lightning. Thank you very much for your help.
Best regards,
Uwe van der Horst
Advo-web GmbH

H3PO4
Germany
Posts: 30
Joined: 10 Mar 2017, 07:53
Location: Rohlstorf, Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by H3PO4 » 08 Jun 2017, 13:00

:)
You're welcome!

Henning

H3PO4
Germany
Posts: 30
Joined: 10 Mar 2017, 07:53
Location: Rohlstorf, Germany

Re: Wish: Oportunity to localize accelerator keys.

Post by H3PO4 » 09 Jun 2017, 07:30

Hi all,

funny: The loop forward through the menu entries (0-n) 'hides' the first entry in a menu. The entry can be accessed via Shortcut.
Doing the same with the loop backward all menu entries are shown.

Some would declare this as a feature ;) ...

Best regards
Henning

Return to “gupta.wishlist”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests