从 Astro 中的请求获取浏览器语言

问题描述 投票:0回答:1

我已经看到你可以从 Astro 中的请求中获取 http 标头信息,如下所示

Astro.request.headers.get('cookie')
。但是,我找不到从标题中获取语言信息以返回特定语言路由的方法。也许有些事情我不明白。预先感谢!

http http-headers astrojs
1个回答
0
投票

如果您使用默认的

static
模式,
Astro.request
不能包含每个新用户请求的动态标头。

所以你的实现方式只能适用于动态渲染。

© www.soinside.com 2019 - 2024. All rights reserved.