Is there a way to detect the language of the data being entered via the input field?
I'm not aware of a PHP solution for this, no.
The Google Translate Ajax APIs may be for you, though.
Check out this Javascript snippet from the API docs: Example: Language Detection