Does Keyman support create stores with strings as elements

I’m currently working on a keyboard for an Indic language, which has a complex script. My attempt is to mimic a popular keyboard layout in Keyman. However this layout requires outputting a sequence of characters (string) against a single keystroke.

store(keystroke) ‘kKgG’
store(output) ‘[kx][Kx][gx][Gx]’ c denotes a string

  • any(keystroke) > index(output, 1) c + at the beginning of this line is changing to a bullet in this forum

Is there a way to express this in Keyman? This will be extremely helpful, otherwise I’ll have to write each rule separately.


I don’t think that Keyman syntax supports storing strings as you propose. But what about using two stores for the output? For example:

store(keystroke) ‘kKgG’
store(output1) ‘kKgG’
store(output2) ‘wxyz’

any(keystroke) > index(output1,1) index(output2,2) c needs + at beginning of line

But maybe someone will have a better solution.

That looks like an elegant solution within Keyman’s existing model. One minor tweak - the second index statement needs to reference the same input position (1):

+ any(keystroke) > index(output1, 1) index(output2,1)

Note: to get code formatting on this forum, use ` for inline code and 4 space indents for multi-line examples (blank lines needed above and below the code section)

So, just to bring it back to what you want to do, you would have:

store(keystroke) 'kKgG’
store(output1) 'kKgG’
store(output2) ‘xxxx’         c note that all four of the outputs are the same

+ any(keystroke) > index(output1, 1) index(output2,1)

Then when you type “k” the output will be “kx”. When you type “G” you would get “Gx”

I could see this being useful when you have combining characters that you want to output as the second item.

Thank you all for responding. Yup drowe's solution with suggestions from Marc and Phil works. However that gave me another possible way of solving the issue. Here what I’ve done.

store(simpleConsKeyStrokes) 'kgjTD' c keystrokes
store(simpleConsMlym) 'കഗജടഡദ'  c corresponding Malayalam characters  
+ any(simpleConsKeyStrokes) > index(simpleConsMlym, 1) "്" c  "്" = 'x' in the original question

and the output appears as expected. This method eliminates the need for creating a placeholder group. So I thought I share what I end up using. Do you see any potential (future) problems if I define it this way?

A million thanks for your timely help.

That code looks great. You shouldn’t have any problems with that.