Get language information of a user in Symfony

Code
<?php

use Symfony\Component\HttpFoundation\Request;

$request Request::createFromGlobals();

// Returns the preferred language
$preferredLang $request->getPreferredLanguage();

// Languages acceptable by the client browser
$languages $request->getLanguages();

dump($preferredLang$languages);
Result
^ "en_US"

^ array:2 [
0 => "en_US"
1 => "en"
]