A compilation of information about the layout formats usable in this app.
There are two distinct formats:
- the simple format is a text file with one key per line, and two consecutive line breaks indicating a switch to the next row, example
- the json format taken from FlorisBoard, but only "normal" keys are supported (i.e. no action keys and similar), example
Adding too many keys or too long texts will make the keyboard look awkward or broken, and even crash the app under some specific conditions. There are some sanity checks when adding a layout to avoid such issues, but they do not cover all possible cases. Further there is no check whether the layout actually contains characters of the selected language.
If you use an external glide typing library, you likely will have issues if your layout contains duplicate keys, or keys with text longer than a single letter.
There are special key labels that are intended for internal use only, but can (currently) be set on custom layouts too. An example is !icon/previous_key|!code/key_action_previous
, so it's unlikely you will stumble upon issues here when not intentionally provoking it.
One special label that might be wanted though is $$$
, which will be replaced by the local currency. $$$1
- $$$5
will be replaced by currencies available on long-pressing the currency key.
If you want different key label and use text, set the label to [label]|[text], e.g. aa|bb
will show aa
, but pressing the key will input bb
.
Some special key labels will be implemented, most are already working in the (currently experimental) customization of number layouts (numpad and similar). Some keys have two names for compatibility to FlorisBoard layouts.
- alpha / view_characters: switch to alphabet keyboard (or main phone keyboard in case of phone layout)
- symbol / view_symbols: switch to symbol keyboard (or phone symbols keyboard in case of phone layout)
- symbol_alpha: toggle alpha / symbol keyboard
- numpad / view_numeric_advanced: switch to numpad layout
- emoji: switch to emoji view
- com: display common TLDs (.com and similar)
- emoji_com: emoji key, but in URL and email fields it's a com key
- language_switch: language switch key
- action / enter: the action (enter) key
- delete: delete key
- shift: shift key, will change label when in symbols layout
- period:
.
key with punctuation popups, will adapt to language-specific period - comma:
,
key with special popups, will adapt to language-specific comma, or display/
in URL fields and@
in email fields - space: space key, with icon when using a number layout
- zwnj: Zero-width non-joiner (automatically added next to space in alphabet layout for some languages)
- One key per line
- Key format: [label] [popup keys], all separated by space, e.g.
a 0 + *
will create a key with texta
, and the keys0
,+
, and*
on long press
- Key format: [label] [popup keys], all separated by space, e.g.
- Two consecutive newlines mark beginning of a new row
- Allows more flexibility than the simple format, e.g. changing keys depending on input type, shift state or layout direction
- You can use character layouts from FlorisBoard
- Support is not 100% there yet, notably
kana_selector
andchar_width_selector
do not work.
- Support is not 100% there yet, notably
- There is no need for specifying a code, it will be determined from the label automatically
- You can still specify it, but it's only necessary if you want key label and code to be different
- Note that not all special codes (negative numbers) from FlorisBoard are supported
- You can add the numeric value of a labelFlag to a key for some specific effects, see here in the section keyLabelFlags for names and numeric values.
- More details on the formal will be provided. For now you can check other layouts, often you just need to copy lines and change the labels.
- You need a layout file in one of the formats above, and add it to layouts
- Popup keys in the layout will be in the "Layout" popup key group.
- Add a layout entry to
method.xml
KeyboardLayoutSet
inandroid:imeSubtypeExtraValue
must be set to the name of your layout file (without file ending)android:subtypeId
must be set to a value that is unique in this file (please use the same length as for other layouts)- If you add a layout to an existing language, add a string with the layout name to use instead of
subtype_generic
. The new string should be added to defaultstrings.xml
, and optionally to other languages.%s
will be replaced with the language.
- If you add a new language, you might want to provide a language_key_texts file
[popup_keys]
section contains popup keys that are similar to the letter (likea
andä
orय
andय़
)- Such forms should not be in the layout. They will apply to all layouts of that language, even custom ones.
- The popup keys will be added to the "Language" popup key group (relevant for setting popup key order).
- Use
%
to mark all preceding keys as "Language (important)" instead. Keys after%
will still be in the "Language" group.
- Use
- The
punctuation
key is typically the period key.popup_keys
set here override the default.
[labels]
may contain non-default labels for the following keyssymbol
,alphabet
,shift_symbol
,shift_symbol_tablet
,comma
,period
,question
[number_row]
may contain a custom number row (1-9 and 0 separated by space). You should also add the language tonumberRowLocales
inPreferencesSettingsFragment
so the user can opt into having a localized number row.[extra_keys]
are typically keys shown in the default layout of the language. This is currently only used for latin layouts to avoid duplicating layouts for just adding few keys on the right side. The layout name need to end with+
, but the+
is removed when looking up the actual layout.
- If you add a new language for which Android does not have a display name, it will be displayed using the language tag
- Avoiding this currently is more complicated than necessary: add the language tag to LocaleUtils.getLocaleDisplayNameInSystemLocale to have an exception, and add a string named
subtype_<langage tag, but with _ instead of ->
tostrings.xml
. Further you may need to add asubtype_in_root_locale_<language tag>
to donottranslate.xml, and add the language tag tosubtype_locale_exception_keys
andsubtype_locale_displayed_in_root_locale
.
- Avoiding this currently is more complicated than necessary: add the language tag to LocaleUtils.getLocaleDisplayNameInSystemLocale to have an exception, and add a string named