Add detect and get_language capability

* Cherry picked from the PR #16