mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
Trim langs from accept header
This commit is contained in:
@@ -107,7 +107,7 @@ export const randomLang = () => _.shuffle(["en-US", "nl-NL"])[0]!;
|
||||
|
||||
export const asLANGs = (acceptLanguageHeader: string | undefined) => {
|
||||
const z = acceptLanguageHeader?.split(";")[0];
|
||||
return z && z != "" ? z.split(",") : [];
|
||||
return z && z != "" ? z.split(",").map(it => it.trim()) : [];
|
||||
};
|
||||
|
||||
export type I8N = (...langs: string[]) => Lang;
|
||||
|
||||
Reference in New Issue
Block a user