2👍
✅
I would go for user agent because the user is able to set his preferred language in his browser. IP location says nothing about the language the user actually speaks nor does the user have any influence on it. In both cases you can still provide a language selector on your page as well.
Source:stackexchange.com