Skip to content

Language

Rob Garrison edited this page Feb 26, 2016 · 21 revisions

Options: language | display | wheelMessage | comboRegex | combos | rtl (right-to-left) | Example


The language definition within each layout file is set to the target the ISO 639-1 code for the language. For example, for the albanian language, the code is "sq".

Each block within this language definition is described in more detail below.

jQuery.keyboard.language.sq = {
    display      : [Object],
    wheelMessage : [String],
    comboRegex   : [RegExp],
    combos       : [Object],
    rtl          : [Boolean]

language [String]

  • If set to a matching ISO 639-1 code, the language setting from that language will override the layout set language.
  • Default is null to allow the layout set language to be used.

display - [Object]

  • Use button language, symbol options or add custom HTML, like an img element (added in v1.25.23).
  • Change the displayed button text by modifying the value, in the 'key':'value' pair, with the text or symbol you want to use.
  • The value portion can have another colon ":" inside (e.g. '\u21e5:Tab'). Anything left of the colon will appear on the virtual keyboard button. Anything to the right will be added to the title and appear while hovering over the button.
  • The default values are shown in the following list. The abbreviated names contain only a symbol so as to fit the layout style as desired:

    • 'a' : '\u2714:Accept (Shift-Enter)' - Alternate accept button - unicode for check mark symbol
    • 'accept' : 'Accept:Accept (Shift-Enter)' - Accept button text
    • 'alt' : 'AltGr:Alternate Graphemes' - Alt button text (AltGr is for international key sets)
    • 'b' : '\u2190:Backspace' - Alternate backspace button - unicode for left arrow. Same as ←
    • 'bksp' : 'Bksp:Backspace' - Backspace button text
    • 'c' : '\u2716:Cancel (Esc)' - Alternate cancel button - unicode for big X
    • 'cancel' : 'Cancel:Cancel (Esc) - Cancel button text
    • 'clear' : 'C:Clear' - Clear window content (used in num pad)
    • 'combo' : '\u00f6:Toggle Combo Keys' - Toggle combo (diacritic) key
    • 'dec' : '.:Decimal' - Decimal point for num pad (optional), change '.' to ',' for European format
    • 'e' : '\u21b5:Enter' - Alternate enter button - unicode for down, then left arrow (enter symbol)
    • 'empty' : '\u00a0' - Empty button (non-breaking space)
    • 'enter' : 'Enter:Enter' - Enter button text
    • 'left' : '\u2190' - Left arrow (move caret)
    • 'lock' : '\u21ea Lock:Caps Lock' - Caps lock button - unicode for double lined up arrow
    • 'next' : 'Next \u21e8' - Go to next input/textarea
    • 'prev' : '\u21e6 Prev' - Go to previous input/textarea
    • 'right' : '\u2192' - Right arrow (move caret)
    • 's' : '\u21e7:Shift' - Alternate shift button - unicode for a thick up arrow
    • 'shift' : 'Shift:Shift' - Shift button text
    • 'sign' : '\u00b1:Change Sign' - Change sign (used in num pad) - unicode for a +- symbol
    • 'space' : ' :Space' - Space button text
    • 't' : '\u21e5:Tab' - Alternate tab button - unicode for right arrow to bar (used since only one directional tabs available)
    • 'tab' : '\u21e5 Tab:Tab' - Tab button text (Note: \u21b9 is the true tab symbol (left & right arrows) but not used here)
    • 'toggle' : ' ' - Toggle keyboard (replaced by a background image; used to enable or disable all keys & input)
  • In v1.25.9, the following default values were added. This content is only shown in the title of the key to show the state of the key:

    • 'valid' : 'valid' - Added to the accept key title when acceptValid is true & the validate function returns true.
    • 'invalid' : 'invalid' - Added to the accept key title when acceptValid is true & the validate function returns false.
    • 'active' : 'active' - Added to the combo key title when combo keys are active (useCombos is true).
    • 'disabled' : 'disabled' - Added to the combo key title when combo keys are disabled (useCombos is false).
  • In v1.25.23, HTML can be added to any display value, e.g

    display: {
      'emotes' : '<img src="emotes-icon">'
    }

wheelMessage - [String]

  • Message to tell users about the hidden feature.
  • This message is only added when a key on the keyboard is hovered over.
  • The text is added to the title attribute of the key, so if you want to have a tooltip attached to it. You will probably need a 'live' tooltip that targets the 'ui-keyboard-button' class.
  • The default (English) message is 'Use mousewheel to see other keys'.

comboRegex - [RegExp]

  • Include any additional combo keys used for the language within this regular expression.
  • This regular expression will override the default from $.keyboard.comboRegex.
  • The default contained within the $.keyboard.comboRegex is /([\'~^\"ao])([a-z])/mig`.

combos - [Object]

  • Add desired combo keys using this format

    combos : {
        '/' : { d:"\u0111", D:"\u0110", l:"\u0142", L:"\u0141" } // stroke đ Đ ł Ł
    }
  • The "key" is a forward-slash ('/') in the above example.

  • The object that follows contains the symbol which when combined with the key will result in a combo, e.g. (/d becomes đ)
  • To remove any existing combos, just set the key to an empty object: "'" : {} // remove apostrophe combo

rtl - [Boolean]

  • Boolean flag indicating that a language is in the direction from right-to-left
  • This flag adds a css definition of direction: rtl when true
  • If you want the text to align to the right within the input/textarea, then define a rtl css definition:

    rtl { text-align: right; }
  • By default, this option is false.

Example

  • This is the Albanian language file
/* Albanian keyboard layouts
 * contains layout: 'albanian-qwertz' & 'albanian-qwerty'
 *
 * To use:
 *  Point to this js file into your page header: <script src="layouts/albanian.js" type="text/javascript"></script>
 *  Initialize the keyboard using: jQuery('input').keyboard({ layout: 'albanian-qwertz' });
 *
 * To do: add combos appropriate to the Albanian language
 *  missing caron, breve, ring, ogonek, double acute accent, diaeresis and cedilla accents.
 *
 * license for this file: WTFPL, unless the source layout site has a problem with me using them as a reference
 */

/* qwertz-albanian
 combined from http://en.wikipedia.org/wiki/File:Albanian_keyboard_layout.jpg,
 http://ascii-table.com/keyboard.php/448 & http://www.google.com/webelements/ */

jQuery.keyboard.layouts['albanian-qwertz'] = {
    'name' : 'Albanian-qwertz',
    'lang' : ['sq'],
    'default' : [
        "\\ 1 2 3 4 5 6 7 8 9 0 - = {bksp}",
        "{tab} q w e r t z u i o p \u00e7 '",
        "a s d f g h j k l \u00eb [ ] {enter}",
        "{shift} < y x c v b n m , . / {shift}",
        "{accept} {alt} {space} {alt} {cancel}"
    ],
    'shift' : [
        '| ! " # $ % ^ & * ( ) _ + {bksp}',
        "{tab} Q W E R T Z U I O P \u00c7 @",
        "A S D F G H J K L \u00cb { } {enter}",
        "{shift} > Y X C V B N M ; : ? {shift}",
        "{accept} {alt} {space} {alt} {cancel}"
    ],
    'alt' : [
        "\\ ~ \u02c7 ^ \u02d8 \u00b0 \u02db ` \u02d9 \u00b4 \u02dd \u00a8 \u00b8 {bksp}",
        "{tab} q w \u20ac r t z u i o p \u00f7 \u00d7",
        "\u00e4 \u0111:Shortcut_(\/d) \u0110:Shortcut_(\/D) f g h j \u0142:Shortcut_(\/l) \u0141:Shortcut_(\/L) $ \u00df \u00a4 {enter}",
        "{shift} < y x c @ { } \u00a7 < > / {shift}",
        "{accept} {alt} {space} {alt} {cancel}"
    ]
};

/* based on http://ascii-table.com/keyboard.php/452 */
jQuery.keyboard.layouts['albanian-qwerty'] = {
    'name' : 'Albanian-qwerty',
    'lang' : ['sq'],
    'default' : [
        "` 1 2 3 4 5 6 7 8 9 0 - = {bksp}",
        "{tab} q w e r t y u i o p \u00eb '",
        "a s d f g h j k l ; \u00e7 # {enter}",
        "{shift} \\ z x c v b n m , . / {shift}",
        "{accept} {alt} {space} {alt} {cancel}"],
    'shift' : [
        '\u00ac ! " \u00a7 $ % ^ & * ( ) _ + {bksp}',
        "{tab} Q W E R T Y U I O P \u00cb @",
        "A S D F G H J K L : \u00c7 ~ {enter}",
        "{shift} \u00a6 Z X C V B N M < > ? {shift}",
        "{accept} {alt} {space} {alt} {cancel}"
    ],
    'alt' : [
        "| 1 2 3 4 5 6 { } [ ] - = {bksp}",
        "{tab} q w \u20ac r t y u i o p \u00f7 \u00d7",
        "a s d f g h j k l ; \u00e7 # {enter}",
        "{shift} \\ z x c v b n m , . / {shift}",
        "{accept} {alt} {space} {alt} {cancel}"
    ],
    'alt-shift' : [
        '| ! " \u00a7 $ % ^ & * ( ) _ + {bksp}',
        "{tab} Q W \u20AC R T Y U I O P \u00cb @",
        "A S D F G H J K L : \u00c7 ~ {enter}",
        "{shift} \u00a6 Z X C V B N M < > ? {shift}",
        "{accept} {alt} {space} {alt} {cancel}"
    ]
};

// Keyboard Language
// please update this section to match this language and email me with corrections!
// sq = ISO 639-1 code for Albanian
// ***********************
jQuery.keyboard.language.sq = {
    display : {
        'a'      : '\u2714:Prano (Shift-Enter)', // check mark - same action as accept
        'accept' : 'Prano:Prano (Shift-Enter)',
        'alt'    : 'Alt:Alternativ',
        'b'      : '\u2190:Hapësirën Mbrapa',    // Left arrow (same as &larr;)
        'bksp'   : 'Bksp:Hapësirën Mbrapa',
        'c'      : '\u2716:Anuloj (Arratisjes)', // big X, close - same action as cancel
        'cancel' : 'Anuloj:Anuloj (Arratisjes)',
        'clear'  : 'C:Qartë',             // clear num pad
        'combo'  : '\u00f6:Kombinimi',
        'dec'    : '.:Decimal',           // decimal point for num pad (optional), change '.' to ',' for European format
        'e'      : '\u21b5:Shkruani',        // down, then left arrow - enter symbol
        'enter'  : 'Shkruani:Shkruani',
        'lock'   : '\u21ea Bllokoj:Caps Lock', // caps lock
        's'      : '\u21e7:Ndryshim',        // thick hollow up arrow
        'shift'  : 'Ndryshim:Ndryshim',
        'sign'   : '\u00b1:Ndryshimi Regjistrohu',  // +/- sign for num pad
        'space'  : '&nbsp;:Hapësirë',
        't'      : '\u21e5:Tab',          // right arrow to bar (used since this virtual keyboard works with one directional tabs)
        'tab'    : '\u21e5 Tab:Tab',      // \u21b9 is the true tab symbol (left & right arrows)
        'toggle' : ' ',                   // replaced by an image
    },
    // Message added to the key title while hovering, if the mousewheel plugin exists
    wheelMessage : 'P\u00ebrdorimi mousewheel p\u00ebr t\u00eb par\u00eb \u00e7el\u00ebsat e tjera',

    // New combos using specific accents
    // Not sure what to do with these accents:  ˇ ˘ ˙ ° ˛ ˝
    comboRegex : /([`\'~\^\"ao\/\u00a8\u00b8])([a-z])/gim,
    combos : {
        // duplicated from regular combos, used specific accents here instead ("); \u00a8 = ¨
        '\u00a8' : { a:"\u00e4", A:"\u00c4", e:"\u00eb", E:"\u00cb", i:"\u00ef", I:"\u00cf", o:"\u00f6", O:"\u00d6", u:"\u00fc", U:"\u00dc", y:"\u00ff", Y:"\u0178" }, // umlaut/trema
        '\u00b8' : { c:"\u00e7", C:"\u00c7" }, // cedilla ç Ç

        // new combos below ( forward slash + d, forward slash + l )
        '/'      : { d:"\u0111", D:"\u0110", l:"\u0142", L:"\u0141" } // stroke đ Đ ł Ł
    }
};

Wiki Pages: Home | FAQ | Setup | Usage | Options ( Layout, Language, Usability, Actions ) | Methods | Theme | Log

Something went wrong with that request. Please try again.