addKeyboards
Summary
Adds keyboards to keymanweb.
Syntax
tavultesoft.keymanweb.addKeyboards(spec[, spec...])
Parameters
spec- Type:
string|Object - keyboard name string or keyboard metadata JSON object
Return Value
undefined
Description
The keyboard spec can be a string or an object. Multiple keyboard specs can be specified in a single call, which can reduce the round-trip cost of multiple calls to Keyman Cloud servers (when using Keyman Cloud).
For general information and example uses of this method, please see the Adding Keyboards page from the guide section.
Using a string
When keyboard spec is a string, the Keyman Cloud is used to source the keyboard file. Keymanweb will load webfonts and keyboard file automatically on demand. The string format is one of the following:
'keyboardID': Adds a specific keyboard, linking it to the default language for the keyboard'@languageID': Adds the default keyboard for the specified ISO 639-3 language code'keyboardID@languageID': Loads a specific keyboard + language combination
The keyboard catalogue is online at http://keyman.com/developer/keymanweb/keyboards.php.
Using an object
When keyboard spec is an object, then more parameters can be specified, including sourcing the keyboard from locations other than the Keyman Cloud. The specification of the object is related to the Keyman Cloud JSON API (formerly known as KeymanWeb Server Data API):
The spec object contains the following members:
namestring- Name of the keyboard.
idstring- ID (internal name) of keyboard, together with version always matches the filename of the keyboard
filenamestring- url of keyboard *.js file, relative (to page) or absolute
languagearray|object- An array of objects (see definition below) or single object linked to the keyboard.
rtlbooleanoptionaltrueif the keyboard targets a right-to-left script. May be set tofalseor leftundefinedotherwise.versionstringoptional- Version of keyboard *.js file
The spec.language object contains the following members:
namestring- Name of the language.
idstring- ISO 639-3 language code.
regionstringoptional- Required when using the Toolbar UI. May be set with one of the following region names:
'World'('un')'Africa'('af')'Asia'('as')'Europe'('eu')'South America'('sa')'North America'('na')'Oceania'('oc')'Central America'('ca')'Middle East'('me')
fontarray|objectoptional- An array of Font objects (see definition below) or single object describing fonts for input fields and the OSK (if
oskFontis not present.) oskFontarray|objectoptional- An array of Font objects (see
fontdefinition below) or single object describing fonts for the OSK.
The spec.language.font object contains the following members:
familystring- Font family that KeymanWeb will provide for this font.
filenamearray- Array of URLs where font resources can be accessed, relative to the
fontsinitialization property. Multiple font resources can be specified as platform font format support varies and KeymanWeb will pick the most appropriate for the platform. sizestringoptional- Font size (in CSS dimensions). If not specified, then
1emis used.


