Skip to content

Adding a new language

Pedro Mangabeira edited this page Oct 9, 2023 · 3 revisions

Language file layout

This page will explain to you the file format used by 8VIM and how to make it available.

Overview

The file uses YAML to describe the layout and keyboard to be rendered.

The layout supports 5 visible layers, the first one being the default keyboard rendered.

The other layers can be used, for example, to render diatrics, special symbols of your language.

It also supports a hidden layer which is not rendered but can be useful for handling special actions/characters.

Example

layers:
  hidden:
    - type: INPUT_KEY
      movement_sequence:
        - TOP
        - INSIDE_CIRCLE
        - NO_TOUCH
      key_code: HIDE_KEYBOARD
    - movement_sequence:
        - NO_TOUCH
        - LEFT
        - BOTTOM
        - RIGHT
        - NO_TOUCH
      lower_case: 😊
      upper_case: 😁
  default:
    sectors:
      right:
        parts:
          bottom:
            - lower_case: n
            - lower_case: m
            - lower_case: f
            - lower_case: "!"
              upper_case: "!!!"
          top:
            - lower_case: a
            - lower_case: r
            - lower_case: x
            - lower_case: "?"
              upper_case: "*"
  extra_layers:
    first:
      sectors:
        left:
          parts:
            top:
              - null
              - lower_case: ç

Object definitions

Each enum types are case insensitive.

Layout definition (root)

Name Type Default Description
layers Layers Required layers definition.

Layers definition

Name Type Default Description
hidden list<action> Optional Hidden layer definition.
default Layer Optional Default layer. Only required if extra_layers is set.
extra_layers map<ExtraLayer, Layer> Optional Extra layers to be rendered.

ExtraLayer enum

Name Description
FIRST First extra layer
SECOND Second extra layer
THIRD Third extra layer
FOURTH Fourth extra layer
FIFTH Fifth extra layer

Layer object

Name Type Default Description
sectors map<Direction,Sector> Required Sectors definition to rendered

Sector object

Name Type Default Description
parts map<Direction,List<Action>> Required Sectors definition to rendered

Direction enum

Name Description
LEFT LEFT sector, or LEFT part for TOP/BOTTOM sector
RIGHT RIGHT sector, or RIGHT part for TOP/BOTTOM sector
TOP TOP sector, or TOP part for LEFT/RIGHT sector
BOTTOM BOTTOM sector, or BOTTOM part for LEFT/RIGHT sector

Action object

For the visible layers, each sector/part can have up to 4 actions. For rendered text, it has up to 4 actions. The position in the list represents the position on the keyboard starting from the centre.

If the action is null the position is skipped and the next one will be rendered according to its position on the list.

Name Type Default Description
type enum INPUT_TEXT Type of the action. Can be INPUT_TEXT or INPUT_KEY for special actions
movement_sequence list<FingerPosition> Optional List of the finger position required to trigger this action. If this option is not defined, the movement sequence will be computed depending on the layer, sector, part and position of the action. Required for the hidden layer.
key_code KeyCode Optional Only used if type is INPUT_KEY
flags integer 0 Additional flags
lower_case string Optional It is the lowercase of the text to be rendered
upper_case string Optional If this property is not defined, the upper_case will be base of the lower_case value. It is upper lower case of the text to be rendered

FingerPosition enum

Name Description
NO_TOUCH No touch on the keyboard
INSIDE_CIRCLE The finger is inside the circle
TOP The finger move to the top sector
LEFT The finger move to the left sector
BOTTOM The finger move to the bottom sector
RIGHT The finger move to the right sector
LONG_PRESS The finger did a movement and don't move for a while
LONG_PRESS_END The long press started, and the finger started to move again

KeyCode enum

Name Description
MOVE_CURRENT_END_POINT_LEFT
MOVE_CURRENT_END_POINT_RIGHT
MOVE_CURRENT_END_POINT_UP
MOVE_CURRENT_END_POINT_DOWN
SELECTION_START
SELECT_ALL
TOGGLE_SELECTION_ANCHOR
SHIFT_TOGGLE
SWITCH_TO_MAIN_KEYPAD
SWITCH_TO_NUMBER_KEYPAD
SWITCH_TO_SYMBOLS_KEYPAD
SWITCH_TO_SELECTION_KEYPAD
SWITCH_TO_EMOTICON_KEYBOARD
SWITCH_TO_CLIPPAD_KEYBOARD
HIDE_KEYBOARD
NO_OPERATION

Adding a language to 8VIM

  • Create a language layout under 8vim/src/main/res/raw.

    The file must follow this format: ISO code 2 of the language.yaml.

    Example: en.yaml