getAcceptedLanguagesFromHeader = (header) => {
    const languages = header.split(',')
    const preferences = {}
    return languages
      .map((item) => {
        const preferenceParts = item.trim().split(';q=')
        if (preferenceParts.length < 2) {
          preferenceParts[1] = 1.0
        } else {
          const quality = parseFloat(preferenceParts[1])
          preferenceParts[1] = quality || 0.0
        }
        preferences[preferenceParts[0]] = preferenceParts[1]

        return preferenceParts[0]
      })
      .filter((lang) => preferences[lang] > 0)
      .sort((a, b) => preferences[b] - preferences[a])
  }
Get a sorted list of accepted languages from the HTTP Accept-Language header