Getting the user’s language

See How to internationalize your application.