Skip to content

Commit

Permalink
[zh-cn] sync translated content (#21820)
Browse files Browse the repository at this point in the history
* zh-cn: sync translated content

* Remove page for unsupported Accept-CH-Lifetime header

ref: mdn/content#34313

* chore: remove the references to `Accept-CH-Lifetime`

* zh-cn: update the translations of two documents

---------

Co-authored-by: Allo <yin199909@aliyun.com>
  • Loading branch information
mdn-bot and yin1999 committed Jun 22, 2024
1 parent 21657ee commit 14e7383
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 106 deletions.
4 changes: 0 additions & 4 deletions files/zh-cn/_wikihistory.json
Original file line number Diff line number Diff line change
Expand Up @@ -22749,10 +22749,6 @@
"modified": "2020-10-15T22:24:12.153Z",
"contributors": ["xuhui98"]
},
"Web/HTTP/Headers/Accept-CH-Lifetime": {
"modified": "2020-10-15T22:25:10.809Z",
"contributors": ["chen3feng"]
},
"Web/HTTP/Headers/Accept-Charset": {
"modified": "2020-10-15T21:50:53.082Z",
"contributors": ["shinken008", "Dorllen", "WayneCui", "xgqfrms-GitHub"]
Expand Down
6 changes: 0 additions & 6 deletions files/zh-cn/web/http/content_negotiation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ HTTP/1.1 规范指定了一系列的标准标头用于启动服务端驱动型
| `Viewport-Width` | 标明用 CSS 像素数值表示的布局视口(layout viewport)宽度。 |
| `Width` | 标明用物理像素值表示的资源宽度(换句话说就是一张图片的固有大小)。 |

### `Accept-CH-Lifetime` 标头

> **备注:** 这是被称为*客户端提示***实验性**技术方案的一部分,目前仅在 Chrome 61 及以后的版本中得到了实现。
{{HTTPHeader("Accept-CH-Lifetime")}} 标头与 `Accept-CH` 标头的 `Device-Memory` 值一起使用,并指示设备应与服务器共享设备内存的时间量。该值以毫秒为单位给出,并且是可选的。

### `Accept-Encoding` 标头

{{HTTPHeader("Accept-Encoding")}} 标头明确说明了(接收端)可以接受的内容编码形式(所支持的压缩算法)。该标头的值是一个 Q 因子清单(例如 `br, gzip;q=0.8`),用来提示不同编码类型值的优先级顺序。默认值 `identity` 的优先级最低(除非声明为其他优先级)。
Expand Down
55 changes: 0 additions & 55 deletions files/zh-cn/web/http/headers/accept-ch-lifetime/index.md

This file was deleted.

2 changes: 1 addition & 1 deletion files/zh-cn/web/http/headers/accept-ch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ l10n:
</tbody>
</table>

> **备注:** 客户端提示只能在安全源(通过 TLS)上访问。所有安全的请求都应该持久化 `Accept-CH`(和 `Accept-CH-Lifetime`标头,以确保客户端提示可靠地发送。
> **备注:** 客户端提示只能在安全源(通过 TLS)上访问。所有安全的请求都应该持久化 `Accept-CH` 标头,以确保客户端提示可靠地发送。
## 语法

Expand Down
69 changes: 49 additions & 20 deletions files/zh-cn/web/http/headers/device-memory/index.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,59 @@
---
title: Device-Memory
slug: Web/HTTP/Headers/Device-Memory
l10n:
sourceCommit: 4458494807b6f4898d504b6c0af0a45f8031cbf3
---

{{HTTPSidebar}}{{securecontext_header}}{{SeeCompatTable}}

**`Device-Memory`** 是一个跟 [Device Memory API](/zh-CN/docs/Web/API/Device_Memory_API) 相关的请求头,它跟 [Client Hints](/zh-CN/docs/Glossary/Client_hints) 请求头的作用相似,用来表示客户端设备内存的近似大小。

| Header type | {{Glossary("Request header")}} |
| ------------------------------------- | ------------------------------ |
| {{Glossary("Forbidden header name")}} | ? |

> **备注:** Client Hints are accessible only on secure origins (via TLS). Server has to opt in to receive `Device-Memory` header from the client by sending {{HTTPHeader("Accept-CH")}} and {{HTTPHeader("Accept-CH-Lifetime")}} response headers.
{{HTTPSidebar}}{{securecontext_header}}

**`Device-Memory`** [设备客户端提示](/zh-CN/docs/Web/HTTP/Client_hints#设备客户端提示)请求标头的字段指示客户端设备上可用内存的近似大小。该标头属于{{DOMxRef("Device Memory API", "设备内存 API", "", "nocode")}}。

<table class="properties">
<tbody>
<tr>
<th scope="row">标头类型</th>
<td>
{{Glossary("Request header", "请求标头")}}、<a href="/zh-CN/docs/Web/HTTP/Client_hints">客户端提示</a>
</td>
</tr>
<tr>
<th scope="row">{{Glossary("Forbidden header name", "禁止修改的标头")}}</th>
<td>否</td>
</tr>
</tbody>
</table>

> **备注:**
>
> - 客户端提示仅在安全来源(通过 TLS)上可用。
> - 服务器必须通过发送 {{HTTPHeader("Accept-CH")}} 响应标头,才能接收来自客户端的 `Device-Memory` 标头。
> - 选择加入 `Device-Memory` 客户端提示的服务器通常也会在 {{HTTPHeader("Vary")}} 标头中指定它。这会通知缓存服务器:服务器可能会根据请求中的标头值发送不同的响应。
## 语法

设备的内存大小可能会被用作指纹变量,因此将这个取值设置的比较粗糙,以减少滥用它的可能性。请求头采用以下值:0.25、0.5、1、2、4、8。

```plain
```http
Device-Memory: <number>
```

## 指令

- `<number>`
- : 设备内存的近似大小。可能的值有:`0.25``0.5``1``2``4``8`

设备内存的大小可被用作{{glossary("fingerprinting", "指纹识别")}}的变量,因此标头的值故意设置得很粗略,以减小其被滥用的可能性。

## 示例

服务器需要先发送包含 `Device-Memory` 的 {{HTTPHeader("Accept-CH")}} 和 {{HTTPHeader("Accept-CH-Lifetime")}} 响应头,来表明可以接收 `Device-Memory` 请求头
服务器需要先发送包含 `Device-Memory` 的 {{HTTPHeader("Accept-CH")}} 响应标头,来选择接收 `Device-Memory` 请求标头

```plain
```http
Accept-CH: Device-Memory
Accept-CH-Lifetime: 86400
```

接下来客户端发送的请求则可能会包含 `Device-Memory` 请求头:

```plain
```http
Device-Memory: 1
```

Expand All @@ -46,8 +67,16 @@ Device-Memory: 1

## 参见

- [Device Memory API](/zh-CN/docs/Web/API/Device_Memory_API)
- {{HTTPHeader("Accept-CH")}}
- {{HTTPHeader("Accept-CH-Lifetime")}}
- {{HTTPHeader("Vary")}}
- [利用用户代理客户端提示改善用户隐私并提升开发者体验](https://developer.chrome.com/docs/privacy-security/user-agent-client-hints)(developer.chrome.com)
- {{DOMxRef("Device Memory API", "设备内存 API", "", "nocode")}}
- {{DOMxRef("Navigator.deviceMemory")}}
- {{DOMxRef("WorkerNavigator.deviceMemory")}}
- 设备客户端提示

- {{HTTPHeader("Content-DPR")}}
- {{HTTPHeader("DPR")}}
- {{HTTPHeader("Viewport-Width")}}
- {{HTTPHeader("Width")}}

- {{HTTPHeader("Accept-CH")}}
- [HTTP 缓存 > Vary 响应](/zh-CN/docs/Web/HTTP/Caching#vary_响应)和 {{HTTPHeader("Vary")}}
71 changes: 56 additions & 15 deletions files/zh-cn/web/http/headers/dpr/index.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,71 @@
---
title: DPR
slug: Web/HTTP/Headers/DPR
l10n:
sourceCommit: 4458494807b6f4898d504b6c0af0a45f8031cbf3
---

{{HTTPSidebar}}{{securecontext_header}}{{SeeCompatTable}}
{{HTTPSidebar}}{{Deprecated_Header}}{{SecureContext_Header}}{{Non-standard_Header}}

**`DPR`**请求头是“ [客户端提示”](/zh-CN/docs/Glossary/Client_hints)消息头,它代表客户端设备的像素比 ({{Glossary("DPR")}}),该比例是与每个 CSS 像素相对应的物理设备像素的数量
**`DPR`** [设备客户端提示](/zh-CN/docs/Web/HTTP/Client_hints)请求标头提供客户端设备的像素比。该比例是与每个 {{Glossary("CSS pixel", "CSS 像素")}}相对应的物理设备像素的数量

| Header type | {{Glossary("Request header")}} |
| ------------------------------------- | ------------------------------ |
| {{Glossary("Forbidden header name")}} | ? |
<table class="properties">
<tbody>
<tr>
<th scope="row">标头类型</th>
<td>
{{Glossary("Request header", "请求标头")}}、<a href="/zh-CN/docs/Web/HTTP/Client_hints">客户端提示</a>
</td>
</tr>
<tr>
<th scope="row">{{Glossary("Forbidden header name", "禁止修改的标头")}}</th>
<td>否</td>
</tr>
</tbody>
</table>

> **备注:** Client Hints are accessible only on secure origins (via TLS). Server has to opt in to receive `DPR` header from the client by sending {{HTTPHeader("Accept-CH")}} and {{HTTPHeader("Accept-CH-Lifetime")}} response headers.
在选择与屏幕像素密度最匹配的图像源时,此提示非常有用。这类似于 `<img>` [`srcset`](/zh-CN/docs/Web/HTML/Element/img#srcset) 属性中 `x` 描述符的作用,其允许用户代理选择首选图像。

如果服务器使用 `DPR` 提示来选择在响应中发送哪个资源,则响应必须包含 {{HTTPHeader("Content-DPR")}} 标头。如果 `Content-DPR` 的值与请求的 `DPR` 标头中的值不同,客户端必须使用 `Content-DPR` 的值进行布局。

如果 `DPR` 标头出现在消息中多次,则使用最后一次出现的值。

> **备注:**
>
> - 客户端提示仅在安全来源(通过 TLS)上可用。
> - 服务器必须通过发送包含 `DPR` 的 {{HTTPHeader("Accept-CH")}} 响应标头,才能接收来自客户端的 `DPR` 标头。
> - 选择加入 `DPR` 客户端提示的服务器通常也会在 {{HTTPHeader("Vary")}} 标头中指定它。这会通知缓存服务器,服务器可能会根据请求中的标头值发送不同的响应。
> -[draft-ietf-httpbis-client-hints-07](https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-client-hints-07) 中,客户端提示规范已经移除了 `DPR`。建议的替代方案是 [`Sec-CH-DPR`](https://wicg.github.io/responsive-image-client-hints/#sec-ch-dpr)(响应式图像客户端提示)。
## 语法

```plain
```http
DPR: <number>
```

## 指令

- `<number>`
- : 客户端设备的像素比。

## 示例

Server first needs to opt in to receive `DPR` header by sending the response headers {{HTTPHeader("Accept-CH")}} containing `DPR` and {{HTTPHeader("Accept-CH-Lifetime")}}.
服务器必须首先通过发送包含 `DPR` 指令的 {{HTTPHeader("Accept-CH")}} 响应标头来选择接收 `DPR` 标头。

```plain
```http
Accept-CH: DPR
Accept-CH-Lifetime: 86400
```

Then on subsequent requests the client might send `DPR` header back:
然后,在后续请求中,客户端可能会将 `DPR` 标头发送到服务器:

```plain
DPR: 1.0
```http
DPR: 2.0
```

如果带有 `DPR` 标头(如上所示)的请求是针对图像资源的,则服务器响应必须包含 {{HTTPHeader("Content-DPR")}} 标头:

```http
Content-DPR: 2.0
```

## 浏览器兼容性
Expand All @@ -40,6 +74,13 @@ DPR: 1.0

## 参见

- [利用用户代理客户端提示改善用户隐私并提升开发者体验](https://developer.chrome.com/docs/privacy-security/user-agent-client-hints)(developer.chrome.com)
- 设备客户端提示

- {{HTTPHeader("Content-DPR")}}
- {{HTTPHeader("Device-Memory")}}
- {{HTTPHeader("Viewport-Width")}}
- {{HTTPHeader("Width")}}

- {{HTTPHeader("Accept-CH")}}
- {{HTTPHeader("Accept-CH-Lifetime")}}
- {{HTTPHeader("Vary")}}
- [HTTP 缓存 > Vary 响应](/zh-CN/docs/Web/HTTP/Caching#vary_响应)和 {{HTTPHeader("Vary")}}
8 changes: 3 additions & 5 deletions files/zh-cn/web/http/headers/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: HTTP 标头(header)
title: HTTP 标头
slug: Web/HTTP/Headers
---

Expand Down Expand Up @@ -67,11 +67,9 @@ HTTP [客户端提示](/zh-CN/docs/Web/HTTP/Client_hints)是一组请求标头
服务器使用 {{HTTPHeader("Accept-CH")}} 主动向客户端请求它们感兴趣的客户端提示标头。客户端可以选择在后续的请求中包含请求的标头。

- {{HTTPHeader("Accept-CH")}} {{experimental_inline}}
- : 服务器可以使用 `Accept-CH` 标头字段或具有 [`http-equiv`](/zh-CN/docs/Web/HTML/Element/meta#attr-http-equiv) 属性的等效 HTML `<meta>` 元素来宣告对客户端提示的支持。
- {{HTTPHeader("Accept-CH-Lifetime")}} {{experimental_inline}} {{deprecated_inline}}
- : 服务器可以要求客户端记住服务器在指定时间段内支持的客户端提示集合,以便在后续请求到服务器源站时能够传送客户端提示。
- : 服务器可以使用 `Accept-CH` 标头字段或具有 [`http-equiv`](/zh-CN/docs/Web/HTML/Element/meta#http-equiv) 属性的等效 HTML `<meta>` 元素来宣告对客户端提示的支持。
- {{HTTPHeader("Critical-CH")}} {{experimental_inline}}
- : 服务器使用 `Critical-CH` 和 {{HttpHeader("Accept-CH")}} 来指定接受的客户端提示,也是[重要的客户端提示](/zh-CN/docs/Web/HTTP/Client_hints#critical_client_hints)
- : 服务器使用 `Critical-CH` 和 {{HttpHeader("Accept-CH")}} 来指定接受的客户端提示,也是[重要的客户端提示](/zh-CN/docs/Web/HTTP/Client_hints#重要客户端提示)

下面列出了不同类别的客户端提示。

Expand Down

0 comments on commit 14e7383

Please sign in to comment.