Я использую виртуальную клавиатуру mottie, и она работает хорошо.
Я создал пользовательскую кнопку для переключения языка между Arabic
и English
языком, по умолчанию он показывает English
как язык по умолчанию.
При нажатии этой кнопки происходит правильное переключение языка, но не изменяется отображаемое имя клавиши langSwitcher
.
$("#searchInput").keyboard({
language: 'en',// default language
keyBinding: 'mousedown touchstart',
layout: 'qwerty',
caretToEnd: true,
autoAccept: true,
usePreview: false,
appendLocally: true,
autoAcceptOnValid: true,
display: {
langSwitcher: 'English',
},
container: {theme: 'b', cssClass: 'ui-body'},
});
$.keyboard.keyaction.langSwitcher = function (keyboard) {
if (keyboard.options.language == 'en') {
keyboard.options.display.langSwitcher = "English";
keyboard.options.layout = 'ms-Arabic (102)';
keyboard.options.language = 'ar';
} else {
keyboard.options.display.langSwitcher = 'عربي';
keyboard.options.layout = 'qwerty';
keyboard.options.language = 'en';
}
console.log(keyboard.options.display.langSwitcher);
keyboard.redraw();
};
<link href="https://mottie.github.io/Keyboard/docs/css/bootstrap.min.css" rel="stylesheet">
<link href="https://mottie.github.io/Keyboard/docs/css/font-awesome.min.css" rel="stylesheet">
<link href="https://mottie.github.io/Keyboard/docs/css/jquery-ui.min.css" rel="stylesheet">
<!-- keyboard widget css & script (required) -->
<link href="https://mottie.github.io/Keyboard/css/keyboard.css" rel="stylesheet">
<link href="https://mottie.github.io/Keyboard/css/keyboard-previewkeyset.css" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://mottie.github.io/Keyboard/docs/js/jquery-ui.min.js"></script>
<script src="https://mottie.github.io/Keyboard/docs/js/bootstrap.min.js"></script>
<script src="http://samsung.developnet.net/assets/js/plugins/vkeyboard/dist/js/jquery.keyboard.js"></script>
<!-- keyboard extensions (optional) -->
<script src="https://mottie.github.io/Keyboard/js/jquery.mousewheel.js"></script>
<script src="https://mottie.github.io/Keyboard/js/jquery.keyboard.extension-typing.js"></script>
<script src="https://mottie.github.io/Keyboard/js/jquery.keyboard.extension-previewkeyset.js"></script>
<script src="http://samsung.developnet.net/assets/js/plugins/vkeyboard/dist/layouts/keyboard-layouts-microsoft.min.js"></script>
Search : <input type='text' name='q' id='searchInput' />
Я попытался напечатать отображаемое имя в консоли при смене языка.
оно изменено на новый язык и новое имя, но не отображается в тексте кнопки.
Как решить эту проблему?