language dectection function api