目录搜索
GuidesAccess control CORSAuthenticationBrowser detection using the user agentCachingCaching FAQCompressionConditional requestsConnection management in HTTP 1.xContent negotiationContent negotiation: List of default Accept valuesCookiesCSPMessagesOverviewProtocol upgrade mechanismProxy servers and tunnelingProxy servers and tunneling: Proxy Auto-Configuration (PAC) filePublic Key PinningRange requestsRedirectionsResources and specificationsResources and URIsResponse codesServer-Side Access ControlSessionGuides: BasicsBasics of HTTPChoosing between www and non-www URLsData URIsEvolution of HTTPIdentifying resources on the WebMIME TypesMIME types: Complete list of MIME typesCSPContent-Security-PolicyContent-Security-Policy-Report-OnlyCSP: base-uriCSP: block-all-mixed-contentCSP: child-srcCSP: connect-srcCSP: default-srcCSP: font-srcCSP: form-actionCSP: frame-ancestorsCSP: frame-srcCSP: img-srcCSP: manifest-srcCSP: media-srcCSP: object-srcCSP: plugin-typesCSP: referrerCSP: report-uriCSP: require-sri-forCSP: sandboxCSP: script-srcCSP: style-srcCSP: upgrade-insecure-requestsCSP: worker-srcHeadersAcceptAccept-CharsetAccept-EncodingAccept-LanguageAccept-RangesAccess-Control-Allow-CredentialsAccess-Control-Allow-HeadersAccess-Control-Allow-MethodsAccess-Control-Allow-OriginAccess-Control-Expose-HeadersAccess-Control-Max-AgeAccess-Control-Request-HeadersAccess-Control-Request-MethodAgeAllowAuthorizationCache-ControlConnectionContent-DispositionContent-EncodingContent-LanguageContent-LengthContent-LocationContent-RangeContent-TypeCookieCookie2DateDNTETagExpectExpiresForwardedFromHeadersHostIf-MatchIf-Modified-SinceIf-None-MatchIf-RangeIf-Unmodified-SinceKeep-AliveLarge-AllocationLast-ModifiedLocationOriginPragmaProxy-AuthenticateProxy-AuthorizationPublic-Key-PinsPublic-Key-Pins-Report-OnlyRangeRefererReferrer-PolicyRetry-AfterServerSet-CookieSet-Cookie2SourceMapStrict-Transport-SecurityTETkTrailerTransfer-EncodingUpgrade-Insecure-RequestsUser-AgentUser-Agent: FirefoxVaryViaWarningWWW-AuthenticateX-Content-Type-OptionsX-DNS-Prefetch-ControlX-Forwarded-ForX-Forwarded-HostX-Forwarded-ProtoX-Frame-OptionsX-XSS-ProtectionMethodsCONNECTDELETEGETHEADMethodsOPTIONSPATCHPOSTPUTStatus100 Continue101 Switching Protocols200 OK201 Created202 Accepted203 Non-Authoritative Information204 No Content205 Reset Content206 Partial Content300 Multiple Choices301 Moved Permanently302 Found303 See Other304 Not Modified307 Temporary Redirect308 Permanent Redirect400 Bad Request401 Unauthorized403 Forbidden404 Not Found405 Method Not Allowed406 Not Acceptable407 Proxy Authentication Required408 Request Timeout409 Conflict410 Gone411 Length Required412 Precondition Failed413 Payload Too Large414 URI Too Long415 Unsupported Media Type416 Range Not Satisfiable417 Expectation Failed426 Upgrade Required428 Precondition Required429 Too Many Requests431 Request Header Fields Too Large451 Unavailable For Legal Reasons500 Internal Server Error501 Not Implemented502 Bad Gateway503 Service Unavailable504 Gateway Timeout505 HTTP Version Not Supported511 Network Authentication RequiredStatus
文字

Content-Language 实体头用于描述旨在为观众的语言(S),使得其允许用户根据用户自己的优选语言区分。

例如,如果Content-Language: de-DE设置了“ ”,它表示该文件是用于德语的人(但是,它并不表示该文件是用德语写的,例如,它可能是用英语写成的,作为语言课程的一部分为德语人士)。

如果Content-Language未指定,则默认情况下内容适用于所有语言受众。多语言标签也是可能的,以及将Content-Language标题应用于各种媒体类型而不仅仅是文本文档。

Header type

Entity header

Forbidden header name

no

CORS-safelisted response-header

yes

CORS-safelisted request-header

yes

语法

Content-Language: de-DE
Content-Language: en-US
Content-Language: de-DE, en-CA

指令

language-tag多个语言标签用逗号分隔。每个语言标记都是一个或多个不区分大小写的子标记的序列,每个子标记都用连字符(“ -”,“ %x2D)分隔。在大多数情况下,语言标签由标识相关语言的广泛系列的主要语言子标签组成(例如“ en”=英语),可选地后跟一系列细化或缩小该语言范围的子标签(例如“ en-CA“=在加拿大传达的英语的多样性)。

注意:语言标记在 RFC 5646中形式化地定义,它继承 ISO 639标准(通常是 ISO 639-1代码列表)以用于要使用的语言代码。

例子

指示文档被写入的语言

全局lang属性用于 HTML 元素以指示整个 HTML 文档或其中一部分的语言。

<html lang="de">

千万不能使用这样这个荟萃元素说明文档语言:

<!-- /!\ This is bad practice --><meta http-equiv="content-language" content="de">

指示资源的目标受众

Content-Language头用于指定 页面的目标受众 ,并能表明这是一种以上的语言。

Content-Language: de, en

规范

Specification

Title

RFC 7231, section 3.1.3.2: Content-Language

Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content

浏览器兼容性

Feature

Chrome

Firefox

Edge

Internet Explorer

Opera

Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

Feature

Android

Chrome for Android

Edge mobile

Firefox for Android

IE mobile

Opera Android

iOS Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

上一篇:下一篇: