Craft 2: Serve language / locale i18n according to user agent
You could accomplish this before your PHP is executed as redirects listening for the accept_language header (both are untested from my part):

APACHE

RewriteEngine on
RewriteCond %{HTTP:Accept-Language} (de) [NC]
RewriteRule .* http://example.com/de/ [R,L]


NGINX

map $http_accept_language $lang {
  default en;
  ~de de;
}

location ~* "/" {
  return 302 https://example.com/$lang;
}