Conditional output


#1

Hello,

I have a question with generating a keyboard layout.

Here is the scenario.

If ( the current text in the document is “b” )
If (the user press “a”) I want the output to be “a”
Else
If (the user press “a”) I want the output to be “c”

But with the store option
I have to delete the current text “b” and replace with “ba”

This becomes an issue with the diacritics and consonant conjugates in indic languages.

I want to output only the conditional diacritics based on the previous base consonant. or else output a vowel if the consonant is not present in the previous position.

I am not finding a way to conditional output without having to replace the condition.

Please assist.


#2

This is a place where Keyman is ideally placed. Given your example, you can code your solution in Keyman as follows:

'b' + 'a' > context 'a'
+ 'a' > 'c'

Or,

'b' + 'a' > 'ba'
+ 'a' > 'c'

More generally, you can use a store:

store(cons) 'bcdfg'

any(cons) + 'a' > context 'a'
+ 'a' > 'c'

Read more on https://help.keyman.com/developer/language/guide/rules


#3

Thank you.
Now I understand it better.