If you have configured the language specific sub domains in the sites application, you can handle the redirect by add ?lang=XXXX to the current URL and redirect to that.
For example, someone used pt.website.com but you detected their browser language setting is Spanish, then you can do a redirect using "current URL" + ?lang=es-es, it will be redirected to es.website.com.