Creating a multi-platform multi-baselayout keyboard

Hi I’m trying to create a multi platform/baselayout keyboard, are there any examples in the repository I could crib from?
What I’ve got so far:

store(&TARGETS) 'windows macosx linux web iphone ipad androidphone androidtablet mobile desktop tablet'
store(&KEYBOARDVERSION) '10.0' 
store(&mnemoniclayout) '0'

c NFC qwerty default for Mac, Linux and web, touch?
begin Unicode > use(main)

group(main) using keys 
store(allchars) [K_A] [K_Q] [K_Z]  
c platform("web") + notany(nochars) > use(web)
platform("web") + any() > use(web)
platform("touch") + any() > use(touch)
platform("hardware") + any() > use(hardware) 
c should never get this far so beep as error message
nomatch() + any() > beep 

group(web) using keys
c a qwerty web 
+ any() > "a web keyboard"     

group(touch) using keys 
c a qwerty touch
+ any() > "a touch keyboard"

group(hardware) using keys
platform("windows") + any() > use(windows)
platform("linux") + any()   > use(linux)
platform("macos") + any()   > use(macos)   

group(linux) using keys
+ any() > "a linux keyboard"

group(macos) using keys
+ any() > "a macos keyboard"

group(windows) using keys 
c + any() > "a windows keyboard"
baselayout("en-US") + any() > use(SGGBUS73NFC)  
baselayout("en-UK") + any() > use(SGGBUK73NFC)
baselayout("fr-FR") + any() > use(SGGBFR73NFC)  
baselayout("fr-CH") + any() > use(SGGBCH73NFC)  
baselayout("es-ES") + any() > use(SGGBES73NFC)
baselayout("pt-BR") + any() > use(PTABNT73NFC)  
baselayout("pt-PT") + any() > use(SGGBPT73NFC)
baselayout("sv-SE") + any() > use(SGGBSW73NFC)  
baselayout("it-IT") + any() > use(SGGBIT73NFC)
baselayout("nl-NL") + any() > use(SGGBNL73NFC)  
baselayout("nn-NO") + any() > use(SGGBNO73NFC)
baselayout("nb-NO") + any() > use(SGGBNO73NFC)  
baselayout("de-DE") + any() > use(SGGBDE73NFC)
baselayout("de-CH") + any() > use(SGGBCH73NFC)
c defaults to qwerty for ajami
c should this be 'mey' for Hassaniya Arabic??? or 'mey-sn'?
C is there a windows code for this??
baselayout("ar-sa") + any() > use(SNAJAMIQ)  
nomatch() + any() > beep

group(SGGBUS73NFC) using keys
store(allchars) [K_Q][K_A][K_Z]  

+ any(allchars) > context " on en-US keyboard "
c + [K_Q] > "q en-US keyboard "

group(SGGBUK73NFC) using keys
+ [K_A] > "a en-UK keyboard"

group(SGGBFR73NFC) using keys
+ [K_A] > "a fr-FR keyboard"

group(SGGBPT73NFC) using keys
+ any() > "a pt-PT keyboard"

group(PTABNT73NFC) using keys
+ any() > "a pt-ABNT keyboard"

group(SGGBES73NFC) using keys
+ any() > "a es-ES keyboard"

group(SGGBCH73NFC) using keys
+ any() > "a ch-CH keyboard"

group(SGGBDE73NFC) using keys
+ any() > "a de-DE keyboard"

group(SGGBIT73NFC) using keys 
+ any() > "a it-IT keyboard"


group(SGGBSW73NFC) using keys
+ any() > "a sv-SE keyboard"

                            
group(SGGBNO73NFC) using keys
+ any() > "a nn-NO keyboard"


group(SGGBNL73NFC) using keys
+ any() > "a nl-NL keyboard"

group(SNAJAMIQ) using keys
+ any() > "a QWERTY Ajami keyboard"

this complies and seems to switch for the web and en-US keyboards but only outputs the phrase when I type ‘a’.
Thanks for any advice
MarkS

Hi Mark
Have you looked for examples in the Keyman keyboards repository on GitHub?

You’ll find the .kmn source files in release\**\source\*.kmn

baselayout

I didn’t see a keyboard that uses baselayout. Here’s the help documentation for baselayout though.

platform

Here’s some of the keyboards that use platform:
release/k/kmher_angkor
release/sil/sil_cameroon_qwerty

There’s also an engineering test keyboard called platform-rules

-Darcy

Hi @MarkSkinner,

Some thoughts.

  1. any() is not valid syntax. I’ve written up a bug report noting that the compiler should not be accepting that. See the report for technical details.

  2. The baselayout syntax works only with Latin script base keyboards at this time. The intent of baselayout is to provide targeted overrides for specific base keyboards, when used together with store(&mnemoniclayout) '1'. While in theory we can support non-Latin-script base layouts, in practice right now the Keyman Configuration UI prevents selection of them. It is possible to develop your layout for a multitude of base layouts as you are doing, but I think it will make for a very complex and difficult to maintain (and test) keyboard layout.

  3. baselayout and mnemonic layouts are currently only fully supported on Windows. Web has extremely limited support; macOS and Linux have no support. Android and iOS have no support (baselayout makes sense only for hardware keyboards on those platforms; iOS does not allow us to use hardware keyboards with Keyman system keyboards). We are planning to support mnemonic layouts and base layouts more fully in a future version of Keyman.

  4. store(&targets) 'any' might be simpler if you are targeting all platforms. See explanation of targets.

  5. While I don’t usually recommend it, an initial branching group can be used to pass control onto an appropriate group for platform tests. Note the group statement does not include using keys. I don’t recommend this approach normally, because in my experience it’s better to develop common shared rules and then add a few special cases for specific platforms, rather than the other way around, which leads to a lot of repetition that is harder to consolidate.

group(main)
platform('web') > use(web)
platform('touch') > use(touch)
platform('hardware') > use(hardware)
nomatch > beep

group(web) using keys
...

HTH!

Respectfully, due to the inactiveness of the conversation, this topic is now closed for any further discussion.
Please feel free to create a new topic if there is any question or the issue persists.