Getting the language of an LCID-less keyboard

by Michael S. Kaplan, published on 2007/05/22 17:09 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/05/22/2800224.aspx


Tom, a reasonably senior developer, asks (product names removed for no particular reason):

Can users of publicly available keyboard layout creator make a layout that is not tied to a specific LCID?  In other words, could the keyboard layout language be a custom culture with no defined LCID?  If so, how can applications detect the keyboard language?

... [And if so] how does a Win32 app know the language of the keyboard?  󰀀󰀁󰀂󰀃󰀄󰀅 generally relies on Win32 APIs to get the current keyboard's LCID, and to enumerate the LCIDs of the user's list of installed keyboards.  What would you suggest 󰀀󰀁󰀂󰀃󰀄󰀅 do to surface the benefit of these LCID-less keyboards?

Of course one of the principal features of MSKLC 1.4 is support of custom locales on Vista, so clearly it is possible to create a keyboard layout that is not tied to a specific language LCID.

Though the desire to know something about the language is a valid one, in any case. And there is a way to get it. :-)

In the registry, in a subkey under that key I mentioned in Maybe it was registry rumination and How can be changed the keyboard layout name label?, a special registry value was added to go with any custom language that came from a custom locale, the value name of which is Layout Locale Name and it will contain the LOCALE_SNAME value of the locale that was selected by the keyboard author for the association.

That registry value will contain the value you need (like en-US but for the custom locale that the user chose.This will be true on any machine, whether the custom culture exists or not.

(the KLID that will be used in this case is in the form ####0c00, the reasons for which will make another post at some future time so interesting!)

This will let Tom (or anyone) who is retrieving locale information have the opportunity to find out what locale has been associated with.

In an upcoming post I'll talk about how to find a keyboard layout's registry subkey after it was created with MSKLC (which may be an important first step if you need a specific one!)....

 

This post brought to you by 󰀀 (U+f0000, the first Plane 15 character)


no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2011/11/02 The evolving Story of Locale Support, part 2 (raising the roof on keyboards)

2008/02/25 What the #$!*& is a KeyboardLayoutId, anyway?

2007/08/23 Getting the language (and more!) of an LCID-less keyboard

go to newer or older post, or back to index or month or day