I have a form which lets users input text snippets. So how can figure out the language of the entered text?
Specifically these languages for now:
Arabic: هذه
Presumably guessing the user's language is to display responses in the proper language. What about examining the browser's settings for preferred languages? Obtain that from the HTTP header Accept-Language. See section 14.4 here.