Can't properly add accented characters

So, I’m new to Keyman and I can’t possibly find a way to add accents properly.
For example, in Portuguese you can select the key “^” + “a” to make the character “â”, but using keyman, it doesn’t work for me that way, I have to use the combining diacritical markers in order to add accents, which doesn’t make much sense for me, since I just want to add “^” to vowels, and the combining diacritical markers can be applied to any letter. I read the tutorial on, and they mention rules and context, like “^” + “a” > “â”, but I don’t understand how do I add those rules to my keyboard.

There are different ways to write rules and it would be good for you to go through the tutorial if you haven’t already. See: Developing Keyboards

It’s important to realize that in Unicode, the diacritic mark must be stored after the base character, but you can write the rule to type the diacritic mark first.

A rule such as this:

"^" + "a" > “â”

works. If you don’t want a visible representation for the first keystroke, you could write it like this:

+ "^" > dk(circumflex)
dk(circumflex) + "a" >  “â”

That will give you the same behavior except that you won’t see the circumflex to start with. It is a “deadkey”.

You can add complexity to it by using stores:

store(vowel) "aeiou"
store(vpwel_circumflex) "âêîôû"
"^" + any(vowel) > index(vowel_circumflex,2)

If you leave it at that, you would get the vowels with a circumflex over it and any other time you would just get the “^” as output. You can make it more complex by adding another store and rule, such as

store(consonants) "bcdfghjklmnpqrstvwxyz"
"^" + any(consonants) > beep

That would prevent you from typing “^” followed by a consonants. It would beep at them. You could use a nul instead of beep and it just wouldn’t output anything without a sound.

There’s other kinds of rules for match, nomatch, etc. Hope you can find a helpful solution.

1 Like

Thank you! I managed to finish my layout, now I’m trying to add the keyboard to my phone.

You will need to create a touch layout.
Also, your keyboard folders and filenames must follow the conventions set here:

Another issue is to make sure to set the language tag in the .kps file.

These are all issues that keep people from being able to use their keyboard on the phone.

If you get a .kmp file, you can easily create a keyboard installer app with Keyboard App Builder. You can share that app with members of the language group and it will pretty much automatically install the keyboard on their phone.