-
Notifications
You must be signed in to change notification settings - Fork 725
Open
Description
How do i set a default keyset language?
I want to set the default keyset to swedish.
i tried with language : 'sv', but it doesnt work.
Here is my code:
<script>
$(function(){
var t,
o = '',
layouts = [];
// Change display language, if the definitions are available
showKb = function(layout){
var kb = $('#multi').getkeyboard();
kb.options.layout = layout;
// true flag causes a keyboard refresh
kb.reveal(true);
};
$.each(jQuery.keyboard.layouts, function(i, l){
if (l.name) {
layouts.push([i,l.name]);
}
});
// sort select options by language name, not
layouts.sort( function( a, b ) {
return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;
});
$.each(layouts, function(i, l){
o += '<option value="' + l[0] + '">' + l[1] + '</option>';
});
$('#multi').keyboard({
layout: 'qwerty',
usePreview: false,
autoAccept: 'true',
language: 'sv',
css: {
// input & preview
input: 'form-control input-sm',
// keyboard container
container: 'structure', // jumbotron
// default state
buttonDefault: 'btn btn-default',
// hovered button
buttonHover: 'btn-primary',
// Action keys (e.g. Accept, Cancel, Tab, etc);
// this replaces "actionClass" option
buttonAction: 'active',
// used when disabling the decimal button {dec}
// when a decimal exists in the input area
buttonDisabled: 'disabled'
}
})
// activate the typing extension
.addTyping({
showTyping: true,
delay: 200
})
.previewKeyset();
$('#lang')
.html(o)
.change(function(){
var kb = $('#multi'),
$this = $(this),
$opt = $this.find('option:selected'),
layout = $this.val();
$('h2').text( $opt.text() );
showKb( layout );
}).trigger('change');
});
</script>
Any help would be appreciated.
Regards Joel