Change writing language at browser

89 views Asked by At

I want change language on browsers. I asked for change system language on this post: How change system language and the answer I've got was Impossible!

I saw before at some websites, by English system language, I could write in other language without changing the system language. Google has something like this too : google changing language

How can I do this on some of the my form's input?

1

There are 1 answers

1
Justinas On

You have to map all keyboard buttons clicks to new layout

var charMap = {
   'en': {
       '13': 'enter',
       '54': '6',
       ...
    },
    'lt': {
        '13': 'enter',
        '54': 'ลก',
        ...
    }
}

$('.input').on('keyup', function(e) {
  var char = charMap[lang][e.which];

  $(this).val($(this).val()+char);
});

Check THIS page for keyboard kodes