public static function getLanguages() {
    if(null === self::$languages) {
      // The pattern to match languages.
      $pattern = '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i';

      // Get a list of languages.
      $languages = explode(',', @trim($_SERVER['HTTP_USER_AGENT']));

      // Any matches?
      $matches = array();
      if(preg_match($pattern, $languages, $matches) && 0 < count($matches[1])) {
        self::$languages = array_combine($matches[1], $matches[4]);
      } else {
        self::$languages = [];
      }
    }
    return self::$languages;
  }