Yesterday, Ovate left a comment to my post What is my locale? Well, which locale do you mean? entitled Chinese locales and Dvorak. Not entirely ontopic and probably better for the suggestion box, but I am not going to judge too harshly. :-)

Ovate said:

Hi there, I type with Dvorak for the right hand. However the Chinese locale input method MS-Pinyin 98 that I need to use to type Chinese relies on the Qwerty layout. I need to be able to change this to the right hand Dvorak layout within the Chinese locale (I actually need to be able to do the same for Japanese)

I have downloaded a copy of MKLC (Microsoft Keyboard layout creator). However when I go to File\ load existing keyboard, it only displays Chinese (PRC) US keyboard option. This is not even a Chinese input method. I already have all the Chinese locals installed on my computer. Would anyone have any idea why the other Chinese input methods do not display or how I can locate them so that I can alter the keys to a Dvorak right hand layout. If I'm going about this totally the wrong way, please excuse the ignorance :-)

This is unfortunately an intentional filtering that is done in the Microsoft Keyboard Layout Creator.

Back when I first wrote MSKLC, the "Load Existing Keyboard Layout" functionality was intended to support every layout under the HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layouts subkey, but there were two problems with this:

  • Keyboards installed by third party tools like Keyman often did not use the keyboarding APIs to report results, so the methods MSKLC would use to interrogate the layout were ineffectual;
  • Keyboards attached to IMEs were basically pointers to other keyboards, and thus modifying them would never return the results you would expect.

Entries like the Chinese (PRC) US layout actually exist if you go to the Add Input Language dialog provided by the Text Services Framework team, as you can see below.

And those entries are the only ones that MSKLC can actually get good information out of using the standard keyboarding APIs. If you look at the entries in the registry for the IMEs, they look like this:

Now obviously the "Layout File" is the keyboard DLL that is used. But the rules for the IME-attached DLLs are different. For example the Japanese file actually forwards to different DLLs depending on other system settings that are not documented, and the actual code in the IME has all different kinds of rules for reading the keyboard input, only some of which is Virtual Key-based and none of which is easily discerned with the keyboarding APIs. So in the end I hd to filter out those IME entries since I was unable to do anything with them.

Now in some cases, you can actually modify that Layout File setting to actually get the keyboard you want attached to the IME. In Ovate's case, the United States-Dvorak for right hand info can be found in the 00040409 entry:

So the layout file is KBDUSR.DLL. It may or may not work to change this value in the IMEs, mainly depending on what the IMEs themselves do to use the layout. But MSKLC could not really get in the business of modifying existing system configuration settings (for obvious reasons), since that is a sure recipe for disaster, even if it would always work.

So if you choose to make those kinds of changes in the registry, you are on your own. Be sure to save somewhere what the original settings were, by right-clicking on the registry key and choosing to export it to an .REG file:

so you can restore the old settings and recover from anything that does not work properly. If you do not and you mess up the IME beyond all repair, then be sure to tell the support person on the phone what you did, and don't get mad if they suggest that you reinstall Windows. :-)

 

This post brought to you by "" (U+1e30, a.k.a. LATIN CAPITAL LETTER K WITH ACUTE)