CINXE.COM
Language Tags and Locale Identifiers for the World Wide Web
<!DOCTYPE html><html dir="ltr" lang="en"><head> <meta charset="utf-8"> <meta name="generator" content="ReSpec 25.16.5"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <style> span.example-title{text-transform:none} aside.example,div.example,div.illegal-example{padding:.5em;margin:1em 0;position:relative;clear:both} div.illegal-example{color:red} div.illegal-example p{color:#000} aside.example,div.example{padding:.5em;border-left-width:.5em;border-left-style:solid;border-color:#e0cb52;background:#fcfaee} aside.example div.example{border-left-width:.1em;border-color:#999;background:#fff} aside.example div.example span.example-title{color:#999} </style> <style> .issue-label{text-transform:initial} .warning>p:first-child{margin-top:0} .warning{padding:.5em;border-left-width:.5em;border-left-style:solid} span.warning{padding:.1em .5em .15em} .issue.closed span.issue-number{text-decoration:line-through} .warning{border-color:#f11;border-width:.2em;border-style:solid;background:#fbe9e9} .warning-title:before{content:"⚠";font-size:1.3em;float:left;padding-right:.3em;margin-top:-.3em} li.task-list-item{list-style:none} input.task-list-item-checkbox{margin:0 .35em .25em -1.6em;vertical-align:middle} .issue a.respec-gh-label{padding:5px;margin:0 2px 0 2px;font-size:10px;text-transform:none;text-decoration:none;font-weight:700;border-radius:4px;position:relative;bottom:2px;border:none;display:inline-block} </style> <style> dfn{cursor:pointer} .dfn-panel{position:absolute;z-index:35;min-width:300px;max-width:500px;padding:.5em .75em;margin-top:.6em;font:small Helvetica Neue,sans-serif,Droid Sans Fallback;background:#fff;color:#000;box-shadow:0 1em 3em -.4em rgba(0,0,0,.3),0 0 1px 1px rgba(0,0,0,.05);border-radius:2px} .dfn-panel:not(.docked)>.caret{position:absolute;top:-9px} .dfn-panel:not(.docked)>.caret::after,.dfn-panel:not(.docked)>.caret::before{content:"";position:absolute;border:10px solid transparent;border-top:0;border-bottom:10px solid #fff;top:0} .dfn-panel:not(.docked)>.caret::before{border-bottom:9px solid #a2a9b1} .dfn-panel *{margin:0} .dfn-panel b{display:block;color:#000;margin-top:.25em} .dfn-panel ul a[href]{color:#333} .dfn-panel a.self-link{font-weight:700} .dfn-panel .dfn-exported{float:right;padding:.1em;border-radius:.2em;text-align:center;white-space:nowrap;font-size:90%;background:#d1edfd;color:#040b1c;box-shadow:0 0 0 .125em #1ca5f940} .dfn-panel a:not(:hover){text-decoration:none!important;border-bottom:none!important} .dfn-panel a[href]:hover{border-bottom-width:1px} .dfn-panel ul{padding:0} .dfn-panel li{margin-left:1em} .dfn-panel.docked{position:fixed;left:.5em;top:unset;bottom:2em;margin:0 auto;max-width:calc(100vw - .75em * 2 - .5em - .2em * 2);max-height:30vh;overflow:auto} </style> <title>Language Tags and Locale Identifiers for the World Wide Web</title> <link rel="stylesheet" href="local.css"> <style id="respec-mainstyle"> @keyframes pop{ 0%{transform:scale(1,1)} 25%{transform:scale(1.25,1.25);opacity:.75} 100%{transform:scale(1,1)} } .hljs{background:0 0!important} a abbr,h1 abbr,h2 abbr,h3 abbr,h4 abbr,h5 abbr,h6 abbr{border:none} dfn{font-weight:700} a.internalDFN{color:inherit;border-bottom:1px solid #99c;text-decoration:none} a.externalDFN{color:inherit;border-bottom:1px dotted #ccc;text-decoration:none} a.bibref{text-decoration:none} .respec-offending-element:target{animation:pop .25s ease-in-out 0s 1} .respec-offending-element,a[href].respec-offending-element{text-decoration:red wavy underline} @supports not (text-decoration:red wavy underline){ .respec-offending-element:not(pre){display:inline-block} .respec-offending-element{background:url(data:image/gif;base64,R0lGODdhBAADAPEAANv///8AAP///wAAACwAAAAABAADAEACBZQjmIAFADs=) bottom repeat-x} } #references :target{background:#eaf3ff;animation:pop .4s ease-in-out 0s 1} cite .bibref{font-style:normal} code{color:#c63501} th code{color:inherit} a[href].orcid{padding-left:4px;padding-right:4px} a[href].orcid>svg{margin-bottom:-2px} .toc a,.tof a{text-decoration:none} a .figno,a .secno{color:#000} ol.tof,ul.tof{list-style:none outside none} .caption{margin-top:.5em;font-style:italic} table.simple{border-spacing:0;border-collapse:collapse;border-bottom:3px solid #005a9c} .simple th{background:#005a9c;color:#fff;padding:3px 5px;text-align:left} .simple th a{color:#fff;padding:3px 5px;text-align:left} .simple th[scope=row]{background:inherit;color:inherit;border-top:1px solid #ddd} .simple td{padding:3px 10px;border-top:1px solid #ddd} .simple tr:nth-child(even){background:#f0f6ff} .section dd>p:first-child{margin-top:0} .section dd>p:last-child{margin-bottom:0} .section dd{margin-bottom:1em} .section dl.attrs dd,.section dl.eldef dd{margin-bottom:0} #issue-summary>ul,.respec-dfn-list{column-count:2} #issue-summary li,.respec-dfn-list li{list-style:none} details.respec-tests-details{margin-left:1em;display:inline-block;vertical-align:top} details.respec-tests-details>*{padding-right:2em} details.respec-tests-details[open]{z-index:999999;position:absolute;border:thin solid #cad3e2;border-radius:.3em;background-color:#fff;padding-bottom:.5em} details.respec-tests-details[open]>summary{border-bottom:thin solid #cad3e2;padding-left:1em;margin-bottom:1em;line-height:2em} details.respec-tests-details>ul{width:100%;margin-top:-.3em} details.respec-tests-details>li{padding-left:1em} a[href].self-link:hover{opacity:1;text-decoration:none;background-color:transparent} h2,h3,h4,h5,h6{position:relative} aside.example .marker>a.self-link{color:inherit} h2>a.self-link,h3>a.self-link,h4>a.self-link,h5>a.self-link,h6>a.self-link{border:none;color:inherit;font-size:83%;height:2em;left:-1.6em;opacity:.5;position:absolute;text-align:center;text-decoration:none;top:0;transition:opacity .2s;width:2em} h2>a.self-link::before,h3>a.self-link::before,h4>a.self-link::before,h5>a.self-link::before,h6>a.self-link::before{content:"§";display:block} @media (max-width:767px){ dd{margin-left:0} h2>a.self-link,h3>a.self-link,h4>a.self-link,h5>a.self-link,h6>a.self-link{left:auto;top:auto} } @media print{ .removeOnSave{display:none} } </style> <meta name="description" content="This document provides definitions and best practices related to the identification of the natural language of content in document formats, specifications, and implementations on the Web. It describes how language tags are used to indicate a user's locale preferences which, in turn, are used to process, format, and display information to the user."> <link rel="canonical" href="https://www.w3.org/TR/ltli/"> <style> .hljs{display:block;overflow-x:auto;padding:.5em;color:#383a42;background:#fafafa} .hljs-comment,.hljs-quote{color:#717277;font-style:italic} .hljs-doctag,.hljs-formula,.hljs-keyword{color:#a626a4} .hljs-deletion,.hljs-name,.hljs-section,.hljs-selector-tag,.hljs-subst{color:#ca4706;font-weight:700} .hljs-literal{color:#0b76c5} .hljs-addition,.hljs-attribute,.hljs-meta-string,.hljs-regexp,.hljs-string{color:#42803c} .hljs-built_in,.hljs-class .hljs-title{color:#9a6a01} .hljs-attr,.hljs-number,.hljs-selector-attr,.hljs-selector-class,.hljs-selector-pseudo,.hljs-template-variable,.hljs-type,.hljs-variable{color:#986801} .hljs-bullet,.hljs-link,.hljs-meta,.hljs-selector-id,.hljs-symbol,.hljs-title{color:#336ae3} .hljs-emphasis{font-style:italic} .hljs-strong{font-weight:700} .hljs-link{text-decoration:underline} </style> <style> var{position:relative;cursor:pointer} var[data-type]::after,var[data-type]::before{position:absolute;left:50%;top:-6px;opacity:0;transition:opacity .4s;pointer-events:none} var[data-type]::before{content:"";transform:translateX(-50%);border-width:4px 6px 0 6px;border-style:solid;border-color:transparent;border-top-color:#000} var[data-type]::after{content:attr(data-type);transform:translateX(-50%) translateY(-100%);background:#000;text-align:center;font-family:"Dank Mono","Fira Code",monospace;font-style:normal;padding:6px;border-radius:3px;color:#daca88;text-indent:0;font-weight:400} var[data-type]:hover::after,var[data-type]:hover::before{opacity:1} </style> <script id="initialUserConfig" type="application/json">{ "specStatus": "WD", "edDraftURI": "https://w3c.github.io/ltli/", "shortName": "ltli", "editors": [ { "name": "Addison Phillips", "company": "Amazon.com", "w3cid": 33573 }, { "name": "Felix Sasaki", "company": "Invited Expert" } ], "noRecTrack": true, "group": "i18n", "github": "w3c/ltli", "localBiblio": { "CLDR": { "title": "Common Locale Data Repository", "href": "http://cldr.unicode.org", "publisher": "Unicode", "id": "cldr" }, "LDML": { "title": "Unicode Technical Standard #35: Locale Data Markup Language", "href": "https://www.unicode.org/reports/tr35/", "publisher": "Unicode", "authors": [ "Mark Davis", "CLDR Contributors" ], "id": "ldml" } }, "publishDate": "2020-10-07", "previousMaturity": "WD", "previousPublishDate": "2015-04-23", "publishISODate": "2020-10-07T00:00:00.000Z", "generatedSubtitle": "Working Draft 07 October 2020" }</script> <link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/2016/W3C-WD"></head> <body class="h-entry informative"><div class="head"> <a class="logo" href="https://www.w3.org/"><img alt="W3C" width="72" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C"></a> <h1 id="title" class="title">Language Tags and Locale Identifiers for the World Wide Web</h1> <h2> W3C Working Draft <time class="dt-published" datetime="2020-10-07">07 October 2020</time> </h2> <dl> <dt>This version:</dt><dd> <a class="u-url" href="https://www.w3.org/TR/2020/WD-ltli-20201007/">https://www.w3.org/TR/2020/WD-ltli-20201007/</a> </dd><dt>Latest published version:</dt><dd> <a href="https://www.w3.org/TR/ltli/">https://www.w3.org/TR/ltli/</a> </dd> <dt>Latest editor's draft:</dt><dd><a href="https://w3c.github.io/ltli/">https://w3c.github.io/ltli/</a></dd> <dt>Previous version:</dt><dd><a href="https://www.w3.org/TR/2015/WD-ltli-20150423/">https://www.w3.org/TR/2015/WD-ltli-20150423/</a></dd> <dt>Editors:</dt> <dd class="p-author h-card vcard" data-editor-id="33573"><span class="p-name fn">Addison Phillips</span> (Amazon.com) </dd><dd class="p-author h-card vcard"><span class="p-name fn">Felix Sasaki</span> (Invited Expert) </dd> <dt>Participate:</dt><dd> <a href="https://github.com/w3c/ltli/">GitHub w3c/ltli</a> </dd><dd> <a href="https://github.com/w3c/ltli/issues/">File a bug</a> </dd><dd> <a href="https://github.com/w3c/ltli/commits/gh-pages">Commit history</a> </dd><dd> <a href="https://github.com/w3c/ltli/pulls/">Pull requests</a> </dd> </dl> <p class="copyright"> <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2020 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="https://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a rel="license" href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">permissive document license</a> rules apply. </p> <hr title="Separator for header"> </div> <section id="abstract" class="introductory"><h2>Abstract</h2> <p>This document provides definitions and best practices related to the identification of the natural language of content in document formats, specifications, and implementations on the Web. It describes how language tags are used to indicate a user's locale preferences which, in turn, are used to process, format, and display information to the user.</p> </section> <section id="sotd" class="introductory"><h2>Status of This Document</h2><p><em>This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision of this technical report can be found in the <a href="https://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports index</a> at https://www.w3.org/TR/.</em></p> <p>This is an updated Public Working Draft of "Language Tags and Locale Identifiers for the World Wide Web". The Working Group expects this to become a Working Group Note.</p> <div class="note" role="note" id="issue-container-generatedID"><div role="heading" class="note-title marker" id="h-note" aria-level="3"><span>Note</span></div><p class="">If you wish to make comments regarding this document, please <a href="https://github.com/w3c/ltli/issues" style="font-size: 120%;">raise a github issue</a>. You may also send email to the list <a href="mailto:www-international@w3.org?subject=%5Bltli%5D%20">www-international@w3.org</a> (<a href="mailto:www-international@w3.org?subject=subscribe">subscribe</a>, <a href="https://lists.w3.org/Archives/Public/www-international/">archives</a>) as mentioned below. Please include <q>[ltli]</q> at the start of your email's subject. To make it easier to track comments, please raise separate issues or send separate emails for each comment. All comments are welcome.</p></div> <p> This document was published by the <a href="https://www.w3.org/International/core/">Internationalization Working Group</a> as a Working Draft. </p><p> <a href="https://github.com/w3c/ltli/issues/">GitHub Issues</a> are preferred for discussion of this specification. </p><p> Publication as a Working Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership. </p><p>This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. </p><p></p><p> This document was produced by a group operating under the <a href="https://www.w3.org/Consortium/Patent-Policy-20170801/">1 August 2017 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. The group does not expect this document to become a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation. <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a rel="disclosure" href="https://www.w3.org/2004/01/pp-impl/32113/status">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy-20170801/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy-20170801/#sec-Disclosure">section 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. </p><p> This document is governed by the <a id="w3c_process_revision" href="https://www.w3.org/2020/Process-20200915/">15 September 2020 <abbr title="World Wide Web Consortium">W3C</abbr> Process Document</a>. </p></section><nav id="toc"><h2 class="introductory" id="table-of-contents">Table of Contents</h2><ol class="toc"><li class="tocline"><a class="tocxref" href="#introduction"><bdi class="secno">1. </bdi>Introduction</a></li><li class="tocline"><a class="tocxref" href="#language-terminology"><bdi class="secno">2. </bdi>Languages and Language Tags</a></li><li class="tocline"><a class="tocxref" href="#i18n-terminology"><bdi class="secno">3. </bdi>Locales and Internationalization</a></li><li class="tocline"><a class="tocxref" href="#further-reading"><bdi class="secno">4. </bdi>Further Reading</a></li><li class="tocline"><a class="tocxref" href="#revisionlog"><bdi class="secno">A. </bdi>Revision Log</a></li><li class="tocline"><a class="tocxref" href="#acknowledgements"><bdi class="secno">B. </bdi>Acknowledgements</a></li><li class="tocline"><a class="tocxref" href="#references"><bdi class="secno">C. </bdi>References</a><ol class="toc"><li class="tocline"><a class="tocxref" href="#informative-references"><bdi class="secno">C.1 </bdi>Informative references</a></li></ol></li></ol></nav> <section id="introduction"> <h2 id="x1-introduction"><bdi class="secno">1. </bdi>Introduction<a class="self-link" aria-label="§" href="#introduction"></a></h2> <p>Language tags and locales are some of the fundamental building blocks of <a href="#internationalization" class="internalDFN" data-link-type="dfn" id="ref-for-internationalization-1">internationalization</a> (<q><a href="#internationalization" class="internalDFN" data-link-type="dfn" id="ref-for-internationalization-2">i18n</a></q>) of the Web. In this document you will find definitions for much of the basic terminology related to this aspect of <a href="#internationalization" class="internalDFN" data-link-type="dfn" id="ref-for-internationalization-3">internationalization</a>.</p> <p>This document also provides terminology and best practices needed by specification authors for the identification of <a href="#dfn-natural-language" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-natural-language-1">natural language</a> values in document formats or protocols and which are recommended by the Internationalization (I18N) Working Group. These (and many other) best practices, along with links to supporting materials, can also be found in the <cite>Internationalization Best Practices for Spec Developers</cite> [<cite><a class="bibref" data-link-type="biblio" href="#bib-international-specs" title="Internationalization Best Practices for Spec Developers">INTERNATIONAL-SPECS</a></cite>]. In addition to the best practices found here, additional best practices relating to language metadata on the Web can be found in [<cite><a class="bibref" data-link-type="biblio" href="#bib-string-meta" title="Strings on the Web: Language and Direction Metadata">STRING-META</a></cite>].</p> <div class="note" role="note" id="issue-container-generatedID-0"><div role="heading" class="note-title marker" id="h-note-0" aria-level="3"><span>Note</span></div><aside class=""> <p>In this document [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc2119" title="Key words for use in RFCs to Indicate Requirement Levels">RFC2119</a></cite>] keywords have their usual meaning. Best practices and definitions are set off from the remainder of the text with special formatting.</p> <p class="advisement">Best practices appear with a different background color and decoration like this.</p> <p class="definition">Definitions appear with a different background color and decoration like this.</p> <p class="issue-example">Gaps or recommendations for future work appear with a different background color and decoration like this.</p> </aside></div> </section> <section id="language-terminology"> <h2 id="x2-languages-and-language-tags"><bdi class="secno">2. </bdi>Languages and Language Tags<a class="self-link" aria-label="§" href="#language-terminology"></a></h2> <p>Tags for identifying the <a href="#dfn-natural-language" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-natural-language-2">natural language</a> of content or the <a href="#international-preferences" class="internalDFN" data-link-type="dfn" id="ref-for-international-preferences-1">international preferences</a> of users are one of the fundamental building blocks of the Web. The <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-1">language tags</a> found in Web and Internet formats and protocols are defined by [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>]. Consistent use of language tags provides applications the ability to perform language-specific formatting or processing. For example, a user-agent might use the language to select an appropriate font for displaying text or a Web page designer might style text differently in one language than in another.</p> <p>Many of the core standards for the Web include support for <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-2">language tags</a>; these include the <code>xml:lang</code> attribute in [<cite><a class="bibref" data-link-type="biblio" href="#bib-xml10" title="Extensible Markup Language (XML) 1.0 (Fifth Edition)">XML10</a></cite>], the <code>lang</code> and <code>hreflang</code> atttributes in [<cite><a class="bibref" data-link-type="biblio" href="#bib-html" title="HTML Standard">HTML</a></cite>], the <code>language</code> property in [<cite><a class="bibref" data-link-type="biblio" href="#bib-xsl10" title="Extensible Stylesheet Language (XSL) Version 1.0">XSL10</a></cite>], and the <code>:lang</code> pseudo-class in CSS [<cite><a class="bibref" data-link-type="biblio" href="#bib-css3-selectors" title="Selectors Level 3">CSS3-SELECTORS</a></cite>], and many others, including SVG, TTML, SSML, etc.</p> <p class="definition"><dfn data-lt="natural language|language|Natural Language" id="dfn-natural-language">Natural Language</dfn> (or, in this document, just <em>language</em>). The spoken, written, or signed communications used by human beings.</p> <p>There are many ways that languages might be identified and many reasons that software might need to identify the language of content on the Web. Document formats and protocols on the Web generally use the identifiers used in most other parts of the Internet, consisting of the language tags defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>]. "BCP" nomenclature refers to the current set of IETF RFCs that form the "best current practice".</p> <p class="definition"><dfn data-lt="language tag|language tags|Language tag" id="dfn-language-tag">Language tag</dfn>. A string used as an identifier for a language. In this document, the term <em>language tag</em> always refers explicitly to a [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] language tag. These language tags consist of one or more subtags.</p> <p class="advisement" id="ltli-bcp47-refer"><a class="self" href="#ltli-bcp47-refer"></a>Specifications for the Web that require language identification <em class="rfc2119">MUST</em> refer to [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>]. </p> <p class="advisement" id="ltli-no-rfc-refs"><a href="#ltli-no-rfc-refs" class="self"></a>Specifications <em class="rfc2119">SHOULD NOT</em> refer to specific component RFCs of [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>].</p> <p>[<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] is a multipart document consisting, at the time this document was published, of two separate RFCs. The first part, called <em>Tags for Identifying Languages</em> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc5646" title="Tags for Identifying Languages">RFC5646</a></cite>], defines the grammar, form, and terminology of language tags. The second part, called <em>Matching of Language Tags</em> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4647" title="Matching of Language Tags">RFC4647</a></cite>], describes several schemes for matching, comparing, and selecting content using language tags and includes useful terminology related to comparison of language preferences to tagged content. </p> <p class="advisement" id="ltli-successor-ref"><a href="#ltli-successor-ref" class="self"></a>Formulations such as "<span class="quote">RFC 5646 or its successor</span>" <em class="rfc2119">MAY</em> be used, but only in cases where the specific document version is necessary.</p> <p>While this style of reference was once popular, using the BCP reference is more accurate. Since the grammar of language tags has been fixed since [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4646" title="Tags for Identifying Languages">RFC4646</a></cite>], referring to the BCP will not incur additional compliance risk to most implementations.</p> <p class="advisement" id="ltli-no-obsolete-refs"><a href="#ltli-no-obsolete-refs" class="self"></a>Specifications <em class="rfc2119">MUST NOT</em> reference obsolete versions of [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>], such as [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc1766" title="Tags for the Identification of Languages">RFC1766</a></cite>] or [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc3066" title="Tags for the Identification of Languages">RFC3066</a></cite>].</p> <p class="advisement" id="ltli-obs-language-tag-ref"><a href="#ltli-obs-language-tag-ref" class="self"></a>Specifications that need to preserve compatibility with obsolete versions of [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] <em class="rfc2119">MUST</em> reference the production <code>obs-language-tag</code> in [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>].</p> <p>Beginning with [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4646" title="Tags for Identifying Languages">RFC4646</a></cite>], [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] defined a more complex, machine-readable syntax for language tags. This syntax is stable and is not expected to change in the foreseeable future. Some specifications might desire or require compatibility with the older language tag grammar found in previous versions of BCP47 (specifically [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc1766" title="Tags for the Identification of Languages">RFC1766</a></cite>] and [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc3066" title="Tags for the Identification of Languages">RFC3066</a></cite>]). This grammar was more permissive and is described in [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] as the ABNF production <code>obs-language-tag</code>. [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4646" title="Tags for Identifying Languages">RFC4646</a></cite>], which introduced the current grammar for language tags, was replaced by [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc5646" title="Tags for Identifying Languages">RFC5646</a></cite>] as part of the current [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>].</p> <p class="advisement" id="ltli-language-information-in-uris-req"><a href="#ltli-language-information-in-uris-req" class="self"></a>Applications that provide language information as part of URIs (e.g. in the realm of RDF) <em class="rfc2119">SHOULD</em> use [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>].</p> <p>Currently, URIs expressing language information often use values from parts of ISO 639. This leads to situations in which there are ambiguities about what the proper value should be, e.g. for German <code>de</code> from ISO 639-1 or <code>ger</code> from ISO 639-2. By using BCP 47 and its language sub tag registry, such ambiguities can be avoided, e.g. for German, the registry contains only <code>de</code>.</p> <p class="definition"><dfn data-lt="subtag|subtags|Subtag" id="dfn-subtag">Subtag</dfn>. A sequence of ASCII letters or digits separated from other subtags by the hyphen-minus character and identifying a specific element of meaning withing the overall <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-3">language tag</a>. In [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>], subtags can consist of upper or lowercase ASCII letters (the case carries no distinction) or ASCII digits. Subtags are limited to no more than eight characters (although additional length restrictions apply depending on the specific use of the subtag).</p> <p>Selecting content or behavior based on the language tag requires a few additional concepts defined by [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] (in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4647" title="Matching of Language Tags">RFC4647</a></cite>]). In this document, we adopt the following terminology taken directly from [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>]:</p> <p class="definition"><dfn data-lt="iana language subtag registry|subtag registry|registry|lstr|IANA Language Subtag Registry" id="dfn-iana-language-subtag-registry">IANA Language Subtag Registry</dfn>. A machine-readable text file available via IANA which contains a comprehensive list of all of the subtags valid in language tags. (Link: <a href="https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry">Registry</a>)</p> <p class="advisement" id="ltli-no-subsidiary-stds"><a href="#ltli-no-subsidiary-stds" class="self"></a>Specifications <em class="rfc2119">SHOULD NOT</em> reference [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>]'s underlying standards that contribute to the <a href="#dfn-iana-language-subtag-registry" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-iana-language-subtag-registry-1">IANA Language Subtag Registry</a>, such as ISO639, ISO15924, ISO3066, or UN M.49.</p> <p>Some standards might directly consume one of [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>]'s contributory standards, in which case a reference is wholly appropriate. However, in most cases, the purpose of the reference is to specify a valid list of codes and their meanings. [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>]'s <a href="#dfn-iana-language-subtag-registry" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-iana-language-subtag-registry-2">subtag registry</a> is stabilized and resolves ambiguity in a number of useful ways and so should be the preferred source for this type of reference.</p> <p>[<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] defines two different levels of conformance. See <a href="https://tools.ietf.org/html/bcp47#section-2.2.9">classes of conformance</a> in [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] for specifics. For language tags, the levels of conformance correspond to type of checking that an implementation applies to language tag values.</p> <p class="definition"><dfn data-lt="well-formed|well-formed language tag|well-formed language tags|Well-formed language tag" id="dfn-well-formed">Well-formed language tag</dfn>. A language tag that follows the grammar defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>]. That is, it is structurally correct, consisting of ASCII letters and digit <a href="#dfn-subtag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-subtag-1">subtags</a> of the prescribed length, separated by hyphens.</p> <p class="definition"><dfn data-lt="valid|valid language tag|valid language tags|Valid language tag" id="dfn-valid">Valid language tag</dfn>. A language tag that is <a href="#dfn-well-formed" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-well-formed-1">well-formed</a> and which also conforms to the additional <a href="https://tools.ietf.org/html/bcp47#section-2.2.9">conformance requirements</a> in [BCP47], notably that each of the subtags appears in the IANA Language Subtag Registry.</p> <p class="advisement" id="ltli-well-formed-req"><a href="#ltli-well-formed-req" class="self"></a>Specifications <em class="rfc2119">SHOULD</em> require that language tags be <a href="#dfn-well-formed" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-well-formed-2">well-formed</a>.</p> <p class="advisement" id="ltli-valid-req"><a href="#ltli-valid-req" class="self"></a>Specifications <em class="rfc2119">MAY</em> require that language tags be <a href="#dfn-valid" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-valid-1">valid</a>.</p> <p class="advisement" id="ltli-valid-content-req"><a href="#ltli-valid-content-req" class="self"></a>Specifications <em class="rfc2119">SHOULD</em> require that content authors use <a href="#dfn-valid" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-valid-2">valid language tags</a>.</p> <p>Note that this is stricter than what is recommended for implementations.</p> <p class="advisement" id="ltli-validator-req"><a href="#ltli-validator-req" class="self"></a>Content validators <em class="rfc2119">SHOULD</em> check if content uses <a href="#dfn-valid" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-valid-3">valid language tags</a> where feasible.</p> <p>Checking if a tag is <a href="#dfn-valid" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-valid-4">valid</a> requires access to or a copy of the <a href="#dfn-iana-language-subtag-registry" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-iana-language-subtag-registry-3">registry</a> plus additional runtime logic. While content authors are advised to choose, generate, and exchange only valid values, language tag matching and other common language tag operations are designed so that validity checking is not needed. Features or functions that need to understand the specific semantic content of subtags are the main reason that a specification would normatively require <a href="#dfn-valid" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-valid-5">valid</a> tags as part of the protocol or document format.</p> <p class="definition"><dfn data-lt="language tag extension|extension|extensions|registered extension|Language tag extension" data-plurals="language tag extensions" id="dfn-language-tag-extension">Language tag extension</dfn> or <em>extension</em>. A system of additional [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] subtags introduced by a single letter or digit subtag registered with IANA and permitting additional types of language identification.</p> <p class="advisement" id="ltli-bcp47-extension-ref"><a href="#ltli-bcp47-extension-ref" class="self"></a>Specifications <em class="rfc2119">MAY</em> reference registered extensions to [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] as necessary.</p> <p>In particular, [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc6067" title="BCP 47 Extension U">RFC6067</a></cite>] defines the <cite>BCP 47 Extension U</cite>, also known as "Unicode Locales". This extension to [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] provides additional subtag sequences for selecting specific locale variations.</p> <p class="advisement" id="ltli-keep-extensions"><a class="self" href="#ltli-keep-extensions"></a>Specifications <em class="rfc2119">SHOULD NOT</em> restrict the length of language tags or permit or encourage the removal of extensions.</p> <p class="definition"><dfn data-lt="language range|range|language-range|language ranges|Language range" id="dfn-language-range">Language range</dfn>. A string similar in structure to a language tag that is used for "identifying sets of language tags that share specific attributes".</p> <p class="definition"><dfn data-plurals="language priority lists" id="dfn-language-priority-list">Language priority list</dfn>. A collection of one or more <a href="#dfn-language-range" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-range-1">language ranges</a> identifying the user's language preferences for use in matching. As the name suggests, such lists are normally ordered or weighted according to the user's preferences. The HTTP [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc2616" title="Hypertext Transfer Protocol -- HTTP/1.1">RFC2616</a></cite>] <code>Accept-Language</code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc3282" title="Content Language Headers">RFC3282</a></cite>] header is an example of one kind of language priority list.</p> <p class="definition"><dfn data-lt="basic language range|Basic language range" id="dfn-basic-language-range">Basic language range</dfn>. A <a href="#dfn-language-range" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-range-2">language range</a> consisting of a sequence of subtags separated by hyphens. That is, it is identical in appearance to a language tag.</p> <p class="definition"><dfn id="dfn-extended-language-range">Extended language range</dfn>. A <a href="#dfn-language-range" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-range-3">language range</a> consisting of a sequence of hyphen-separated subtags. In an extended language range, a subtag can either be a valid subtag or the wildcard subtag <q><code>*</code></q>, which matches any value.</p> <aside class="example" id="example-1"><div class="marker"> <a class="self-link" href="#example-1">Example<bdi> 1</bdi></a> </div> <p>Basic versus extended language range and language priority list</p> <p>The string <code>de-de</code> is a basic language range. It matches, for example, the language tag <code>de-DE-1996</code>, but not the language tag <code>de-Deva</code>.</p> <p>The string <code>de-*-DE</code> is an extended language range. It matches all of the following tags:</p> <ul> <li> <p><code>de-DE</code></p> </li> <li> <p><code>de-DE-x-goethe</code></p> </li> <li> <p><code>de-Latn-DE-1996</code></p> </li> </ul> <p><code>"en; fr; zh-Hant"</code> is a language priority list. It would be read as "<span class="quote">English before French before Chinese as written in the Traditional script</span>". Note that the syntax shown is only an example, since it depends on the protocol, application, or implementation that uses the list.</p> </aside> <p>Some <a href="#dfn-language-priority-list" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-priority-list-1">language priority lists</a>, such as the <code>Accept-Language</code> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc3282" title="Content Language Headers">RFC3282</a></cite>] header mentioned earlier, provide "weights" for values appearing in the list. Such weighting cannot be depended on for anything other than ordering the list.</p> <p class="advisement" id="ltli-range-type-req"><a href="#ltli-range-type-req" class="self"></a>Specifications that define language tag matching or <a href="#dfn-language-negotiation" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-negotiation-1">language negotiation</a> <em class="rfc2119">MUST</em> specify whether language ranges used are a <a href="#dfn-basic-language-range" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-basic-language-range-1">basic language range</a> or an <a href="#dfn-extended-language-range" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-extended-language-range-1">extended language range</a>.</p> <p class="advisement" id="ltli-matching-result-ref"><a href="#ltli-matching-result-ref" class="self"></a>Specifications that define language tag matching <em class="rfc2119">MUST</em> specify whether the results of a matching operation contains a single result (<em>lookup</em> as defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4647" title="Matching of Language Tags">RFC4647</a></cite>]), or a possibly-empty (zero or more) set of results (<em>filtering</em> as defined in [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc4647" title="Matching of Language Tags">RFC4647</a></cite>]).</p> <p class="advisement" id="ltli-matching-type-ref"><a href="#ltli-matching-type-ref" class="self"></a>Specifications that define language tag matching <em class="rfc2119">MUST</em> specify the matching algorithms available and the selection mechanism.</p> <p>For example, JavaScript internationalization [<cite><a class="bibref" data-link-type="biblio" href="#bib-ecma-402" title="ECMAScript Internationalization API Specification">ECMA-402</a></cite>] and [<cite><a class="bibref" data-link-type="biblio" href="#bib-cldr" title="Common Locale Data Repository">CLDR</a></cite>] provide a "best fit" algorithm which can be tailored by implementers.</p> </section> <section id="i18n-terminology"> <h2 id="x3-locales-and-internationalization"><bdi class="secno">3. </bdi>Locales and Internationalization<a class="self-link" aria-label="§" href="#i18n-terminology"></a></h2> <p><em>This section defines basic terminology related to internationalization and localization.</em></p> <p>Users who speak different languages or come from different cultural backgrounds usually require software and services that are adapted to correctly process information using their native languages, writing systems, measurement systems, calendars, and other linguistic rules and cultural conventions.</p> <p><a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-4">Language tags</a> can also be used to identify <a href="#international-preferences" class="internalDFN" data-link-type="dfn" id="ref-for-international-preferences-2">international preferences</a> associated with a given piece of content or user because these preferences are linked to the natural language, regional association, or culture of the end user. Such preferences are applied to processes such as presenting numbers, dates, or times; sorting lists linguistically; providing defaults for items such as the presentation of a calendar, or common units of measurement; selecting between 12- vs. 24-hour time presentation; and many other details that users might find too tedious to set individually. Collectively, an identifier for these preferences is usually called a <a href="#locale" class="internalDFN" data-link-type="dfn" id="ref-for-locale-1">locale</a>. The extensions to [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] that define <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-1">Unicode locales</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-cldr" title="Common Locale Data Repository">CLDR</a></cite>] provide the basis for <a href="#internationalization" class="internalDFN" data-link-type="dfn" id="ref-for-internationalization-4">internationalization</a> APIs on the Web, notably the JavaScript language [<cite><a class="bibref" data-link-type="biblio" href="#bib-ecmascript" title="ECMAScript Language Specification">ECMASCRIPT</a></cite>] uses <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-2">Unicode locales</a> as the basis for the APIs found in [<cite><a class="bibref" data-link-type="biblio" href="#bib-ecma-402" title="ECMAScript Internationalization API Specification">ECMA-402</a></cite>].</p> <p class="definition"><dfn id="international-preferences" data-lt="international preferences|International Preferences." data-plurals="international preference">International Preferences.</dfn> A user's particular set of language and formatting preferences and associated cultural conventions. Software can use these preferences to correctly process or present information exchanged with that user.</p> <p>Many kinds of <a href="#international-preferences" class="internalDFN" data-link-type="dfn" id="ref-for-international-preferences-3">international preference</a> may be offered on the Web in order for a content or a service to be considered usable and acceptable by users around the world. Some of these preferences might include: </p><ul> <li>Natural language for text processing, such as parsing, spell checking, and grammar checking;</li> <li>User interface language, which may include items like images, colors, sounds, formats, and navigational elements as well as the visible text strings;</li> <li>Presentation (human-oriented formatting) of dates, times, numbers, lists, and other values;</li> <li>Collation, sorting, and organization of content (such as in a phone book or a dictionary);</li> <li>Alternate time-keeping and calendars, which may include holidays, work rules, weekday/weekend distinctions, the number and organization of months, the numbering of years, and so forth;</li> <li>Tax or regulatory regime;</li> <li>Currency</li> </ul> ... and many more. <p></p> <p class="definition"><dfn id="internationalization" data-lt="internationalization|I18N|internationalized|Internationalization">Internationalization</dfn>. The design and development of a product that is enabled for target audiences that vary in culture, region, or language. Internationalization is sometimes abbreviated <code>i18n</code> because there are eighteen letters between the "I" and the "N" in the English word.</p> <p class="definition"><dfn data-lt="localization|localized|L10N|Localization" id="dfn-localization">Localization</dfn>. The tailoring of a system to the individual cultural expectations of a specific target market or group of individuals. Localization includes, but is not limited to, the translation of user-facing text and messages. Localization is sometimes abbreviated as <code>l10n</code> because there are ten letters between the "L" and the "N" in the English word. When a particular set of content and preferences corresponding to a specific set of international preferences is operationally available, then the system is said to be <em>localized</em>.</p> <p class="definition"><dfn id="locale" data-lt="locale|locales|Locale">Locale</dfn>. An identifier (such as a <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-5">language tag</a>) for a set of <a href="#international-preferences" class="internalDFN" data-link-type="dfn" id="ref-for-international-preferences-4">international preferences</a>. Usually this identifier indicates the preferred language of the user and possibly includes other information, such as a geographic region (such as a country). A locale is passed in APIs or set in the operating environment to obtain culturally-affected behavior within a system or process.</p> <p class="definition"><dfn data-lt="locale aware|locale-aware|enabled|enable|Locale-aware" id="dfn-locale-aware">Locale-aware</dfn> (or <em>Enabled</em>). A system that can respond to changes in the <a href="#locale" class="internalDFN" data-link-type="dfn" id="ref-for-locale-2">locale</a> with culturally and language-specific behavior or content. Generally, systems that are internationalized can support a wide range of <a href="#locale" class="internalDFN" data-link-type="dfn" id="ref-for-locale-3">locales</a> in order to meet the <a href="#international-preferences" class="internalDFN" data-link-type="dfn" id="ref-for-international-preferences-5">international preferences</a> of many kinds of users.</p> <p><a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-6">Language tags</a> can provide information about the language, script, region, and various specially-registered variants using subtags. But sometimes there are international preferences that do not correlate directly with any of these. For example, many cultures have more than one way of sorting content items, and so the appropriate sort ordering cannot always be inferred from the language tag by itself. Thus a German language user might want to choose between the sort ordering used in a dictionary versus that used in a phone book.</p> <p>Historically, locales were associated with and specific to the programming language or operating environment of the user. These application-specific identifiers often could be inferred from or converted into language tags. Some examples of locale models include Java's <code>java.util.Locale</code>, POSIX (with identifiers such as <code>de_CH@utf8</code>), Oracle databases (<code>AMERICAN_AMERICA.AL32UTF8</code>), or Microsoft's LCIDs (which used numeric codes such as <code>0x0409</code>). The relationship between several of these models, the underlying standards such as ISO639 or ISO3166, and early language tags (such as [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc1766" title="Tags for the Identification of Languages">RFC1766</a></cite>]) was entirely intentional. Implementations often mapped (and continue to map) language tags from an existing protocol, such as HTTP's Accept-Language header, to proprietary or platform-specific locale models.</p> <p>Since the adoption of the current [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] identifier syntax, a number of locale models have adopted BCP47 directly or provided adaptation or mappings between proprietary models and <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-7">language tags</a>. Notably, the development and adoption of the open-source repository of locale data known as [<cite><a class="bibref" data-link-type="biblio" href="#bib-cldr" title="Common Locale Data Repository">CLDR</a></cite>] has led to wider general adoption of <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-8">language tags</a> as <a href="#locale" class="internalDFN" data-link-type="dfn" id="ref-for-locale-4">locale</a> identifiers.</p> <p class="definition"><dfn data-lt="common locale data repository|CLDR|Common Locale Data Repository" id="dfn-common-locale-data-repository">Common Locale Data Repository</dfn> (or <em>[<cite><a class="bibref" data-link-type="biblio" href="#bib-cldr" title="Common Locale Data Repository">CLDR</a></cite>]</em>). The Common Locale Data Repository is a Unicode Consortium project that defines, collects, and curates sets of data needed to enable <a href="#locale" class="internalDFN" data-link-type="dfn" id="ref-for-locale-5">locales</a> in systems or operating environments. CLDR data and its locale model are widely adopted, particularly in browsers.</p> <p class="definition"><dfn data-lt="unicode locale|unicode locale identifier|unicode locale identifiers|unicode locales|Unicode Locale Identifier" id="dfn-unicode-locale">Unicode Locale Identifier</dfn> or <em>Unicode Locale</em>. A <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-9">language tag</a> that follows the additional rules and restrictions on subtag choice defined in UTR#35 [<cite><a class="bibref" data-link-type="biblio" href="#bib-ldml" title="Unicode Technical Standard #35: Locale Data Markup Language">LDML</a></cite>]. Any valid Unicode locale identifier is also a <a href="#dfn-valid" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-valid-6">valid</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-10">language tag</a>, but a few <a href="#dfn-valid" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-valid-7">valid language tags</a> are not also valid Unicode locale identifiers.</p> <p class="definition"><dfn data-lt="canonical Unicode locale identifier|canonical tag|canonical locale|Canonical Unicode locale identifier" data-plurals="canonical unicode locale identifiers" id="dfn-canonical-unicode-locale-identifier">Canonical Unicode locale identifier</dfn>. A <a href="#dfn-well-formed" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-well-formed-3">well-formed language tag</a> resulting from the application of the <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-3">Unicode locale identifier</a> canonicalization rules found in [<cite><a class="bibref" data-link-type="biblio" href="#bib-ldml" title="Unicode Technical Standard #35: Locale Data Markup Language">LDML</a></cite>] (see <a href="https://www.unicode.org/reports/tr35/#Unicode_locale_identifier">Section 3</a>). This process converts any <a href="#dfn-valid" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-valid-8">valid</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-11">language tag</a> into a valid <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-4">Unicode locale identifier</a>. For example, deprecated subtags or irregular grandfathered tags are replaced with their preferred value from the <a href="#dfn-iana-language-subtag-registry" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-iana-language-subtag-registry-4">IANA language subtag registry</a>.</p> <p>[<cite><a class="bibref" data-link-type="biblio" href="#bib-cldr" title="Common Locale Data Repository">CLDR</a></cite>] defines and maintains two <a href="#dfn-language-tag-extension" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-extension-1">language tag extensions</a> ([<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc6067" title="BCP 47 Extension U">RFC6067</a></cite>] and [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc6497" title="BCP 47 Extension T - Transformed Content">RFC6497</a></cite>]) that are related to <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-5">Unicode locale identifiers</a>. These extensions allow a <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-12">language tag</a> to express some <a href="#international-preferences" class="internalDFN" data-link-type="dfn" id="ref-for-international-preferences-6">international preference</a> variations that go beyond linguistic or regional variation or to select formatting behavior or content when there are multiple options or user preferences within a given locale. <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-6">Unicode locale identifiers</a> are not required to include these extensions: they are only used when the locale being identified requires additional tailoring provided by one of these extensions. [<cite><a class="bibref" data-link-type="biblio" href="#bib-cldr" title="Common Locale Data Repository">CLDR</a></cite>] also applies specific interpretation of certain subtags when used as a locale identifier. See <a href="https://www.unicode.org/reports/tr35/tr35.html#Unicode_locale_identifier">Section 3.2</a> of [<cite><a class="bibref" data-link-type="biblio" href="#bib-ldml" title="Unicode Technical Standard #35: Locale Data Markup Language">LDML</a></cite>] for details.</p> <p>The <strong>Unicode locale <a href="#dfn-language-tag-extension" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-extension-2">language tag extension</a></strong> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc6067" title="BCP 47 Extension U">RFC6067</a></cite>] uses the <code>-u-</code> subtag, and provides subtags for selecting different locale-based formats and behaviors. See <a href="https://www.unicode.org/reports/tr35/tr35.html#Locale_Extension_Key_and_Type_Data">Section 3.6</a> of [<cite><a class="bibref" data-link-type="biblio" href="#bib-ldml" title="Unicode Technical Standard #35: Locale Data Markup Language">LDML</a></cite>] for details.</p> <p>The <strong>transformed content <a href="#dfn-language-tag-extension" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-extension-3">language tag extension</a></strong> [<cite><a class="bibref" data-link-type="biblio" href="#bib-rfc6497" title="BCP 47 Extension T - Transformed Content">RFC6497</a></cite>], which uses the <code>-t-</code> subtag, provides subtags for text transformations, such as transliteration between scripts. See <a href="https://www.unicode.org/reports/tr35/tr35.html#t_Extension">Section 3.7</a> of [<cite><a class="bibref" data-link-type="biblio" href="#bib-ldml" title="Unicode Technical Standard #35: Locale Data Markup Language">LDML</a></cite>] for details.</p> <p>Unicode Locales increasingly form the basis for <a href="#internationalization" class="internalDFN" data-link-type="dfn" id="ref-for-internationalization-5">internationalization</a> on the Web, particularly as part of the <code>Intl</code> locale framework [<cite><a class="bibref" data-link-type="biblio" href="#bib-ecma-402" title="ECMAScript Internationalization API Specification">ECMA-402</a></cite>] in JavaScript [<cite><a class="bibref" data-link-type="biblio" href="#bib-ecmascript" title="ECMAScript Language Specification">ECMASCRIPT</a></cite>].</p> <p class="advisement" id="ltli-canonical-author-req"><a class="self" href="#ltli-canonical-author-req"></a>Content authors <em class="rfc2119">SHOULD</em> choose language tags that are <a href="#dfn-canonical-unicode-locale-identifier" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-canonical-unicode-locale-identifier-1">canonical Unicode locale identifiers</a>.</p> <p>The additional content restrictions and normalization steps found in <a href="https://www.unicode.org/reports/tr35/#Canonical_Unicode_Locale_Identifiers">Section 3</a> of [<cite><a class="bibref" data-link-type="biblio" href="#bib-ldml" title="Unicode Technical Standard #35: Locale Data Markup Language">LDML</a></cite>] provide for better interoperability and consistency than that afforded by [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] directly.</p> <p class="advisement" id="ltli-canonical-impl-req"><a class="self" href="#ltli-canonical-impl-req"></a>Implementations <em class="rfc2119">SHOULD</em> only emit language tags that are <a href="#dfn-canonical-unicode-locale-identifier" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-canonical-unicode-locale-identifier-2">canonical Unicode locale identifiers</a> and <em class="rfc2119">SHOULD</em> normalize language tags that they consume using the rules for producing canonical tags.</p> <p>As above, the additional content restrictions and normalization steps found in <a href="https://www.unicode.org/reports/tr35/#Canonical_Unicode_Locale_Identifiers">Section 3</a> of [<cite><a class="bibref" data-link-type="biblio" href="#bib-ldml" title="Unicode Technical Standard #35: Locale Data Markup Language">LDML</a></cite>] provide for better interoperability and consistency than that afforded by [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] directly. This best practice should not be interpreted as meaning that implementations need to support, generate, process, or understand either of [<cite><a class="bibref" data-link-type="biblio" href="#bib-cldr" title="Common Locale Data Repository">CLDR</a></cite>]'s extensions.</p> <p class="advisement" id="ltli-extensions-not-required"><a class="self" href="#ltli-extensions-not-required"></a>Content authors <em class="rfc2119">SHOULD NOT</em> include <a href="#dfn-language-tag-extension" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-extension-4">language tag extensions</a> in a <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-13">language tag</a> unless the specific application requires the additional tailoring.</p> <p>It is important to remember that every <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-7">Unicode locale identifier</a> is <em>also</em> a <a href="#dfn-well-formed" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-well-formed-4">well-formed</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] language tag. <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-8">Unicode locale identifiers</a> do not require the use of either of [<cite><a class="bibref" data-link-type="biblio" href="#bib-cldr" title="Common Locale Data Repository">CLDR</a></cite>]'s <a href="#dfn-language-tag-extension" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-extension-5">language tag extensions</a>.</p> <div class="note" role="note" id="issue-container-generatedID-1"><div role="heading" class="note-title marker" id="h-note-1" aria-level="3"><span>Note</span></div><p class="">Some international and cultural preferences are individual and are left to content authors, service providers, operating environments, or user agents to define and manage on behalf of the user.</p></div> <aside class="example" id="example-locale-variation"><div class="marker"> <a class="self-link" href="#example-locale-variation">Example<bdi> 2</bdi></a> </div> <p>Here are a few selected examples of <a href="#dfn-unicode-locale" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-unicode-locale-9">Unicode Locale identifiers</a> and the variations associated with them.</p> <p>In the first example, the value <code>123456789.5678</code> is formatted using the locale rules represented by the various language tags. Notice how the <code>u</code> extension and its <code>nu</code> keyword are used to select between Latin and Devanagari digit shapes in the Hindi-as-used-in-India (<code>hi-IN</code>) locale and between Latin and Arabic script digit shaps in the Arabic (<code>ar</code>) locale.</p> <table> <thead> <tr> <th style="width:20%">Variation Type</th> <th style="width:20%">Value</th> <th style="width:20%">Locale</th> <th style="width:25%">Formatted Value</th> </tr> </thead> <tbody> <tr> <td rowspan="6">Numbering System</td> <td rowspan="6"><code>123456789.5678</code></td> <td>en-US</td> <td lang="en-US">123,456,789.5678</td> </tr><tr> <td>de</td> <td lang="de">123.456.789,5678</td></tr> <tr> <td>hi-IN-u-nu-latn</td> <td lang="hi">12,34,56,789.5678</td> </tr> <tr> <td>hi-IN-u-nu-deva</td> <td lang="hi-IN-u-nu-deva">१२,३४,५६,७८९.५६७८</td> </tr> <tr> <td>ar-u-nu-latn</td> <td dir="rtl" lang="ar-u-nu-latn">123,456,789.5678</td> </tr> <tr> <td>ar-u-nu-arab</td> <td dir="rtl" lang="ar-u-nu-arab">١٢٣٬٤٥٦٬٧٨٩٫٥٦٧٨</td> </tr> </tbody> </table> <p>In the second example, the date value corresponding to 11 July 2020 on the Gregorian calendar is formatted using various different locales. Here, for example, the language tag for Thai (<code>th</code>) is extended to select between the Greogrian (<code>-u-ca-gregory</code>) and Thai Buddhist (<code>-u-ca-buddhist</code>) calendar systems. Other examples show the Japanese Imperial calendar and one type of Islamic calendar. Notice in the last example that the calendar is not restricted to a specific locale: here we show the Islamic calendar system in an English locale.</p> <table> <thead> <tr> <th>Variation Type</th> <th>Value</th> <th>Locale</th> <th>Formatted Value</th> </tr> </thead> <tbody> <tr> <td rowspan="5">Calendar</td> <td rowspan="5"><code>2020-07-11T12:00:00Z</code></td> <td>th-u-ca-gregory</td> <td lang="th-u-ca-gregory">11 ก.ค. 2020</td> </tr> <tr> <td>th-u-ca-buddhist</td> <td lang="th-u-ca-buddhist">11 ก.ค. 2563</td> </tr> <tr> <td>ja-u-ca-japanese</td> <td lang="ja-u-ca-japanese">令和2年7月11日</td> </tr> <tr> <td>ar-u-ca-islamic</td> <td dir="rtl" lang="ar-u-ca-islamic">٢٠ ذو القعدة ١٤٤١ هـ</td> </tr> <tr> <td>en-u-ca-islamic</td> <td lang="en-u-ca-islamic">Dhuʻl-Q. 20, 1441 AH</td> </tr> </tbody> </table> </aside> <p class="definition"><dfn data-lt="non-linguistic field|field|non-linguistic fields|fields|Non-linguistic Field" id="dfn-non-linguistic-field">Non-linguistic Field</dfn>. Any element of a data structure not intended for the storage or interchange of natural language textual data. This includes non-string data types, such as booleans, numbers, dates, and so forth. It also includes strings, such as program or protocol internal identifiers. This document uses the term <em>field</em> as a short hand for this concept.</p> <p>Specifications for document formats or protocols usually define the exchange, processing, or display of various data values or data structures. The Web primarily relies on text files for the serialization and exchange of data: even raw bytes are usually transmitted using a string serialization such as base64. Thus <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-1">non-linguistic fields</a> on the Web are also normally made up of strings. The important distinction here is that <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-2">non-linguistic fields</a> are generally interpreted by or meant for consumption by the underlying application, rather than by a user.</p> <p class="definition"><dfn data-lt="locale-neutral|locale neutral|Locale-neutral" id="dfn-locale-neutral">Locale-neutral</dfn>. A <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-3">non-linguistic field</a> is said to be <a href="#dfn-locale-neutral" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-locale-neutral-1">locale-neutral</a> when it is stored or exchanged in a format that is not specifically appropriate for any given language, locale, or culture and which can be interpreted unambiguously for presentation in a <a href="#dfn-locale-aware" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-locale-aware-1">locale aware</a> way.</p> <p>Many specifications use a serialization scheme, such as those provided by [<cite><a class="bibref" data-link-type="biblio" href="#bib-xmlschema11-2" title="W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes">XMLSCHEMA11-2</a></cite>] or [<cite><a class="bibref" data-link-type="biblio" href="#bib-json-ld" title="JSON-LD 1.0">JSON-LD</a></cite>], to provide a <a href="#dfn-locale-neutral" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-locale-neutral-2">locale neutral</a> encoding of <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-4">non-linguistic fields</a> in document formats or protocols.</p> <p>A <a href="#dfn-locale-neutral" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-locale-neutral-3">locale-neutral</a> representation might itself be linked to a specific cultural preference, but such linkages should be minimized. For example, many of the ISO8601 date/time value serializations are linked to the Gregorian calendar, but the format, field order, separators, and visual appearance are not specifically suitable to any locale (they are intended to be machine readable) and, as shown in the <a href="#example-locale-variation">example</a> above, the value can be converted for display into any calendar or locale.</p> <aside class="example" id="example-3"><div class="marker"> <a class="self-link" href="#example-3">Example<bdi> 3</bdi></a> </div> <p>Suppose your application needs to collect and store some value in a <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-5">field</a>. The system can use a <a href="#dfn-locale-neutral" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-locale-neutral-4">locale-neutral</a> format for storing and exchanging the value. For instance, schema languages such as [<cite><a class="bibref" data-link-type="biblio" href="#bib-xmlschema11-2" title="W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes">XMLSCHEMA11-2</a></cite>] or data formats such as [<cite><a class="bibref" data-link-type="biblio" href="#bib-json" title="The application/json Media Type for JavaScript Object Notation (JSON)">JSON</a></cite>] provide ready made types for this purpose. When the user is entering or editing the value, however, the user expects to interact with a more human friendly format. For example, if your application needed to input a user's birth date and the value they were trying to enter were <code>2020-01-31</code>:</p> <p>The input field might look like this in HTML:</p> <pre aria-busy="false"><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"date"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"birthDate"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"2020-01-31"</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">…</span> ></span></code></pre> <p>The <code>lang</code> attribute here should control the display and formatting of the value, including the expected input pattern. <em>Note that this guidance is at odds with what browsers do at the time this document was published.</em></p> <table> <thead> <tr><th style="width:15%">Value</th> <th style="width:22%">Language Tag</th> <th style="width:23%">Display</th> <th style="width:30%">Input Format Pattern</th> </tr></thead> <tbody> </tbody> <tbody><tr> <td rowspan="4"><code>2020-01-31</code></td> <td>en-GB</td> <td>31/01/2020</td> <td>dd/MM/yyyy</td> </tr> <tr> <td>en-US</td> <td>01/31/2020</td> <td>MM/dd/yyyy</td> </tr> <tr> <td>fr-FR</td> <td>31-01-2020</td> <td>dd-MM-yyyy</td> </tr> <tr> <td>zh-Hans-CN</td> <td>2020-01-31</td> <td>yyyy-MM-dd</td> </tr> </tbody></table> </aside> <p class="definition"><dfn id="dfn-language-negotiation">Language negotiation</dfn>. The process of matching a user's <a href="#international-preferences" class="internalDFN" data-link-type="dfn" id="ref-for-international-preferences-7">international preferences</a> to available locales, localized resources, content, or processing.</p> <p class="definition"><dfn data-lt="locale fallback|fallback|Locale fallback" id="dfn-locale-fallback">Locale fallback</dfn>. The process of searching for translated content, locale data, or other resources by "falling back" from more-specific resources to more-general ones following a deterministic pattern.</p> <p>A user's preferences are usually expressed as a <a href="#locale" class="internalDFN" data-link-type="dfn" id="ref-for-locale-6">locale</a> or prioritized list of locales. When negotiating the language, the system follows some sort of algorithm to get the best matching content or functionality from the available resources. In many cases the language negotiation algorithm uses <a href="#dfn-locale-fallback" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-locale-fallback-1">locale fallback</a>.</p> <p class="advisement" id="ltli-format-like-doc-language"><a class="self" href="#ltli-format-like-doc-language"></a>Specifications that present <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-6">fields</a> in a document format <em class="rfc2119">SHOULD</em> require that data is formatted according to the language of the surrounding content.</p> <p>When <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-7">non-linguistic fields</a> are presented to the user as part of a document or application, the document or application forms the "context" where the data is being viewed. Content authors or application developers need a way to make the <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-8">fields</a> seem like a natural part of the experience and need a way to control the presentation. This is indicated by the <a href="#dfn-language-tag" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-language-tag-14">language tag</a> of the context in which the content appears: usually <a href="#dfn-locale-aware" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-locale-aware-2">enabled</a> implementations interpret the tag as a <a href="#locale" class="internalDFN" data-link-type="dfn" id="ref-for-locale-7">locale</a> in order to accomplish this. Using the runtime locale or localization of the user-agent as the locale for presenting <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-9">non-linguistic fields</a> should only be a last resort.</p> <p class="advisement" id="ltli-input-like-doc-language"><a class="self" href="#ltli-input-like-doc-language"></a>Specifications that present forms or receive input of <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-10">non-linguistic fields</a> in a document format or application <em class="rfc2119">SHOULD</em> require that the values be presented to the user <a href="#dfn-localization" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-localization-1">localized</a> in the format of the language of the content or markup immediately surrounding the value.</p> <p class="advisement" id="ltli-input-locale-neutrality"><a class="self" href="#ltli-input-locale-neutrality"></a>Specifications that present, exchange, or allow the input of <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-11">non-linguistic fields</a> <em class="rfc2119">MUST</em> use a <a href="#dfn-locale-neutral" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-locale-neutral-5">locale-neutral</a> format for storage and interchange.</p> <p class="advisement" id="ltli-impl-input-like-doc-language"><a class="self" href="#ltli-impl-input-like-doc-language"></a>Implementations <em class="rfc2119">SHOULD</em> present <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-12">non-linguistic fields</a> in a document format or application using a format consistent with the language of the surrounding content and are encouraged to provide controls which are <a href="#dfn-localization" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-localization-2">localized</a> to the same <a href="#locale" class="internalDFN" data-link-type="dfn" id="ref-for-locale-8">locale</a> for input or editing.</p> <p>Users expect form fields and other data inputs to use a presentation for <a href="#dfn-non-linguistic-field" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-non-linguistic-field-13">non-linguistic fields</a> that is consistent with the document or application where the values appear. User's usually expect their input to match the document's context rather than the user-agent or operating environments and input validation, prompting, or controls are also thus consistent with the content. This gives content authors the ability to create a wholly localized customer experience and is generally in keeping with customer expectations.</p> </section> <section id="further-reading"> <h2 id="x4-further-reading"><bdi class="secno">4. </bdi>Further Reading<a class="self-link" aria-label="§" href="#further-reading"></a></h2> <p>The Internationalization WG has additional best practices and other references, such as articles on language tag choice. These include: </p> <ul> <li><a href="https://www.w3.org/TR/string-meta">Strings on the Web: Language and Direction Metadata</a> [<cite><a class="bibref" data-link-type="biblio" href="#bib-string-meta" title="Strings on the Web: Language and Direction Metadata">STRING-META</a></cite>]</li> <li><a href="https://www.w3.org/International/questions/qa-choosing-language-tags">Choosing a Language Tag</a></li> <li><a href="https://www.w3.org/International/articles/language-tags/">Language Tags in HTML and XML</a></li> <li><a href="https://www.w3.org/International/questions/qa-no-language">Tagging text with no language</a></li> <li><a href="https://www.w3.org/International/questions/qa-i18n">Localization vs. Internationalization</a></li> </ul> </section> <section class="appendix" id="revisionlog"> <h2 id="a-revision-log"><bdi class="secno">A. </bdi>Revision Log<a class="self-link" aria-label="§" href="#revisionlog"></a></h2> <p>Changes to this document following the <a href="https://www.w3.org/TR/2015/WD-ltli-20150423/">Working Draft</a> of 2015-04-23 are available via the <a href="https://github.com/w3c/ltli/commits/gh-pages">github commit log</a>. This document was significantly restructured since that revision. Notably:</p> <ul> <li>As this document is targetting Note status, removed mention of "normative" and "informative" and converted all references to standard ones.</li> <li>Restructured document to be more accessible. Some sections were reordered or removed.</li> <li>Removed the WS-I18N appendix.</li> </ul> <p>The following changes were made since the revision of 2006-06-20.</p> <ul> <li>Converted the format to ReSpec.</li> <li>All references to RFC3066bis were updated to BCP 47 or to RFC5646 or RFC 4647 as appropriate.</li> <li>References to HTML were changed to point to HTML5.</li> <li>Imported and rewrote the text formerly containing in [<cite><a class="bibref" data-link-type="biblio" href="#bib-ws-i18n-scenarios" title="Web Services Internationalization Usage Scenarios">WS-I18N-SCENARIOS</a></cite>] defining internationalization, locale, and other important terms.</li> <li>Modified and reorganized the other sections of this document. Moved the Web services materials to an appendix.</li> <li>Modified the SOTD to reflect our use of github.</li> </ul> <p>The following log records changes that have been made to this document since the <a href="https://www.w3.org/TR/2006/WD-ltli-20060419/">publication in April 2006</a>.</p> <ul> <li> <p>The informative introductory section has been rewritten thoroughly, including the description of the scope of the document, of application scenarios and of the separation of locale versus natural language.</p> </li> <li> <p>Terms which rely on [<cite><a class="bibref" data-link-type="biblio" href="#bib-bcp47" title="Tags for Identifying Languages">BCP47</a></cite>] are not <em>defined</em> anymore, but only <em>reference</em> these documents. In addition, examples for these terms were created.</p> </li> <li> <p>The requirements for language and locale values have been taken out of the conformance section and are now placed in the body of the document.</p> </li> <li> <p>A revision log has been created.</p> </li> </ul> </section> <section id="acknowledgements"> <h2 id="b-acknowledgements"><bdi class="secno">B. </bdi>Acknowledgements<a class="self-link" aria-label="§" href="#acknowledgements"></a></h2> <p>The Internationalization Working Group would like to acknowledge the following contributors to this specification:</p> <ul> <li>Felix Sasaki, for editing this document and publishing the 2006 WD</li> <li>Mark Davis, Y.Umaoka, and others for contributions to the BCP47 extensions</li> <li>WS-I18N contributors: this document was created to satisfy requirement R005 in [<cite><a class="bibref" data-link-type="biblio" href="#bib-ws-i18n-req" title="Requirements for the Internationalization of Web Services">WS-I18N-REQ</a></cite>].</li> </ul> </section> <section id="references" class="appendix"><h2 id="c-references"><bdi class="secno">C. </bdi>References<a class="self-link" aria-label="§" href="#references"></a></h2><section id="informative-references"> <h3 id="c-1-informative-references"><bdi class="secno">C.1 </bdi>Informative references<a class="self-link" aria-label="§" href="#informative-references"></a></h3> <dl class="bibliography"><dt id="bib-bcp47">[BCP47]</dt><dd><a href="https://tools.ietf.org/html/bcp47"><cite>Tags for Identifying Languages</cite></a>. A. Phillips; M. Davis. IETF. September 2009. IETF Best Current Practice. URL: <a href="https://tools.ietf.org/html/bcp47">https://tools.ietf.org/html/bcp47</a></dd><dt id="bib-cldr">[CLDR]</dt><dd><a href="http://cldr.unicode.org"><cite>Common Locale Data Repository</cite></a>. Unicode. URL: <a href="http://cldr.unicode.org">http://cldr.unicode.org</a></dd><dt id="bib-css3-selectors">[CSS3-SELECTORS]</dt><dd><a href="https://www.w3.org/TR/selectors-3/"><cite>Selectors Level 3</cite></a>. Tantek Çelik; Elika Etemad; Daniel Glazman; Ian Hickson; Peter Linss; John Williams. W3C. 6 November 2018. W3C Recommendation. URL: <a href="https://www.w3.org/TR/selectors-3/">https://www.w3.org/TR/selectors-3/</a></dd><dt id="bib-ecma-402">[ECMA-402]</dt><dd><a href="https://tc39.es/ecma402/"><cite>ECMAScript Internationalization API Specification</cite></a>. Ecma International. URL: <a href="https://tc39.es/ecma402/">https://tc39.es/ecma402/</a></dd><dt id="bib-ecmascript">[ECMASCRIPT]</dt><dd><a href="https://tc39.es/ecma262/"><cite>ECMAScript Language Specification</cite></a>. Ecma International. URL: <a href="https://tc39.es/ecma262/">https://tc39.es/ecma262/</a></dd><dt id="bib-html">[HTML]</dt><dd><a href="https://html.spec.whatwg.org/multipage/"><cite>HTML Standard</cite></a>. Anne van Kesteren; Domenic Denicola; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a></dd><dt id="bib-international-specs">[INTERNATIONAL-SPECS]</dt><dd><a href="https://www.w3.org/TR/international-specs/"><cite>Internationalization Best Practices for Spec Developers</cite></a>. Marcos Caceres. W3C. 29 May 2020. W3C Working Draft. URL: <a href="https://www.w3.org/TR/international-specs/">https://www.w3.org/TR/international-specs/</a></dd><dt id="bib-json">[JSON]</dt><dd><a href="https://tools.ietf.org/html/rfc4627"><cite>The application/json Media Type for JavaScript Object Notation (JSON)</cite></a>. D. Crockford. IETF. July 2006. Informational. URL: <a href="https://tools.ietf.org/html/rfc4627">https://tools.ietf.org/html/rfc4627</a></dd><dt id="bib-json-ld">[JSON-LD]</dt><dd><a href="https://www.w3.org/TR/json-ld/"><cite>JSON-LD 1.0</cite></a>. Manu Sporny; Gregg Kellogg; Markus Lanthaler. W3C. 16 January 2014. W3C Recommendation. URL: <a href="https://www.w3.org/TR/json-ld/">https://www.w3.org/TR/json-ld/</a></dd><dt id="bib-ldml">[LDML]</dt><dd><a href="https://www.unicode.org/reports/tr35/"><cite>Unicode Technical Standard #35: Locale Data Markup Language</cite></a>. Mark Davis; CLDR Contributors. Unicode. URL: <a href="https://www.unicode.org/reports/tr35/">https://www.unicode.org/reports/tr35/</a></dd><dt id="bib-rfc1766">[RFC1766]</dt><dd><a href="https://tools.ietf.org/html/rfc1766"><cite>Tags for the Identification of Languages</cite></a>. H. Alvestrand. IETF. March 1995. Proposed Standard. URL: <a href="https://tools.ietf.org/html/rfc1766">https://tools.ietf.org/html/rfc1766</a></dd><dt id="bib-rfc2119">[RFC2119]</dt><dd><a href="https://tools.ietf.org/html/rfc2119"><cite>Key words for use in RFCs to Indicate Requirement Levels</cite></a>. S. Bradner. IETF. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a></dd><dt id="bib-rfc2616">[RFC2616]</dt><dd><a href="https://tools.ietf.org/html/rfc2616"><cite>Hypertext Transfer Protocol -- HTTP/1.1</cite></a>. R. Fielding; J. Gettys; J. Mogul; H. Frystyk; L. Masinter; P. Leach; T. Berners-Lee. IETF. June 1999. Draft Standard. URL: <a href="https://tools.ietf.org/html/rfc2616">https://tools.ietf.org/html/rfc2616</a></dd><dt id="bib-rfc3066">[RFC3066]</dt><dd><a href="https://tools.ietf.org/html/rfc3066"><cite>Tags for the Identification of Languages</cite></a>. H. Alvestrand. IETF. January 2001. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc3066">https://tools.ietf.org/html/rfc3066</a></dd><dt id="bib-rfc3282">[RFC3282]</dt><dd><a href="https://tools.ietf.org/html/rfc3282"><cite>Content Language Headers</cite></a>. H. Alvestrand. IETF. May 2002. Draft Standard. URL: <a href="https://tools.ietf.org/html/rfc3282">https://tools.ietf.org/html/rfc3282</a></dd><dt id="bib-rfc4646">[RFC4646]</dt><dd><a href="https://tools.ietf.org/html/rfc4646"><cite>Tags for Identifying Languages</cite></a>. A. Phillips; M. Davis. IETF. September 2006. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc4646">https://tools.ietf.org/html/rfc4646</a></dd><dt id="bib-rfc4647">[RFC4647]</dt><dd><a href="https://tools.ietf.org/html/rfc4647"><cite>Matching of Language Tags</cite></a>. A. Phillips; M. Davis. IETF. September 2006. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc4647">https://tools.ietf.org/html/rfc4647</a></dd><dt id="bib-rfc5646">[RFC5646]</dt><dd><a href="https://tools.ietf.org/html/rfc5646"><cite>Tags for Identifying Languages</cite></a>. A. Phillips, Ed.; M. Davis, Ed.. IETF. September 2009. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc5646">https://tools.ietf.org/html/rfc5646</a></dd><dt id="bib-rfc6067">[RFC6067]</dt><dd><a href="https://tools.ietf.org/html/rfc6067"><cite>BCP 47 Extension U</cite></a>. M. Davis; A. Phillips; Y. Umaoka. IETF. December 2010. Informational. URL: <a href="https://tools.ietf.org/html/rfc6067">https://tools.ietf.org/html/rfc6067</a></dd><dt id="bib-rfc6497">[RFC6497]</dt><dd><a href="https://tools.ietf.org/html/rfc6497"><cite>BCP 47 Extension T - Transformed Content</cite></a>. M. Davis; A. Phillips; Y. Umaoka; C. Falk. IETF. February 2012. Informational. URL: <a href="https://tools.ietf.org/html/rfc6497">https://tools.ietf.org/html/rfc6497</a></dd><dt id="bib-string-meta">[STRING-META]</dt><dd><a href="https://www.w3.org/TR/string-meta/"><cite>Strings on the Web: Language and Direction Metadata</cite></a>. Addison Phillips; Richard Ishida. W3C. 11 June 2019. W3C Working Draft. URL: <a href="https://www.w3.org/TR/string-meta/">https://www.w3.org/TR/string-meta/</a></dd><dt id="bib-ws-i18n-req">[WS-I18N-REQ]</dt><dd><a href="https://www.w3.org/TR/ws-i18n-req/"><cite>Requirements for the Internationalization of Web Services</cite></a>. Addison Phillips. W3C. 16 November 2004. W3C Note. URL: <a href="https://www.w3.org/TR/ws-i18n-req/">https://www.w3.org/TR/ws-i18n-req/</a></dd><dt id="bib-ws-i18n-scenarios">[WS-I18N-SCENARIOS]</dt><dd><a href="https://www.w3.org/TR/ws-i18n-scenarios/"><cite>Web Services Internationalization Usage Scenarios</cite></a>. Debasish Banerjee; Martin Dürst; Michael McKenna; Addison Phillips; Takao Suzuki; Tex Texin; Mary Trumble; Andrea Vine; Kentaro Noji et al. W3C. 30 July 2004. W3C Note. URL: <a href="https://www.w3.org/TR/ws-i18n-scenarios/">https://www.w3.org/TR/ws-i18n-scenarios/</a></dd><dt id="bib-xml10">[XML10]</dt><dd><a href="https://www.w3.org/TR/xml/"><cite>Extensible Markup Language (XML) 1.0 (Fifth Edition)</cite></a>. Tim Bray; Jean Paoli; Michael Sperberg-McQueen; Eve Maler; François Yergeau et al. W3C. 26 November 2008. W3C Recommendation. URL: <a href="https://www.w3.org/TR/xml/">https://www.w3.org/TR/xml/</a></dd><dt id="bib-xmlschema11-2">[XMLSCHEMA11-2]</dt><dd><a href="https://www.w3.org/TR/xmlschema11-2/"><cite>W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes</cite></a>. David Peterson; Sandy Gao; Ashok Malhotra; Michael Sperberg-McQueen; Henry Thompson; Paul V. Biron et al. W3C. 5 April 2012. W3C Recommendation. URL: <a href="https://www.w3.org/TR/xmlschema11-2/">https://www.w3.org/TR/xmlschema11-2/</a></dd><dt id="bib-xsl10">[XSL10]</dt><dd><a href="https://www.w3.org/TR/xsl/"><cite>Extensible Stylesheet Language (XSL) Version 1.0</cite></a>. Sharon Adler; Anders Berglund; Jeffrey Caruso; Stephen Deach; Tony Graham; Paul Grosso; Eduardo Gutentag; Alex Miłowski; Scott Parnell; Jeremy Richman; Steve Zilles et al. W3C. 15 October 2001. W3C Recommendation. URL: <a href="https://www.w3.org/TR/xsl/">https://www.w3.org/TR/xsl/</a></dd></dl> </section></section><p role="navigation" id="back-to-top"> <a href="#title"><abbr title="Back to Top">↑</abbr></a> </p><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-natural-language"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-natural-language">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-natural-language-1">1. Introduction</a> </li><li> <a href="#ref-for-dfn-natural-language-2">2. Languages and Language Tags</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-language-tag"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-language-tag">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-language-tag-1">2. Languages and Language Tags</a> <a href="#ref-for-dfn-language-tag-2">(2)</a> <a href="#ref-for-dfn-language-tag-3">(3)</a> </li><li> <a href="#ref-for-dfn-language-tag-4">3. Locales and Internationalization</a> <a href="#ref-for-dfn-language-tag-5">(2)</a> <a href="#ref-for-dfn-language-tag-6">(3)</a> <a href="#ref-for-dfn-language-tag-7">(4)</a> <a href="#ref-for-dfn-language-tag-8">(5)</a> <a href="#ref-for-dfn-language-tag-9">(6)</a> <a href="#ref-for-dfn-language-tag-10">(7)</a> <a href="#ref-for-dfn-language-tag-11">(8)</a> <a href="#ref-for-dfn-language-tag-12">(9)</a> <a href="#ref-for-dfn-language-tag-13">(10)</a> <a href="#ref-for-dfn-language-tag-14">(11)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-subtag"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-subtag">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-subtag-1">2. Languages and Language Tags</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-iana-language-subtag-registry"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-iana-language-subtag-registry">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-iana-language-subtag-registry-1">2. Languages and Language Tags</a> <a href="#ref-for-dfn-iana-language-subtag-registry-2">(2)</a> <a href="#ref-for-dfn-iana-language-subtag-registry-3">(3)</a> </li><li> <a href="#ref-for-dfn-iana-language-subtag-registry-4">3. Locales and Internationalization</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-well-formed"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-well-formed">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-well-formed-1">2. Languages and Language Tags</a> <a href="#ref-for-dfn-well-formed-2">(2)</a> </li><li> <a href="#ref-for-dfn-well-formed-3">3. Locales and Internationalization</a> <a href="#ref-for-dfn-well-formed-4">(2)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-valid"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-valid">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-valid-1">2. Languages and Language Tags</a> <a href="#ref-for-dfn-valid-2">(2)</a> <a href="#ref-for-dfn-valid-3">(3)</a> <a href="#ref-for-dfn-valid-4">(4)</a> <a href="#ref-for-dfn-valid-5">(5)</a> </li><li> <a href="#ref-for-dfn-valid-6">3. Locales and Internationalization</a> <a href="#ref-for-dfn-valid-7">(2)</a> <a href="#ref-for-dfn-valid-8">(3)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-language-tag-extension"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-language-tag-extension">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-language-tag-extension-1">3. Locales and Internationalization</a> <a href="#ref-for-dfn-language-tag-extension-2">(2)</a> <a href="#ref-for-dfn-language-tag-extension-3">(3)</a> <a href="#ref-for-dfn-language-tag-extension-4">(4)</a> <a href="#ref-for-dfn-language-tag-extension-5">(5)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-language-range"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-language-range">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-language-range-1">2. Languages and Language Tags</a> <a href="#ref-for-dfn-language-range-2">(2)</a> <a href="#ref-for-dfn-language-range-3">(3)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-language-priority-list"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-language-priority-list">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-language-priority-list-1">2. Languages and Language Tags</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-basic-language-range"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-basic-language-range">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-basic-language-range-1">2. Languages and Language Tags</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-extended-language-range"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-extended-language-range">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-extended-language-range-1">2. Languages and Language Tags</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-international-preferences"> <span class="caret"></span> <div> <a class="self-link" href="#international-preferences">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-international-preferences-1">2. Languages and Language Tags</a> </li><li> <a href="#ref-for-international-preferences-2">3. Locales and Internationalization</a> <a href="#ref-for-international-preferences-3">(2)</a> <a href="#ref-for-international-preferences-4">(3)</a> <a href="#ref-for-international-preferences-5">(4)</a> <a href="#ref-for-international-preferences-6">(5)</a> <a href="#ref-for-international-preferences-7">(6)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-internationalization"> <span class="caret"></span> <div> <a class="self-link" href="#internationalization">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-internationalization-1">1. Introduction</a> <a href="#ref-for-internationalization-2">(2)</a> <a href="#ref-for-internationalization-3">(3)</a> </li><li> <a href="#ref-for-internationalization-4">3. Locales and Internationalization</a> <a href="#ref-for-internationalization-5">(2)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-localization"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-localization">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-localization-1">3. Locales and Internationalization</a> <a href="#ref-for-dfn-localization-2">(2)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-locale"> <span class="caret"></span> <div> <a class="self-link" href="#locale">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-locale-1">3. Locales and Internationalization</a> <a href="#ref-for-locale-2">(2)</a> <a href="#ref-for-locale-3">(3)</a> <a href="#ref-for-locale-4">(4)</a> <a href="#ref-for-locale-5">(5)</a> <a href="#ref-for-locale-6">(6)</a> <a href="#ref-for-locale-7">(7)</a> <a href="#ref-for-locale-8">(8)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-locale-aware"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-locale-aware">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-locale-aware-1">3. Locales and Internationalization</a> <a href="#ref-for-dfn-locale-aware-2">(2)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-common-locale-data-repository"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-common-locale-data-repository">Permalink</a> </div> <b>Referenced in:</b> <ul> <li>Not referenced in this document.</li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-unicode-locale"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-unicode-locale">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-unicode-locale-1">3. Locales and Internationalization</a> <a href="#ref-for-dfn-unicode-locale-2">(2)</a> <a href="#ref-for-dfn-unicode-locale-3">(3)</a> <a href="#ref-for-dfn-unicode-locale-4">(4)</a> <a href="#ref-for-dfn-unicode-locale-5">(5)</a> <a href="#ref-for-dfn-unicode-locale-6">(6)</a> <a href="#ref-for-dfn-unicode-locale-7">(7)</a> <a href="#ref-for-dfn-unicode-locale-8">(8)</a> <a href="#ref-for-dfn-unicode-locale-9">(9)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-canonical-unicode-locale-identifier"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-canonical-unicode-locale-identifier">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-canonical-unicode-locale-identifier-1">3. Locales and Internationalization</a> <a href="#ref-for-dfn-canonical-unicode-locale-identifier-2">(2)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-non-linguistic-field"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-non-linguistic-field">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-non-linguistic-field-1">3. Locales and Internationalization</a> <a href="#ref-for-dfn-non-linguistic-field-2">(2)</a> <a href="#ref-for-dfn-non-linguistic-field-3">(3)</a> <a href="#ref-for-dfn-non-linguistic-field-4">(4)</a> <a href="#ref-for-dfn-non-linguistic-field-5">(5)</a> <a href="#ref-for-dfn-non-linguistic-field-6">(6)</a> <a href="#ref-for-dfn-non-linguistic-field-7">(7)</a> <a href="#ref-for-dfn-non-linguistic-field-8">(8)</a> <a href="#ref-for-dfn-non-linguistic-field-9">(9)</a> <a href="#ref-for-dfn-non-linguistic-field-10">(10)</a> <a href="#ref-for-dfn-non-linguistic-field-11">(11)</a> <a href="#ref-for-dfn-non-linguistic-field-12">(12)</a> <a href="#ref-for-dfn-non-linguistic-field-13">(13)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-locale-neutral"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-locale-neutral">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-locale-neutral-1">3. Locales and Internationalization</a> <a href="#ref-for-dfn-locale-neutral-2">(2)</a> <a href="#ref-for-dfn-locale-neutral-3">(3)</a> <a href="#ref-for-dfn-locale-neutral-4">(4)</a> <a href="#ref-for-dfn-locale-neutral-5">(5)</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-language-negotiation"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-language-negotiation">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-language-negotiation-1">2. Languages and Language Tags</a> </li> </ul> </aside><aside class="dfn-panel" hidden="" id="dfn-panel-for-dfn-locale-fallback"> <span class="caret"></span> <div> <a class="self-link" href="#dfn-locale-fallback">Permalink</a> </div> <b>Referenced in:</b> <ul> <li> <a href="#ref-for-dfn-locale-fallback-1">3. Locales and Internationalization</a> </li> </ul> </aside><script id="respec-dfn-panel">(() => { // @ts-check if (document.respecIsReady) { document.respecIsReady.then(dfnPanel); } else { dfnPanel(); } function dfnPanel() { /** @type {HTMLElement} */ let panel; document.body.addEventListener("click", event => { if (!(event.target instanceof HTMLElement)) return; /** @type {HTMLElement} */ const el = event.target; const action = deriveAction(el); switch (action) { case "show": { if (panel) hidePanel(panel); /** @type {HTMLElement} */ const dfn = el.closest("dfn, .index-term"); panel = document.getElementById(`dfn-panel-for-${dfn.id}`); displayPanel(dfn, panel, { x: event.clientX, y: event.clientY }); break; } case "dock": { panel.style.left = null; panel.style.top = null; panel.classList.add("docked"); break; } case "hide": { hidePanel(panel); break; } } }); } /** @param {HTMLElement} clickTarget */ function deriveAction(clickTarget) { const hitALink = !!clickTarget.closest("a"); if (clickTarget.closest("dfn, .index-term")) { return hitALink ? null : "show"; } if (clickTarget.closest(".dfn-panel")) { if (hitALink) { const clickedSelfLink = clickTarget.classList.contains("self-link"); return clickedSelfLink ? "hide" : "dock"; } const panel = clickTarget.closest(".dfn-panel"); return panel.classList.contains("docked") ? "hide" : null; } if (document.querySelector(".dfn-panel:not([hidden])")) { return "hide"; } return null; } /** * @param {HTMLElement} dfn * @param {HTMLElement} panel * @param {{ x: number, y: number }} clickPosition */ function displayPanel(dfn, panel, { x, y }) { panel.hidden = false; // distance (px) between edge of panel and the pointing triangle (caret) const MARGIN = 20; const dfnRects = dfn.getClientRects(); // Find the `top` offset when the `dfn` can be spread across multiple lines let closestTop = 0; let minDiff = Infinity; for (const rect of dfnRects) { const { top, bottom } = rect; const diffFromClickY = Math.abs((top + bottom) / 2 - y); if (diffFromClickY < minDiff) { minDiff = diffFromClickY; closestTop = top; } } const top = window.scrollY + closestTop + dfnRects[0].height; const left = x - MARGIN; panel.style.left = `${left}px`; panel.style.top = `${top}px`; // Find if the panel is flowing out of the window const panelRect = panel.getBoundingClientRect(); const SCREEN_WIDTH = Math.min(window.innerWidth, window.screen.width); if (panelRect.right > SCREEN_WIDTH) { const newLeft = Math.max(MARGIN, x + MARGIN - panelRect.width); const newCaretOffset = left - newLeft; panel.style.left = `${newLeft}px`; /** @type {HTMLElement} */ const caret = panel.querySelector(".caret"); caret.style.left = `${newCaretOffset}px`; } } /** @param {HTMLElement} panel */ function hidePanel(panel) { panel.hidden = true; panel.classList.remove("docked"); } })()</script><script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script></body></html>