Skip to content
Snippets Groups Projects
Commit 776f2ecc authored by Joao Ramia's avatar Joao Ramia
Browse files

Fix getLanguage function for the accept-language header

parent 6242b32d
No related branches found
No related tags found
No related merge requests found
......@@ -40,8 +40,9 @@ const typeDefs = `
const getLanguage = (languages = "") =>
languages
.split(",")
.map((language) => language.split("-")[0])
.split(",") // languages are comma separated
.map((language) => language.split("-")[0]) // languages may include country code 'de-DE' e.g.
.map((language) => language.split(";")[0]) // languages may include a 'de;q=0.6' e.g.
.find((language) => SUPPORTED_LANGUAGES.includes(language)) ||
DEFAULT_LANGUAGE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment