1

Follwing How to switch input to other language, lets say I want to change the input language to Hebrew or location based language. By changing I want that any keyboard text that will be typed in input element will appear in the language I set on it(without a user action like alt+ctrl).

Is there a JS or angular lib for it? It does not have to be dynamic, even hardcode for start will be great, like:

<input type="textbox" name="text1" Lang="fa-IR" /> //persian

In this case all user input inserted appear in persian.

Thanks.

Community
  • 1
  • 1
Itsik Mauyhas
  • 3,824
  • 14
  • 69
  • 114

1 Answers1

0

If what you want is: 1/ Retrieve user's language preference 2/ then update the Lang attribute of your input accordingly

I suggest you have a look at https://stackoverflow.com/a/38150585/3410584 for the 1/ and then you can do

var language = yourFunctionToRetrieveUserLanguage();
var input = document.getElementsByName('text1')[0];
input.setAttribute('Lang', language);

;

Community
  • 1
  • 1
ValLeNain
  • 2,232
  • 1
  • 18
  • 37