Files
codebase-memory-mcp/graph-ui/src
lukiod e5c3200f43 fix(graph-ui): rank Accept-Language by q instead of substring match
detectLanguage tested whether "zh" appeared anywhere in the header, so any
visitor whose Accept-Language mentions Chinese got the Chinese UI regardless of
preference.

    en-US,en;q=0.9,zh;q=0.5  ->  zh, expected en
    zh;q=0, en               ->  zh, expected en

The first is a bilingual visitor who prefers English and lists Chinese as a
fallback. The second sets q=0, which RFC 7231 defines as not acceptable.

Now parses q, drops q=0, sorts descending, and matches the primary subtag rather
than a substring. Chinese still wins whenever it is actually preferred.

The two existing assertions are unchanged and still pass.

Signed-off-by: lukiod <mohakgupta0981@gmail.com>
2026-07-28 08:50:52 +05:30
..