| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
| "https://www.w3.org/TR/html4/loose.dtd"> |
| <html> |
| <head> |
| <meta name="generator" content= |
| "HTML Tidy for HTML5 for Apple macOS version 5.6.0"> |
| <meta http-equiv="Content-Type" content= |
| "text/html; charset=utf-8"> |
| <meta http-equiv="Content-Language" content="en-us"> |
| <link rel="stylesheet" href= |
| "../reports.css" type="text/css"> |
| <title>UTS #35: Unicode LDML: General</title> |
| <style type="text/css"> |
| <!-- |
| .dtd { |
| font-family: monospace; |
| font-size: 90%; |
| background-color: #CCCCFF; |
| border-style: dotted; |
| border-width: 1px; |
| } |
| |
| .xmlExample { |
| font-family: monospace; |
| font-size: 80% |
| } |
| |
| .blockedInherited { |
| font-style: italic; |
| font-weight: bold; |
| border-style: dashed; |
| border-width: 1px; |
| background-color: #FF0000 |
| } |
| |
| .inherited { |
| font-weight: bold; |
| border-style: dashed; |
| border-width: 1px; |
| background-color: #00FF00 |
| } |
| |
| .element { |
| font-weight: bold; |
| color: red; |
| } |
| |
| .attribute { |
| font-weight: bold; |
| color: maroon; |
| } |
| |
| .attributeValue { |
| font-weight: bold; |
| color: blue; |
| } |
| |
| li, p { |
| margin-top: 0.5em; |
| margin-bottom: 0.5em |
| } |
| |
| h2, h3, h4, table { |
| margin-top: 1.5em; |
| margin-bottom: 0.5em; |
| } |
| --> |
| </style> |
| </head> |
| <body> |
| <table class="header" width="100%"> |
| <tr> |
| <td class="icon"><a href="https://unicode.org"><img alt= |
| "[Unicode]" src="../logo60s2.gif" |
| width="34" height="33" style= |
| "vertical-align: middle; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px; border-top-width: 0px;"></a> |
| <a class="bar" href= |
| "https://www.unicode.org/reports/">Technical Reports</a></td> |
| </tr> |
| <tr> |
| <td class="gray"> </td> |
| </tr> |
| </table> |
| <div class="body"> |
| <h2 style="text-align: center">Unicode Technical Standard #35</h2> |
| <h1>Unicode Locale Data Markup Language (LDML)<br> |
| Part 2: General</h1> |
| <!-- At least the first row of this header table should be identical across the parts of this UTS. --> |
| <table border="1" cellpadding="2" cellspacing="0" class="wide"> |
| <tr> |
| <td>Version</td> |
| <td>38</td> |
| </tr> |
| <tr> |
| <td>Editors</td> |
| <td>Yoshito Umaoka (<a href= |
| "mailto:[email protected]">[email protected]</a>) |
| and <a href="tr35.html#Acknowledgments">other CLDR |
| committee members</a></td> |
| </tr> |
| </table> |
| <p>For the full header, summary, and status, see <a href= |
| "tr35.html">Part 1: Core</a></p> |
| <h3><i>Summary</i></h3> |
| <p>This document describes parts of an XML format |
| (<i>vocabulary</i>) for the exchange of structured locale data. |
| This format is used in the <a href= |
| "https://unicode.org/cldr/">Unicode Common Locale Data |
| Repository</a>.</p> |
| <p>This is a partial document, describing general parts of the |
| LDML: display names & transforms, etc. For the other parts |
| of the LDML see the <a href="tr35.html">main LDML document</a> |
| and the links above.</p> |
| <h3><i>Status</i></h3> |
| |
| <!-- NOT YET APPROVED |
| <p> |
| <i class="changed">This is a<b><font color="#ff3333"> |
| draft </font></b>document which may be updated, replaced, or superseded by |
| other documents at any time. Publication does not imply endorsement |
| by the Unicode Consortium. This is not a stable document; it is |
| inappropriate to cite this document as other than a work in |
| progress. |
| </i> |
| </p> |
| END NOT YET APPROVED --> |
| <!-- APPROVED --> |
| <p><i>This document has been reviewed by Unicode members and |
| other interested parties, and has been approved for publication |
| by the Unicode Consortium. This is a stable document and may be |
| used as reference material or cited as a normative reference by |
| other specifications.</i></p> |
| <!-- END APPROVED --> |
| |
| <blockquote> |
| <p><i><b>A Unicode Technical Standard (UTS)</b> is an |
| independent specification. Conformance to the Unicode |
| Standard does not imply conformance to any UTS.</i></p> |
| </blockquote> |
| <p><i>Please submit corrigenda and other comments with the CLDR |
| bug reporting form [<a href="tr35.html#Bugs">Bugs</a>]. Related |
| information that is useful in understanding this document is |
| found in the <a href="tr35.html#References">References</a>. For |
| the latest version of the Unicode Standard see [<a href= |
| "tr35.html#Unicode">Unicode</a>]. For a list of current Unicode |
| Technical Reports see [<a href= |
| "tr35.html#Reports">Reports</a>]. For more information about |
| versions of the Unicode Standard, see [<a href= |
| "tr35.html#Versions">Versions</a>].</i></p> |
| <!-- This section of Parts should be identical in all of the parts of this UTS. --> |
| <h2><a name="Parts" href="#Parts" id="Parts">Parts</a></h2> |
| <p>The LDML specification is divided into the following |
| parts:</p> |
| <ul class="toc"> |
| <li>Part 1: <a href="tr35.html#Contents">Core</a> (languages, |
| locales, basic structure)</li> |
| <li>Part 2: <a href="tr35-general.html#Contents">General</a> |
| (display names & transforms, etc.)</li> |
| <li>Part 3: <a href="tr35-numbers.html#Contents">Numbers</a> |
| (number & currency formatting)</li> |
| <li>Part 4: <a href="tr35-dates.html#Contents">Dates</a> |
| (date, time, time zone formatting)</li> |
| <li>Part 5: <a href= |
| "tr35-collation.html#Contents">Collation</a> (sorting, |
| searching, grouping)</li> |
| <li>Part 6: <a href= |
| "tr35-info.html#Contents">Supplemental</a> (supplemental |
| data)</li> |
| <li>Part 7: <a href= |
| "tr35-keyboards.html#Contents">Keyboards</a> (keyboard |
| mappings)</li> |
| </ul> |
| <h2><a name="Contents" href="#Contents" id="Contents">Contents |
| of Part 2, General</a></h2> |
| <!-- START Generated TOC: CheckHtmlFiles --> |
| <ul class="toc"> |
| <li>1 <a href="#Display_Name_Elements">Display Name |
| Elements</a> |
| <ul class='toc'> |
| <li>1.1 <a href="#locale_display_name_algorithm">Locale Display Name Algorithm</a></li> |
| <li>1.2 <a href="#locale_display_name_fields">Locale Display Name Fields</a></li> |
| </ul> |
| </li> |
| <li>2 <a href="#Layout_Elements">Layout Elements</a></li> |
| <li>3 <a href="#Character_Elements">Character Elements</a> |
| <ul class="toc"> |
| <li>3.1 <a href="#Exemplars">Exemplars</a> |
| <ul class="toc"> |
| <li>3.1.1 <a href="#ExemplarSyntax">Exemplar |
| Syntax</a></li> |
| <li>3.1.2 <a href= |
| "#Restrictions">Restrictions</a></li> |
| </ul> |
| </li> |
| <li>3.2 <a href="#Character_Mapping">Mapping</a></li> |
| <li>3.3 <a href="#IndexLabels">Index Labels</a></li> |
| <li>3.4 <a href="#Ellipsis">Ellipsis</a></li> |
| <li>3.5 <a href="#Character_More_Info">More |
| Information</a></li> |
| <li>3.6 <a href="#Character_Parse_Lenient">Parse |
| Lenient</a></li> |
| </ul> |
| </li> |
| <li>4 <a href="#Delimiter_Elements">Delimiter |
| Elements</a></li> |
| <li>5 <a href="#Measurement_System_Data">Measurement System |
| Data</a> |
| <ul class="toc"> |
| <li>5.1 <a href="#Measurement_Elements">Measurement |
| Elements (deprecated)</a></li> |
| </ul> |
| </li> |
| <li>6 <a href="#Unit_Elements">Unit Elements</a> |
| <ul class="toc"> |
| <li>6.1 <a href="#Unit_Preference_and_Conversion">Unit Preference and Conversion Data</a></li> |
| <li>6.2 <a href="#Unit_Identifiers">Unit Identifiers</a></li> |
| <li>6.3 <a href="#Example_Units">Example Units</a></li> |
| <li>6.4 <a href="#compound-units">Compound Units</a></li> |
| <li>6.5 <a href="#Unit_Sequences">Unit Sequences (Mixed Units)</a></li> |
| <li>6.6 <a href="#durationUnit">durationUnit</a></li> |
| <li>6.7 <a href="#coordinateUnit">coordinateUnit</a></li> |
| <li>6.8 <a href= "#Territory_Based_Unit_Preferences">Territory-Based Unit |
| Preferences</a></li> |
| </ul> |
| </li> |
| <li>7 <a href="#POSIX_Elements">POSIX Elements</a></li> |
| <li>8 <a href="#Reference_Elements">Reference |
| Element</a></li> |
| <li>9 <a href="#Segmentations">Segmentations</a> |
| <ul class="toc"> |
| <li>9.1 <a href="#Segmentation_Inheritance">Segmentation |
| Inheritance</a></li> |
| <li>9.2 <a href="#Segmentation_Exceptions">Segmentation |
| Suppressions</a></li> |
| </ul> |
| </li> |
| <li>10 <a href="#Transforms">Transforms</a> |
| <ul class="toc"> |
| <li>10.1 <a href="#Inheritance">Inheritance</a> |
| <ul class="toc"> |
| <li>10.1.1 <a href="#Pivots">Pivots</a></li> |
| </ul> |
| </li> |
| <li>10.2 <a href="#Variants">Variants</a></li> |
| <li>10.3 <a href="#Transform_Rules_Syntax">Transform |
| Rules Syntax</a> |
| <ul class="toc"> |
| <li>10.3.1 <a href="#Dual_Rules">Dual Rules</a></li> |
| <li>10.3.2 <a href="#Context">Context</a></li> |
| <li>10.3.3 <a href="#Revisiting">Revisiting</a></li> |
| <li>10.3.4 <a href="#Example">Example</a></li> |
| <li>10.3.5 <a href="#Rule_Syntax">Rule |
| Syntax</a></li> |
| <li>10.3.6 <a href="#Transform_Rules">Transform |
| Rules</a></li> |
| <li>10.3.7 <a href= |
| "#Variable_Definition_Rules">Variable Definition |
| Rules</a></li> |
| <li>10.3.8 <a href="#Filter_Rules">Filter |
| Rules</a></li> |
| <li>10.3.9 <a href="#Conversion_Rules">Conversion |
| Rules</a></li> |
| <li>10.3.10 <a href= |
| "#Intermixing_Transform_Rules_and_Conversion_Rules">Intermixing |
| Transform Rules and Conversion Rules</a></li> |
| <li>10.3.11 <a href="#Inverse_Summary">Inverse |
| Summary</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li>11 <a href="#ListPatterns">List Patterns</a> |
| <ul class="toc"> |
| <li>11.1 <a href="#List_Gender">Gender of Lists</a></li> |
| </ul> |
| </li> |
| <li>12 <a href="#Context_Transform_Elements">ContextTransform |
| Elements</a> |
| <ul class="toc"> |
| <li>Table: <a href= |
| "#contextTransformUsage_type_attribute_values">Element |
| contextTransformUsage type attribute values</a></li> |
| </ul> |
| </li> |
| <li>13 <a href="#Choice_Patterns">Choice Patterns</a></li> |
| <li>14 <a href="#Annotations">Annotations and Labels</a> |
| <ul class="toc"> |
| <li>14.1 <a href="#SynthesizingNames">Synthesizing |
| Sequence Names</a></li> |
| <li>14.2 <a href="#Character_Labels">Annotations |
| Character Labels</a></li> |
| <li>14.3 <a href="#Typographic_Names">Typographic |
| Names</a></li> |
| </ul> |
| </li> |
| <li>15 <a href="#Grammatical_Features">Grammatical Features</a> |
| <ul class="toc"> |
| <li>15.1 <a href="#Gender" >Gender</a></li> |
| <li>15.2 <a href="#Case">Case</a></li> |
| </ul> |
| </li> |
| <li>16 <a href="#Grammatical_Derivations">Grammatical Derivations</a> |
| <ul class="toc"><li>16.1<a href="#gender_compound_units">Deriving the Gender of Compound Units</a></li> |
| <li>16.2 <a href="#plural_compound_units">Deriving the Plural Category of Unit Components</a></li> |
| <li>16.3 <a href="#case_compound_units">Deriving the Case of Unit Components</a></li> |
| </ul> |
| </li> |
| <li> </li> |
| </ul> |
| <h2>1 <a name="Display_Name_Elements" href= |
| "#Display_Name_Elements" id="Display_Name_Elements">Display |
| Name Elements</a></h2> |
| <p class="dtd"><!ELEMENT localeDisplayNames ( alias | ( |
| localeDisplayPattern?, languages?, scripts?, territories?, |
| subdivisions?, variants?, keys?, types?, transformNames?, |
| measurementSystemNames?, codePatterns?, special* ) )></p> |
| <p>Display names for scripts, languages, countries, currencies, |
| and variants in this locale are supplied by this element. They |
| supply localized names for these items for use in |
| user-interfaces for various purposes such as displaying menu |
| lists, displaying a language name in a dialog, and so on. |
| Capitalization should follow the conventions used in the middle |
| of running text; the <contextTransforms> element may be |
| used to specify the appropriate capitalization for other |
| contexts (see <i>Section 12 <a href= |
| "#Context_Transform_Elements">ContextTransform Elements</a></i> |
| ). Examples are given below.</p> |
| <blockquote> |
| <p class="note"><b>Note:</b> The "<span style= |
| "color: blue">en</span>" locale may contain translated names |
| for deprecated codes for debugging purposes. Translation of |
| deprecated codes into other languages is discouraged.</p> |
| </blockquote> |
| <p>Where present, the display names must be unique; that is, |
| two distinct code would not get the same display name. (There |
| is one exception to this: in time zones, where parsing results |
| would give the same GMT offset, the standard and daylight |
| display names can be the same across different time zone |
| IDs.)</p> |
| <p>Any translations should follow customary practice for the |
| locale in question. For more information, see [<a href= |
| "tr35.html#DataFormats">Data Formats</a>].</p> |
| <p class="element2"><localeDisplayPattern></p> |
| <p class="dtd"><!ELEMENT localeDisplayPattern ( alias | |
| (localePattern*, localeSeparator*, localeKeyTypePattern*, |
| special*) ) ></p> |
| <p>For compound language (locale) IDs such as "pt_BR" which |
| contain additional subtags beyond the initial language code: |
| When the <languages> data does not explicitly specify a |
| display name such as "Brazilian Portuguese" for a given |
| compound language ID, "Portuguese (Brazil)" from the display |
| names of the subtags.</p> |
| <p>It includes three sub-elements:</p> |
| <ul> |
| <li>The <localePattern> element specifies a pattern |
| such as "{0} ({1})" in which {0} is replaced by the display |
| name for the primary language subtag and {1} is replaced by a |
| list of the display names for the remaining subtags.</li> |
| <li>The <localeSeparator> element specifies a pattern |
| such as "{0}, {1}" used when appending a subtag display name |
| to the list in the <localePattern> subpattern {1} |
| above. If that list includes more than one display name, then |
| <localeSeparator> subpattern {1} represents a new |
| display name to be appended to the current list in {0}. |
| <em>Note: Before CLDR 24, the <localeSeparator> element |
| specified a separator string such as ", ", not a |
| pattern.</em></li> |
| <li>The <localeKeyTypePattern> element specifies the |
| pattern used to display key-type pairs, such as "{0}: |
| {1}"</li> |
| </ul> |
| <p>For example, for the locale identifier |
| zh_Hant_CN_co_pinyin_cu_USD, the display would be "Chinese |
| (Traditional, China, Pinyin Sort Order, Currency: USD)". The |
| key-type for co_pinyin doesn't use the localeKeyTypePattern |
| because there is a translation for the key-type in English:</p> |
| <blockquote> |
| <p><type type="pinyin" key="collation">Pinyin Sort |
| Order</type></p> |
| </blockquote> |
| |
| <h3>1.1 <a href="#locale_display_name_algorithm" name="locale_display_name_algorithm">Locale Display Name Algorithm</a></h3> |
| |
| <p>A locale display name LDN is generated for a locale identifer L in the following way. First, canonicalize the locale identifier as per <strong><a href="tr35.html#Canonical_Unicode_Locale_Identifiers">Part 1, Section 3.2.1 Canonical Unicode Locale Identifiers</a></strong>. That will put the subtags in a defined order, and replace aliases by their canonical counterparts. (That defined order is followed in the processing below.) </p> |
| <p>Then follow each of the following steps for the subtags in L, building a base name LDN and a list of qualifying strings LQS.</p> |
| <p>Where there is a match for a subtag, disregard that subtag from L and add the element value to LDN or LQS as described bbelow. If there is no match for a subtag, use the fallback pattern with the subtag subtag instead.</p> |
| <p>Once LDN and LQS are built, return the following based on the length of LQS. </p> |
| <table class='simple'> |
| <tr> |
| <td>0</td> |
| <td>return LDN</td> |
| </tr> |
| <tr> |
| <td>1</td> |
| <td>use the <localePattern> to compose the result LDN from LDN and LQS[0], and return it.</td> |
| </tr> |
| <tr> |
| <td>>1</td> |
| <td>use the <localeSeparator> element value to join the elements of the list into LDN2, then use the <localePattern> to compose the result LDN from LDN and LDN2, and return it.</td> |
| </tr> |
| </table> |
| |
| <p>The processing can be controled via the following parameters.</p> |
| <ul> |
| <li>CombineLanguage: boolean |
| <ul> |
| <li>Example: the CombineLanguage = true, picking the bold value below.</li> |
| <li> <language type="nl">Dutch</language></li> |
| <li><strong><language type="nl_BE">Flemish</language></strong></li> |
| </ul> |
| </li> |
| <li>PreferAlt: map from element to preferrred alt value, picking the bold value below. |
| <ul> |
| <li>Example: the PreferAlt contains {"language"="short"}:</li> |
| <li><language type="az">Azerbaijani</language></li> |
| <li><strong><language type="az" alt="short">Azeri</language></strong></li> |
| </ul> |
| </li> |
| </ul> |
| <p> In addition, the input locale display name could be minimized (see <a href="tr35.html#Likely_Subtags">Part 1: Section 4.3 Likely Subtags</a>) before generating the LDN. Selective minimization is often the best choice. For example, in a menu list it is often clearer to show the region if there are any regional variants. Thus the user would just see ["Spanish"] for es if the latter is the only supported Spanish, but where es-MX is also listed, then see ["Spanish (Spain)", "Spanish (Mexico)"].</p> |
| <hr> |
| <p><strong>Processing types of locale identifier subtags</strong> </p> |
| <p>When the display name contains "(" or ")" characters (or full-width equivalents), replace them "[", "]" (or full-width equivalents) before adding.</p> |
| <ol> |
| <li><strong>Language. </strong>Match the L subtags against the type values in the <language> elements. Pick the element with the most subtags matching. If there is more than one such element, pick the one that has subtypes matching earlier. If there are two such elements, pick the one that is alphabetically less. Set LBN to that value. Disregard any of the matching subtags in the following processing. |
| <ul> |
| <li>If CombineLanguage is false, only choose matches with the language subtag matching.</li> |
| </ul> |
| </li> |
| <li><strong>Script, Region, Variants.</strong> Where any of these subtags are in L, append the matching element value to LQS.</li> |
| <li><strong>T extensions. </strong>Get the value of the key="h0" type="hybrid" element, if there is one; otherwise the value of the <key type="t"> element. Next get the locale display name of the tlang. Join the pair using localePattern> and append to the LQS. Then format and add display names to LQS for any of the remaining tkey-tvalue pairs as described below.</li> |
| <li><strong>U extensions. </strong>If there is an attribute value A, process the key-value pair <"u", A> as below and append to LQS. Then format and add display names for each of the remaining key-type pairs as described below.</li> |
| <li><strong>Other extensions. </strong>There are currently no such extensions defined. Until such time as there are formats defined for them, append each of the extensions’s subtags to LQS.</li> |
| <li><strong>Private Use extensions. </strong>Get the value </li> |
| </ol> |
| <p><strong>Formatting T/U Key-Value pairs as display names</strong></p> |
| <ol> |
| <li> If there is a match for the key/value, then append the element value and return.</li> |
| <li>Otherwise, get the display name for the key, using the subtag if not available.</li> |
| <li>Format special values. As usual, if lacking data, use the subtag(s). |
| <ol> |
| <li>key="kr": (REORDER_CODE) assume the value is a script code, and get its display name.</li> |
| <li>key="dx": (SCRIPT_CODE) assume the value is a script code, and get its display name.</li> |
| <li>key="vt": (CODEPOINTS, deprecated) the value is a list of code points. Set the value display name to it, after replacing [-_] by space.</li> |
| <li>key="x0": (PRIVATE_USE) the value is a list of subtags. No formatting available, so use the subtag(s).</li> |
| <li>key="sd": (SUBDIVISION_CODE) use the subdivision data to find the display name.</li> |
| <li>key="rg": (RG_KEY_VALUE): handle as with key="sd"</li> |
| </ol> |
| </li> |
| <li>Then use the value of the <localeKeyTypePattern> element to join the key display name and the value display name, and append the result to LQS. </li> |
| </ol> |
| <p><strong>Examples of English locale display names</strong></p> |
| <table class='simple'> |
| <tr> |
| <th>Locale identifier</th> |
| <th>Locale display name</th> |
| </tr> |
| <tr> |
| <td>es</td> |
| <td>Spanish</td> |
| </tr> |
| <tr> |
| <td>es-419</td> |
| <td>Spanish (Latin America)</td> |
| </tr> |
| <tr> |
| <td>es-Cyrl-MX</td> |
| <td>Spanish (Cyrillic, Mexico)</td> |
| </tr> |
| <tr> |
| <td>en-Latn-GB-fonipa-scouse</td> |
| <td>English (Latin, United Kingdom, IPA Phonetics, Scouse)</td> |
| </tr> |
| <tr> |
| <td>en-u-nu-thai-ca-islamic-civil</td> |
| <td>English (Calendar: islamic-civil, Thai Digits)</td> |
| </tr> |
| <tr> |
| <td>hi-u-nu-latn-t-en-h0-hybrid</td> |
| <td>Hindi (Hybrid: English, Western Digits)</td> |
| </tr> |
| <tr> |
| <td>en-u-nu-deva-t-de</td> |
| <td>English (Transform: German, Devanagari Digits)</td> |
| </tr> |
| <tr> |
| <td>fr-z-zz-zzz-v-vv-vvv-u-uu-uuu-t-ru-Cyrl-s-ss-sss-a-aa-aaa-x-u-x</td> |
| <td>French (Transform: Russian [Cyrillic], uu: uuu, a: aa-aaa, s: ss-sss, v: vv-vvv, x: u-x, z: zz-zzz)</td> |
| </tr> |
| </table><br> |
| <h3>1.2 <a href="#locale_display_name_fields" name="locale_display_name_fields">Locale Display Name Fields</a></h3> |
| |
| <p class="element2"><languages></p> |
| <p>This contains a list of elements that provide the |
| user-translated names for language codes, as described in |
| <i><a href= |
| "tr35.html#Unicode_Language_and_Locale_Identifiers">Section 3, |
| Unicode Language and Locale Identifiers</a></i>.</p> |
| <blockquote> |
| <pre><language type="<span style= |
| "color: blue">ab</span>"><span style= |
| "color: blue">Abkhazian</span></language> |
| <language type="<span style= |
| "color: blue">aa</span>"><span style= |
| "color: blue">Afar</span></language> |
| <language type="<span style= |
| "color: blue">af</span>"><span style= |
| "color: blue">Afrikaans</span></language> |
| <language type="<span style= |
| "color: blue">sq</span>"><span style= |
| "color: blue">Albanian</span></language> |
| </pre> |
| </blockquote> |
| <p>There should be no expectation that the list of languages |
| with translated names be complete: there are thousands of |
| languages that could have translated names. For debugging |
| purposes or comparison, when a language display name is |
| missing, the Description field of the language subtag registry |
| can be used to supply a fallback English user-readable |
| name.</p> |
| <p>The type can actually be any locale ID as specified above. |
| The set of which locale IDs is not fixed, and depends on the |
| locale. For example, in one language one could translate the |
| following locale IDs, and in another, fall back on the normal |
| composition.</p> |
| <table border="1" cellpadding="4" cellspacing="0"> |
| <tr> |
| <th width="33%">type</th> |
| <th width="33%">translation</th> |
| <th width="34%">composition</th> |
| </tr> |
| <tr> |
| <td width="33%">nl_BE</td> |
| <td width="33%">Flemish</td> |
| <td width="34%">Dutch (Belgium)</td> |
| </tr> |
| <tr> |
| <td width="33%">zh_Hans</td> |
| <td width="33%">Simplified Chinese</td> |
| <td width="34%">Chinese (Simplified)</td> |
| </tr> |
| <tr> |
| <td width="33%">en_GB</td> |
| <td width="33%">British English</td> |
| <td width="34%">English (United Kingdom)</td> |
| </tr> |
| </table> |
| <p>Thus when a complete locale ID is formed by composition, the |
| longest match in the language type is used, and the remaining |
| fields (if any) added using composition.</p> |
| <p>Alternate short forms may be provided for some languages |
| (and for territories and other display names), for example.</p> |
| <blockquote> |
| <pre><language type="<span style= |
| "color: blue">az</span>"><span style= |
| "color: blue">Azerbaijani</span></language> |
| <language type="<span style= |
| "color: blue">az</span>" alt="<span style= |
| "color: blue">short</span>"><span style= |
| "color: blue">Azeri</span></language> |
| <language type="<span style= |
| "color: blue">en_GB</span>"><span style= |
| "color: blue">British English</span></language> |
| <language type="<span style= |
| "color: blue">en_GB</span>" alt="<span style= |
| "color: blue">short</span>"><span style= |
| "color: blue">U.K. English</span></language> |
| <language type="<span style= |
| "color: blue">en_US</span>"><span style= |
| "color: blue">American English</span></language> |
| <language type="<span style= |
| "color: blue">en_US</span>" alt="<span style= |
| "color: blue">short</span>"><span style= |
| "color: blue">U.S. English</span></language> |
| </pre> |
| </blockquote> |
| <p class="element2"><scripts></p> |
| <p>This element can contain an number of script elements. Each |
| script element provides the localized name for a script code, |
| as described in <i><a href= |
| "tr35.html#Unicode_Language_and_Locale_Identifiers">Section 3, |
| Unicode Language and Locale Identifiers</a></i> (see also |
| <i>UAX #24: Script Names</i> [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX24">UAX24</a>]). For |
| example, in the language of this locale, the name for the Latin |
| script might be "Romana", and for the Cyrillic script is |
| "Kyrillica". That would be expressed with the following.</p> |
| <blockquote> |
| <pre><script type="<span style= |
| "color: blue">Latn</span>"><span style= |
| "color: blue">Romana</span></script> |
| <script type="<span style= |
| "color: blue">Cyrl</span>"><span style= |
| "color: blue">Kyrillica</span></script> |
| </pre> |
| </blockquote> |
| <p>The script names are most commonly used in conjunction with |
| a language name, using the <localePattern> combining |
| pattern, and the default form of the script name should be |
| suitable for such use. When a script name requires a different |
| form for stand-alone use, this can be specified using the |
| "stand-alone" alternate:</p> |
| <blockquote> |
| <pre><script type="<span style= |
| "color: blue">Hans</span>"><span style= |
| "color: blue">Simplified</span></script> |
| <script type="<span style= |
| "color: blue">Hans</span>" alt="<span style= |
| "color: blue">stand-alone</span>"><span style= |
| "color: blue">Simplified Han</span></script> |
| <script type="<span style= |
| "color: blue">Hant</span>"><span style= |
| "color: blue">Traditional</span></script> |
| <script type="<span style= |
| "color: blue">Hant</span>" alt="<span style= |
| "color: blue">stand-alone</span>"><span style= |
| "color: blue">Traditional Han</span></script> |
| </pre> |
| </blockquote> |
| <p>This will produce results such as the following:</p> |
| <ul> |
| <li>Display name of language + script, using |
| <localePattern>: “Chinese (Simplified)”</li> |
| <li>Display name of script alone, using |
| <localePattern>: “Simplified Han”</li> |
| </ul> |
| <p class="element2"><territories></p> |
| <p>This contains a list of elements that provide the |
| user-translated names for territory codes, as described in |
| <i><a href= |
| "tr35.html#Unicode_Language_and_Locale_Identifiers">Section 3, |
| Unicode Language and Locale Identifiers</a></i>.</p> |
| <blockquote> |
| <pre><territory type="<span style= |
| "color: blue">AD</span>"><span style= |
| "color: blue">Andorra</span></territory> |
| <territory type="<span style= |
| "color: blue">AF</span>"><span style= |
| "color: blue">Afghanistan</span></territory> |
| <territory type="<span style= |
| "color: blue">AL</span>"><span style= |
| "color: blue">Albania</span></territory> |
| <territory type="<span style= |
| "color: blue">AO</span>"><span style= |
| "color: blue">Angola</span></territory> |
| <territory type="<span style= |
| "color: blue">DZ</span>"><span style= |
| "color: blue">Algeria</span></territory> |
| <territory type="<span style= |
| "color: blue">GB</span>"><span style= |
| "color: blue">United Kingdom</span></territory> |
| <territory type="<span style= |
| "color: blue">GB</span>" alt="<span style= |
| "color: blue">short</span>"><span style= |
| "color: blue">U.K.</span></territory> |
| <territory type="<span style= |
| "color: blue">US</span>"><span style= |
| "color: blue">United States</span></territory> |
| <territory type="<span style= |
| "color: blue">US</span>" alt="<span style= |
| "color: blue">short</span>"><span style= |
| "color: blue">U.S.</span></territory> |
| </pre> |
| </blockquote> |
| <p class="element2"><variants></p> |
| <p>This contains a list of elements that provide the |
| user-translated names for the <i>variant_code</i> values |
| described in <i><a href= |
| "tr35.html#Unicode_Language_and_Locale_Identifiers">Section 3, |
| Unicode Language and Locale Identifiers</a></i> .</p> |
| <blockquote> |
| <pre><variant type="<span style= |
| "color: blue">nynorsk</span>"><span style= |
| "color: blue">Nynorsk</span></variant> |
| </pre> |
| </blockquote> |
| <p class="element2"><keys></p> |
| <p>This contains a list of elements that provide the |
| user-translated names for the <i>key</i> values described in |
| <i><a href= |
| "tr35.html#Unicode_Language_and_Locale_Identifiers">Section 3, |
| Unicode Language and Locale Identifiers</a></i>.</p> |
| <blockquote> |
| <pre><key type="<span style= |
| "color: blue">collation</span>"><span style= |
| "color: blue">Sortierung</span></key></pre> |
| </blockquote> |
| <p>Note that the <strong>type</strong> values may use aliases. Thus if the locale u-extension key "co" does not match, then the aliases have to be tried, using the bcp47 XML data:</p> |
| <blockquote> |
| <p> <key name="<strong>co</strong>" description="…" alias="<strong>collation</strong>"></p> |
| </blockquote> |
| <p class="element2"><types></p> |
| <p>This contains a list of elements that provide the |
| user-translated names for the <i>type</i> values |
| described in <i><a href= |
| "tr35.html#Unicode_Language_and_Locale_Identifiers">Section 3, |
| Unicode Language and Locale Identifiers</a></i> . Since the |
| translation of an option name may depend on the <i>key</i> it |
| is used with, the latter is optionally supplied.</p> |
| <blockquote> |
| <pre><type type="<span style= |
| "color: blue">phonebook</span>" key="<span style= |
| "color: blue">collation</span>"><span style= |
| "color: blue">Telefonbuch</span></type> |
| </pre> |
| </blockquote> |
| <p>Note that the <strong>key</strong> and <strong>type</strong> values may use aliases. Thus if the locale u-extension key "co" does not match, then the aliases have to be tried, using the bcp47 XML data.</p> |
| <blockquote> |
| <p><key name="<strong>co</strong>" description="…" alias="<strong>collation</strong>"></p> |
| <p> <type name="<strong>phonebk</strong>" description="…" alias="<strong>phonebook</strong>"/></p> |
| </blockquote> |
| <p class="element2"><measurementSystemNames></p> |
| <p>This contains a list of elements that provide the |
| user-translated names for systems of measurement. The types |
| currently supported are "<span style="color: blue">US</span>", |
| "<span style="color: blue">metric</span>", and "<span style= |
| "color: blue">UK</span>".</p> |
| <blockquote> |
| <pre><measurementSystemName type="<span style= |
| "color: blue">US</span>"><span style= |
| "color: blue">U.S.</span></type> |
| </pre> |
| </blockquote> |
| <p class="note"><b>Note:</b> In the future, we may need to add |
| display names for the particular measurement units (millimeter |
| versus millimetre versus whatever the Greek, Russian, etc are), |
| and a message format for positioning those with respect to |
| numbers. For example, "{number} {unitName}" in some languages, |
| but "{unitName} {number}" in others.</p> |
| <p class="element2"><transformNames></p> |
| <p> </p> |
| <blockquote> |
| <pre><transformName type="<span style= |
| "color: blue">Numeric</span>"><span style= |
| "color: blue">Numeric</span></type> |
| </pre> |
| </blockquote> |
| <p class="element2"><codePatterns></p> |
| <blockquote> |
| <pre><codePattern type="<span style= |
| "color: blue">language</span>"><span style= |
| "color: blue">Language: {0}</span></type> |
| </pre> |
| </blockquote> |
| <p class="dtd"><!ELEMENT subdivisions ( alias | ( |
| subdivision | special )* ) ><br> |
| <!ELEMENT subdivision ( #PCDATA )></p> |
| <p>Note that the subdivision names are in separate files, in |
| the subdivisions/ directory. The type values are the fully |
| qualified subdivsion names. For example:</p> |
| <p class="xmlExample"><subdivision type="AL-04">Fier |
| County</subdivision><br> |
| <subdivision type="AL-FR">Fier</subdivision> |
| <!-- in AL-04 : Fier County --><br> |
| <subdivision type="AL-LU">Lushnjë</subdivision> |
| <!-- in AL-04 : Fier County --><br> |
| <subdivision type="AL-MK">Mallakastër</subdivision> |
| <!-- in AL-04 : Fier County --></p> |
| <p>See also <strong>Part 6</strong> <em>Section 2.1.1 <a href= |
| "tr35-info.html#Subdivision_Containment">Subdivision |
| Containment</a></em>.</p> |
| <h2>2 <a name="Layout_Elements" href="#Layout_Elements" id= |
| "Layout_Elements">Layout Elements</a></h2> |
| <p class="dtd"><!ELEMENT layout ( alias | (orientation*, |
| inList*, inText*, special*) ) ></p> |
| <p>This top-level element specifies general layout features. It |
| currently only has one possible element (other than |
| <special>, which is always permitted).</p> |
| <p class="dtd"><!ELEMENT orientation ( characterOrder*, |
| lineOrder*, special* ) ><br> |
| <!ELEMENT characterOrder ( #PCDATA ) ><br> |
| <!ELEMENT lineOrder ( #PCDATA ) ></p> |
| <p>The lineOrder and characterOrder elements specify the |
| default general ordering of lines within a page, and characters |
| within a line. The possible values are:</p> |
| <table> |
| <tr> |
| <th>Direction</th> |
| <th>Value</th> |
| </tr> |
| <tr> |
| <td rowspan="2">Vertical</td> |
| <td>top-to-bottom</td> |
| </tr> |
| <tr> |
| <td>bottom-to-top</td> |
| </tr> |
| <tr> |
| <td rowspan="2">Horizontal</td> |
| <td>left-to-right</td> |
| </tr> |
| <tr> |
| <td>right-to-left</td> |
| </tr> |
| </table> |
| <p>If the value of lineOrder is one of the vertical values, |
| then the value of characterOrder must be one of the horizontal |
| values, and vice versa. For example, for English the lines are |
| top-to-bottom, and the characters are left-to-right. For |
| Mongolian (in the Mongolian Script) the lines are |
| right-to-left, and the characters are top to bottom. This does |
| not override the ordering behavior of bidirectional text; it |
| does, however, supply the paragraph direction for that text |
| (for more information, see <i>UAX #9: The Bidirectional |
| Algorithm</i> [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX9">UAX9</a>]).</p> |
| <p>For dates, times, and other data to appear in the right |
| order, the display for them should be set to the orientation of |
| the locale.</p> |
| <p><inList> (deprecated)</p> |
| <p>The <inList> element is deprecated and has been |
| superseded by the <contextTransforms> element; see |
| <i>Section 12 <a href= |
| "#Context_Transform_Elements">ContextTransform Elements</a></i> |
| .</p> |
| <p>This element controls whether display names (language, |
| territory, etc) are title cased in GUI menu lists and the like. |
| It is only used in languages where the normal display is lower |
| case, but title case is used in lists. There are two |
| options:</p> |
| <pre><inList casing="titlecase-words"></pre> |
| <pre><inList casing="titlecase-firstword"></pre> |
| <p>In both cases, the title case operation is the default title |
| case function defined by Chapter 3 of <i>[<a href= |
| "tr35.html#Unicode">Unicode</a>]</i> . In the second case, only |
| the first word (using the word boundaries for that locale) will |
| be title cased. The results can be fine-tuned by using |
| alt="list" on any element where titlecasing as defined by the |
| Unicode Standard will produce the wrong value. For example, |
| suppose that "turc de Crimée" is a value, and the title case |
| should be "Turc de Crimée". Then that can be expressed using |
| the alt="list" value.</p> |
| <p><inText> (deprecated)</p> |
| <p>The <inList> element is deprecated and has been |
| superseded by the <contextTransforms> element; see |
| <i>Section 12 <a href= |
| "#Context_Transform_Elements">ContextTransform Elements</a></i> |
| .</p> |
| <p>This element indicates the casing of the data in the |
| category identified by the inText type attribute, when that |
| data is written in text or how it would appear in a dictionary. |
| For example :</p> |
| <pre> |
| <inText type="languages">lowercase-words</inText></pre> |
| <p>indicates that language names embedded in text are normally |
| written in lower case. The possible values and their meanings |
| are :</p> |
| <ul> |
| <li>titlecase-words : all words in the phrase should be title |
| case</li> |
| <li>titlecase-firstword : the first word should be title |
| case</li> |
| <li>lowercase-words : all words in the phrase should be lower |
| case</li> |
| <li>mixed : a mixture of upper and lower case is permitted. |
| generally used when the correct value is unknown.</li> |
| </ul> |
| <h2>3 <a name="Character_Elements" href="#Character_Elements" |
| id="Character_Elements">Character Elements</a></h2> |
| <p class="dtd"><!ELEMENT characters ( alias | ( |
| exemplarCharacters*, ellipsis*, moreInformation*, stopwords*, |
| indexLabels*, mapping*, parseLenients*, special* ) ) ></p> |
| <p>The <characters> element provides optional information |
| about characters that are in common use in the locale, and |
| information that can be helpful in picking resources or data |
| appropriate for the locale, such as when choosing among |
| character encodings that are typically used to transmit data in |
| the language of the locale. It may also be used to help reduce |
| confusability issues: see [<a href= |
| "https://www.unicode.org/reports/tr41/#UTR36">UTR39</a>]. It |
| typically only occurs in a language locale, not in a |
| language/territory locale. The stopwords are an experimental |
| feature, and should not be used.</p> |
| <h3>3.1 <a name="Exemplars" href="#Exemplars" id= |
| "Exemplars">Exemplars</a></h3> |
| <p>Exemplars are characters used by a language, separated into |
| different categories. The following table provides a summary, |
| with more details below.</p> |
| <table> |
| <tr> |
| <th scope="col">Type</th> |
| <th scope="col">Description</th> |
| <th scope="col">Examples</th> |
| </tr> |
| <tr> |
| <td>main / standard</td> |
| <td>Main letters used in the language</td> |
| <td style= |
| "font-family: Georgia, 'Times New Roman', Times, serif">a-z |
| å æ ø</td> |
| </tr> |
| <tr> |
| <td><span class="element2">auxiliary</span></td> |
| <td>Additional characters for common foreign words, |
| technical usage</td> |
| <td style= |
| "font-family: Georgia, 'Times New Roman', Times, serif">á à |
| ă â å ä ã ā æ ç é è ĕ ê ë ē í ì ĭ î ï ī ñ ó ò ŏ ô ö ø ō œ ú |
| ù ŭ û ü ū ÿ</td> |
| </tr> |
| <tr> |
| <td><span class="element2">index</span></td> |
| <td>Characters for the header of an index</td> |
| <td style= |
| "font-family: Georgia, 'Times New Roman', Times, serif">A B |
| C D E F G H I J K L M N O P Q R S T U V W X Y Z</td> |
| </tr> |
| <tr> |
| <td>punctuation</td> |
| <td>Common punctuation</td> |
| <td style= |
| "font-family: Georgia, 'Times New Roman', Times, serif">- ‐ |
| – — , ; \: ! ? . … “ ” ‘ ’ ( ) [ ] § @ * / & # † ‡ ′ |
| ″</td> |
| </tr> |
| <tr> |
| <td>numbers</td> |
| <td>The characters needed to display the common number |
| formats: decimal, percent, and currency.</td> |
| <td style= |
| "font-family: Georgia, 'Times New Roman', Times, serif"> |
| [\u061C\u200E \- , ٫ ٬ . % ٪ ‰ ؉ + 0٠ 1١ 2٢ 3٣ 4٤ 5٥ 6٦ 7٧ |
| 8٨ 9٩]</td> |
| </tr> |
| </table> |
| <p>The basic exemplar character sets (main and auxiliary) |
| contain the commonly used letters for a given modern form of a |
| language, which can be for testing and for determining the |
| appropriate repertoire of letters for charset conversion or |
| collation. ("Letter" is interpreted broadly, as anything having |
| the property Alphabetic in the [<a href= |
| "https://unicode.org/reports/tr41/#UAX44">UAX44</a>], which also |
| includes syllabaries and ideographs.) It is not a complete set |
| of letters used for a language, nor should it be considered to |
| apply to multiple languages in a particular country. |
| Punctuation and other symbols should not be included in the |
| main and auxiliary sets. In particular, format characters like |
| CGJ are not included.</p> |
| <p>There are five sets altogether: main, auxiliary, |
| punctuation, numbers, and index. The <i>main</i> set should |
| contain the minimal set required for users of the language, |
| while the <i>auxiliary</i> exemplar set is designed to |
| encompass additional characters: those non-native or historical |
| characters that would customarily occur in common publications, |
| dictionaries, and so on. Major style guidelines are good |
| references for the auxiliary set. So, for example, if Irish |
| newspapers and magazines would commonly have Danish names using |
| å, for example, then it would be appropriate to include å in |
| the auxiliary exemplar characters; just not in the main |
| exemplar set. Thus English has the following:</p> |
| <p><exemplarCharacters>[a b c d e f g h i j k l m n o p q |
| r s t u v w x y z]</exemplarCharacters><br> |
| <exemplarCharacters type="auxiliary">[á à ă â å ä ã ā æ ç |
| é è ĕ ê ë ē í ì ĭ î ï ī ñ ó ò ŏ ô ö ø ō œ ú ù ŭ û ü ū |
| ÿ]</exemplarCharacters></p> |
| <p>For a given language, there are a few factors that help for |
| determining whether a character belongs in the auxiliary set, |
| instead of the main set:</p> |
| <ul> |
| <li>The character is not available on all normal |
| keyboards.</li> |
| <li>It is acceptable to always use spellings that avoid that |
| character.</li> |
| </ul> |
| <p>For example, the exemplar character set for en (English) is |
| the set [a-z]. This set does not contain the accented letters |
| that are sometimes seen in words like "résumé" or "naïve", |
| because it is acceptable in common practice to spell those |
| words without the accents. The exemplar character set for fr |
| (French), on the other hand, must contain those characters: |
| [a-z é è ù ç à â ê î ô û æ œ ë ï ÿ]. The main set typically |
| includes those letters commonly "alphabet".</p> |
| <p>The <em>punctuation</em> set consists of common punctuation |
| characters that are used with the language (corresponding to |
| main and auxiliary). Symbols may also be included where they |
| are common in plain text, such as ©. It does not include |
| characters with narrow technical usage, such as dictionary |
| punctuation/symbols or copy-edit symbols. For example, English |
| would have something like the following:</p> |
| <blockquote> |
| - ‐ – —<br> |
| , ; : ! ? . …<br> |
| ' ‘ ’ " “ ” ′ ″<br> |
| ( ) [ ] { } ⟨ ⟩<br> |
| © ® ™ @ & ° ‧ ·/ # % ¶ § * † ‡<br> |
| + − ± × ÷ < ≤ = ≅ ≥ > √<br> |
| </blockquote> |
| <p>The numbers exemplars does not currently include lesser-used |
| characters: exponential notation (3.1 × 10²³, ∞, NAN). Nor does |
| it contain the units or currency symbols such as $, ¥, ₹,… It |
| does contain %, because that occurs in the percent format. It |
| may contain some special formatting characters like the RLM. A |
| full list of the currency symbols used with that locale are in |
| the <currencies> element, while the units can be gotten |
| from the <units> element (both using inheritance, of |
| course).The digits used in each numbering system are accessed |
| in numberingSystems.xml. For more information, see |
| <em><strong>Part 3: <a href= |
| "tr35-numbers.html#Contents">Numbers</a></strong> , Section |
| 2 <a href="tr35-numbers.html#Number_Elements">Number |
| Elements</a></em>.</p> |
| <p><em>Examples for zh.xml:</em></p> |
| <table> |
| <tr> |
| <th scope="col">Type</th> |
| <th scope="col">Description</th> |
| </tr> |
| <tr> |
| <td>defaultNumberingSystem</td> |
| <td>latn</td> |
| </tr> |
| <tr> |
| <td>otherNumberingSystems/native</td> |
| <td>hanidec</td> |
| </tr> |
| <tr> |
| <td>otherNumberingSystems/traditional</td> |
| <td>hans</td> |
| </tr> |
| <tr> |
| <td>otherNumberingSystems/finance</td> |
| <td>hansfin</td> |
| </tr> |
| </table> |
| <p>When determining the character repertoire needed to support |
| a language, a reasonable initial set would include at least the |
| characters in the main and punctuation exemplar sets, along |
| with the digits and common symbols associated with the |
| numberSystems supported for the locale (see <i><a href= |
| "tr35-numbers.html#Numbering_Systems">Numbering |
| Systems</a></i>).</p> |
| <p>The <em>index</em> characters are a set of characters for |
| use as a UI "index", that is, a list of clickable characters |
| (or character sequences) that allow the user to see a segment |
| of a larger "target" list. For details see the <a href= |
| "tr35-collation.html#Collation_Indexes">Unicode LDML: |
| Collation</a> document. The index set may only contain |
| characters whose lowercase versions are in the main and |
| auxiliary exemplar sets, though for cased languages the index |
| exemplars are typically in uppercase. Characters from the |
| auxiliary exemplar set may be necessary in the index set if it |
| needs to properly handle items such as names which may require |
| characters not included in the main exemplar set.</p> |
| <p>Here is a sample of the XML structure:</p> |
| <pre> |
| <exemplarCharacters type="index">[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]</exemplarCharacters></pre> |
| <p>The display of the index characters can be modified with the |
| Index labels elements, discussed in Section 5.6.4.</p> |
| <h4>3.1.1 <a name="ExemplarSyntax" href="#ExemplarSyntax" id= |
| "ExemplarSyntax">Exemplar Syntax</a></h4> |
| <p>In all of the exemplar characters, the list of characters is |
| in the <a href="tr35.html#Unicode_Sets">Unicode Set</a> format, |
| which normally allows boolean combinations of sets of letters |
| and Unicode properties.</p> |
| <p>Sequences of characters that act like a single letter in the |
| language — especially in collation — are included within |
| braces, such as [a-z á é í ó ú ö ü ő ű {cs} {dz} {dzs} {gy} |
| ...]. The characters should be in normalized form (NFC). Where |
| combining marks are used generatively, and apply to a large |
| number of base characters (such as in Indic scripts), the |
| individual combining marks should be included. Where they are |
| used with only a few base characters, the specific combinations |
| should be included. Wherever there is not a precomposed |
| character (for example, single codepoint) for a given |
| combination, that must be included within braces. For example, |
| to include sequences from the <a href= |
| "https://unicode.org/standard/where/">Where is my Character?</a> |
| page on the Unicode site, one would write: [{ch} {tʰ} {x̣} {ƛ̓} |
| {ą́} {i̇́} {ト゚}], but for French one would just write [a-z é è |
| ù ...]. When in doubt use braces, since it does no harm to |
| include them around single code points: for example, [a-z {é} |
| {è} {ù} ...].</p> |
| <p>If the letter 'z' were only ever used in the combination |
| 'tz', then we might have [a-y {tz}] in the main set. (The |
| language would probably have plain 'z' in the auxiliary set, |
| for use in foreign words.) If combining characters can be used |
| productively in combination with a large number of others (such |
| as say Indic matras), then they are not listed in all the |
| possible combinations, but separately, such as:</p> |
| <blockquote> |
| [ॐ ऄ-ऋ ॠ ऌ ॡ ऍ-क क़ ख ख़ ग ग़ घ-ज ज़ झ-ड ड़ ढ ढ़ ण-फ फ़ ब-य |
| य़ र-ह ़ ँ-ः ॑-॔ ऽ ् ॽ ा-ॄ ॢ ॣ ॅ-ौ] |
| </blockquote> |
| <p>The exemplar character set for Han characters is composed |
| somewhat differently. It is even harder to draw a clear line |
| for Han characters, since usage is more like a frequency curve |
| that slowly trails off to the right in terms of decreasing |
| frequency. So for this case, the exemplar characters simply |
| contain a set of reasonably frequent characters for the |
| language.</p> |
| <p>The ordering of the characters in the set is irrelevant, but |
| for readability in the XML file the characters should be in |
| sorted order according to the locale's conventions. The main |
| and auxiliary sets should only contain lower case characters |
| (except for the special case of Turkish and similar languages, |
| where the dotted capital I should be included); the upper case |
| letters are to be mechanically added when the set is used. For |
| more information on casing, see the discussion of Special |
| Casing in the Unicode Character Database.</p> |
| <h4>3.1.2 <a name="Restrictions" href="#Restrictions" id= |
| "Restrictions">Restrictions</a></h4> |
| <ol> |
| <li>The main, auxiliary and index sets are normally |
| restricted to those letters with a specific <a href= |
| "https://unicode.org/Public/UNIDATA/Scripts.txt">Script</a> |
| character property (that is, not the values Common or |
| Inherited) or required <a href= |
| "https://unicode.org/Public/UNIDATA/DerivedCoreProperties.txt"> |
| Default_Ignorable_Code_Point</a> characters (such as a |
| non-joiner), or combining marks, or the <a href= |
| "https://www.unicode.org/Public/UNIDATA/auxiliary/WordBreakProperty.txt"> |
| Word_Break</a> properties <a name="Katakana" href="#Katakana" |
| id="Katakana">Katakana</a>, <a name="ALetter" href="#ALetter" |
| id="ALetter">ALetter</a>, or <a name="MidLetter" href= |
| "#MidLetter" id="MidLetter">MidLetter</a>.</li> |
| <li>The auxiliary set should not overlap with the main set. |
| There is one exception to this: Hangul Syllables and CJK |
| Ideographs can overlap between the sets.</li> |
| <li>Any <a href= |
| "https://unicode.org/Public/UNIDATA/DerivedCoreProperties.txt"> |
| Default_Ignorable_Code_Point</a>s should be in the auxiliary |
| set , or, if they are only needed for currency formatting, in |
| the currency set. These can include characters such as U+200E |
| LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK which may be |
| needed in bidirectional text in order for date, currency or |
| other formats to display correctly.</li> |
| <li>For exemplar characters the <a href= |
| "tr35.html#Unicode_Sets">Unicode Set</a> format is restricted |
| so as to not use properties or boolean combinations .</li> |
| </ol> |
| <h3>3.2 <a name="Character_Mapping" href="#Character_Mapping" |
| id="Character_Mapping">Mapping</a></h3> |
| <p><b>This element has been deprecated.</b> For information on |
| its structure and how it was intended to specify |
| locale-specific preferred encodings for various purposes |
| (e-mail, web), see the <a href= |
| "https://www.unicode.org/reports/tr35/tr35-39/tr35-general.html#Character_Mapping"> |
| Mapping</a> section from the CLDR 27 version of the LDML |
| Specification.</p> |
| <h3>3.3 <a name="IndexLabels" href="#IndexLabels" id= |
| "IndexLabels">Index Labels</a></h3> |
| <p><b>This element and its subelements have been |
| deprecated.</b> For information on its structure and how it was |
| intended to provide data for a compressed display of index |
| exemplar characters where space is limited, see the <a href= |
| "https://www.unicode.org/reports/tr35/tr35-39/tr35-general.html#IndexLabels"> |
| Index Labels</a> section from the CLDR 27 version of the LDML |
| Specification.</p> |
| <p class="dtd"><!ELEMENT indexLabels (indexSeparator*, |
| compressedIndexSeparator*, indexRangePattern*, |
| indexLabelBefore*, indexLabelAfter*, indexLabel*) ></p> |
| <h3>3.4 <a name="Ellipsis" href="#Ellipsis" id= |
| "Ellipsis">Ellipsis</a></h3> |
| <p class="dtd"><!ELEMENT ellipsis ( #PCDATA ) ><br> |
| <!ATTLIST ellipsis type ( initial | medial | final | |
| word-initial | word-medial | word-final ) #IMPLIED ></p> |
| <p>The ellipsis element provides patterns for use when |
| truncating strings. There are three versions: initial for |
| removing an initial part of the string (leaving final |
| characters); medial for removing from the center of the string |
| (leaving initial and final characters), and final for removing |
| a final part of the string (leaving initial characters). For |
| example, the following uses the ellipsis character in all three |
| cases (although some languages may have different characters |
| for different positions).</p> |
| <p><code><ellipsis |
| type="initial">…{0}</ellipsis><br> |
| <ellipsis type="medial">{0}…{1}</ellipsis><br> |
| <ellipsis type="final">{0}…</ellipsis></code></p> |
| <p>There are alternatives for cases where the breaks are on a |
| word boundary, where some languages include a space. For |
| example, such as case would be:</p> |
| <p><code><ellipsis type="word-initial">… |
| {0}</ellipsis></code></p> |
| <h3>3.5 <a name="Character_More_Info" href= |
| "#Character_More_Info" id="Character_More_Info">More |
| Information</a></h3> |
| <p>The moreInformation string is one that can be displayed in |
| an interface to indicate that more information is available. |
| For example:</p> |
| <p><moreInformation>?</moreInformation></p> |
| <h3>3.6 <a name="Character_Parse_Lenient" href= |
| "#Character_Parse_Lenient" id="Character_Parse_Lenient">Parse |
| Lenient</a></h3> |
| <p class='dtd'><!ELEMENT parseLenients ( alias | ( |
| parseLenient*, special* ) ) ><br> |
| <!ATTLIST parseLenients scope (general | number | date) |
| #REQUIRED ><br> |
| <!ATTLIST parseLenients level (lenient | stricter) #REQUIRED |
| ></p> |
| <p class='dtd'><!ELEMENT parseLenient ( #PCDATA ) ><br> |
| <!ATTLIST parseLenient sample CDATA #REQUIRED ><br> |
| <!ATTLIST parseLenient alt NMTOKENS #IMPLIED ><br> |
| <!ATTLIST parseLenient draft (approved | contributed | |
| provisional | unconfirmed) #IMPLIED ><br></p> |
| <p>Example:</p> |
| <pre><parseLenients scope="date" level="lenient"> |
| <parseLenient sample="-">[\-./]</parseLenient> |
| <parseLenient sample=":">[\:∶]</parseLenient> |
| </parseLenients></pre> |
| <p>The parseLenient elements are used to indicate that |
| characters within a particular UnicodeSet are normally to be |
| treated as equivalent when doing a lenient parse. The |
| <strong>scope</strong> attribute value defines where the |
| lenient sets are intended for use. The <strong>level</strong> |
| attribute value is included for future expansion; currently the |
| only value is "lenient".</p> |
| <p>The <strong>sample</strong> attribute value is a paradigm |
| element of that UnicodeSet, but the only reason for pulling it |
| out separately is so that different classes of characters are |
| separated, and to enable inheritance overriding. The first |
| version of this data is populated with the data used for |
| lenient parsing from ICU.</p> |
| <h2>4 <a name="Delimiter_Elements" href="#Delimiter_Elements" |
| id="Delimiter_Elements">Delimiter Elements</a></h2> |
| <p class="dtd"><!ELEMENT delimiters (alias | |
| (quotationStart*, quotationEnd*, alternateQuotationStart*, |
| alternateQuotationEnd*, special*)) ></p> |
| <p>The delimiters supply common delimiters for bracketing |
| quotations. The quotation marks are used with simple quoted |
| text, such as:</p> |
| <blockquote> |
| <p>He said, “Don’t be absurd!”</p> |
| </blockquote> |
| <p>When quotations are nested, the quotation marks and |
| alternate marks are used in an alternating fashion:</p> |
| <blockquote> |
| <p>He said, “Remember what the Mad Hatter said: ‘Not the same |
| thing a bit! Why you might just as well say that “I see what |
| I eat” is the same thing as “I eat what I see”!’”</p> |
| </blockquote> |
| <p><code><quotationStart></code> <span style= |
| "color: blue">“</span> <code></quotationStart></code><br> |
| <code><quotationEnd></code> <span style= |
| "color: blue">”</span> <code></quotationEnd></code><br> |
| <code><alternateQuotationStart></code> <span style= |
| "color: blue">‘</span> |
| <code></alternateQuotationStart></code><br> |
| <code><alternateQuotationEnd></code> <span style= |
| "color: blue">’</span> |
| <code></alternateQuotationEnd></code></p> |
| <h2>5 <a name="Measurement_System_Data" href= |
| "#Measurement_System_Data" id= |
| "Measurement_System_Data">Measurement System Data</a></h2> |
| <p class="dtd"><!ELEMENT measurementData ( |
| measurementSystem*, paperSize* ) ><br> |
| <br> |
| <!ELEMENT measurementSystem EMPTY ><br> |
| <!ATTLIST measurementSystem type ( metric | US | UK ) |
| #REQUIRED ><br> |
| <!ATTLIST measurementSystem category ( temperature ) |
| #IMPLIED ><br> |
| <!ATTLIST measurementSystem territories NMTOKENS #REQUIRED |
| ><br> |
| <br> |
| <!ELEMENT paperSize EMPTY ><br> |
| <!ATTLIST paperSize type ( A4 | US-Letter ) #REQUIRED |
| ><br> |
| <!ATTLIST paperSize territories NMTOKENS #REQUIRED ></p> |
| <p>The measurement system is the normal measurement system in |
| common everyday use (except for date/time). For example:</p> |
| <pre><measurementData> |
| <measurementSystem type="metric" territories="001"/> |
| <measurementSystem type="US" territories="LR MM US"/> |
| <measurementSystem type="metric" category="temperature" territories="LR MM"/> |
| <measurementSystem type="US" category="temperature" territories="BS BZ KY PR PW"/> |
| <measurementSystem type="UK" territories="GB"/> |
| <paperSize type="A4" territories="001"/> |
| <paperSize type="US-Letter" territories="BZ CA CL CO CR GT MX NI PA PH PR SV US VE"/> |
| </measurementData></pre> |
| <p>The values are "metric", "US", or "UK"; others may be added |
| over time.</p> |
| <ul> |
| <li>The "metric" value indicates the use of SI [<a href= |
| "tr35.html#ISO1000">ISO1000</a>] base or derived units, or |
| non-SI units accepted for use with SI: for example, meters, |
| kilograms, liters, and degrees Celsius.</li> |
| <li>The "US" value indicates the customary system of |
| measurement as used in the United States: feet, inches, |
| pints, quarts, degrees Fahrenheit, and so on.</li> |
| <li>The "UK" value indicates the mix of metric units and |
| Imperial units (feet, inches, pints, quarts, and so on) used |
| in the United Kingdom, in which Imperial volume units such as |
| pint, quart, and gallon are different sizes than in the "US" |
| customary system. For more detail about specific units for |
| various usages, see <strong>Part 6: Supplemental:</strong> |
| <em>Section 2.4.1 <a href= |
| "tr35-info.html#Preferred_Units_For_Usage">Preferred Units |
| for Specific Usages</a></em>.</li> |
| </ul> |
| <p>In some cases, it may be common to use different measurement |
| systems for different categories of measurements. For example, |
| the following indicates that for the category of temperature, |
| in the regions LR and MM, it is more common to use metric units |
| than US units.</p> |
| <pre> |
| <measurementSystem type="metric" category="temperature" territories="LR MM"/> |
| </pre> |
| <p>The paperSize attribute gives the height and width of paper |
| used for normal business letters. The values are "A4" and |
| "US-Letter".</p> |
| <p>For both measurementSystem entries and paperSize entries, |
| later entries for specific territories such as "US" will |
| override the value assigned to that territory by earlier |
| entries for more inclusive territories such as "001".</p> |
| <p>The measurement information was formerly in the main LDML |
| file, and had a somewhat different format.</p> |
| <p>Again, for finer-grained detail about specific units for |
| various usages, see <strong>Part 6: Supplemental:</strong> |
| <em>Section 2.4.1 <a href= |
| "tr35-info.html#Preferred_Units_For_Usage">Preferred Units for |
| Specific Usages</a></em>.</p> |
| <h3>5.1 <a name="Measurement_Elements" href= |
| "#Measurement_Elements" id="Measurement_Elements">Measurement |
| Elements (deprecated)</a></h3> |
| <p class="dtd"><!ELEMENT measurement (alias | |
| (measurementSystem?, paperSize?, special*)) ></p> |
| <p>The measurement element is deprecated in the main LDML |
| files, because the data is more appropriately organized as |
| connected to territories, not to linguistic data. Instead, the |
| measurementData element in the supplemental data file should be |
| used.</p> |
| <h2>6 <a name="Unit_Elements" href="#Unit_Elements" id= |
| "Unit_Elements">Unit Elements</a></h2> |
| <p class="dtd"><!ELEMENT units (alias | (unit*, unitLength*, |
| durationUnit*, special*) ) ><br> |
| <br> |
| <!ELEMENT unitLength (alias | (compoundUnit*, unit*, |
| coordinateUnit*, special*) ) ><br> |
| <!ATTLIST unitLength type (long | short | narrow) #REQUIRED |
| ><br> |
| <br> |
| <!ELEMENT compoundUnit (alias | (compoundUnitPattern*, |
| special*) ) ><br> |
| <!ATTLIST compoundUnit type NMTOKEN #REQUIRED ><br> |
| <br> |
| <!ELEMENT unit ( alias | ( gender*, displayName*, unitPattern*, perUnitPattern*, special* ) ) ><br> |
| <!ATTLIST unit type NMTOKEN #REQUIRED ><br> |
| <br> |
| <!ELEMENT gender ( #PCDATA )><br> |
| <br> |
| <!ELEMENT durationUnit (alias | (durationUnitPattern*, |
| special*) ) ><br> |
| <!ATTLIST durationUnit type NMTOKEN #REQUIRED ><br> |
| <br> |
| <!ELEMENT unitPattern ( #PCDATA ) ><br> |
| <!ATTLIST unitPattern count (0 | 1 | zero | one | two | few |
| | many | other) #REQUIRED ><br> |
| <br> |
| <!ELEMENT compoundUnitPattern ( #PCDATA ) ><br> |
| <!ATTLIST compoundUnitPattern case NMTOKENS #IMPLIED ><br> |
| <br> |
| <!ELEMENT compoundUnitPattern1 ( #PCDATA ) ><br> |
| <!ATTLIST compoundUnitPattern1 count (0 | 1 | zero | one | two | few | many | other) #IMPLIED > <br> |
| <!ATTLIST compoundUnitPattern1 gender NMTOKENS #IMPLIED > <br> |
| <!ATTLIST compoundUnitPattern1 case NMTOKENS #IMPLIED ><br> |
| <br> |
| <!ELEMENT coordinateUnit ( alias | ( displayName*, |
| coordinateUnitPattern*, special* ) ) ><br> |
| <!ELEMENT coordinateUnitPattern ( #PCDATA ) ><br> |
| <!ATTLIST coordinateUnitPattern type (north | east | south | |
| west) #REQUIRED ><br> |
| <br> |
| <!ELEMENT durationUnitPattern ( #PCDATA ) ><br></p> |
| |
| <p>These elements specify the localized way of formatting |
| quantities of units such as years, months, days, hours, minutes |
| and seconds— for example, in English, "1 day" or "3 days". The |
| English rules that produce this example are as follows ({0} |
| indicates the position of the formatted numeric value):</p> |
| |
| <pre><unit type="duration-day"> |
| <displayName>days</displayName> |
| <unitPattern count="one"><span style= |
| "color: blue">{0} day</span></unitName> |
| <unitPattern count="other"><span style= |
| "color: blue">{0} days</span></unitName> |
| </unit></pre> |
| <p>The german rules are more complicated, because German has both gender and case. They thus have additional information, as illustrated below. Note that if there is no @case attribute, for backwards compatibility the implied case is nominative. The possible values for @case are listed in the <strong>grammaticalFeatures</strong> element. These follow the inheritance specified in Part 1, Section <a href= |
| "tr35.html#Lateral_Inheritance">4.1.2 Lateral |
| Inheritance</a>. Note that the additional grammar elements are only present in the <unitLength type='long'> form.</p> |
| <pre><unit type="duration-day"> |
| <strong><gender>masculine</gender></strong> |
| <displayName>Tage</displayName> |
| <unitPattern count="one">{0} Tag</unitPattern> |
| <strong><unitPattern count="one" case="accusative">{0} Tag</unitPattern> |
| <unitPattern count="one" case="dative">{0} Tag</unitPattern> |
| <unitPattern count="one" case="genitive">{0} Tages</unitPattern> |
| </strong> <unitPattern count="other">{0} Tage</unitPattern> |
| <strong><unitPattern count="other" case="accusative">{0} Tage</unitPattern> |
| <unitPattern count="other" case="dative">{0} Tagen</unitPattern> |
| <unitPattern count="other" case="genitive">{0} Tage</unitPattern> |
| </strong> <perUnitPattern>{0} pro Tag</perUnitPattern> |
| </unit></pre> |
| |
| <p>These follow the inheritance specified in Part 1, Section <a href= |
| "tr35.html#Lateral_Inheritance">4.1.2 Lateral |
| Inheritance</a>.In addition to supporting language-specific plural cases |
| such as “one” and “other”, unitPatterns support the |
| language-independent explicit cases “0” and “1” for special |
| handling of numeric values that are exactly 0 or 1; see |
| <a href="tr35-numbers.html#Explicit_0_1_rules">Explicit 0 and 1 |
| rules</a>.</p> |
| |
| <p>The <unitPattern> elements may be used to format |
| quantities with decimal values; in such cases the choice of plural form will |
| depend not only on the numeric value, but also on its formatting (see |
| <a href="tr35-numbers.html#Language_Plural_Rules">Language Plural Rules</a>). |
| In addition to formatting units for stand-alone use, <unitPattern> |
| elements are increasingly being used to format units for use in running text; |
| for such usages, the developing <a href="#Grammatical_Features">Grammatical Features</a> |
| information will be very useful.</p> |
| |
| <p>Note that for certain plural cases, the unit pattern may not |
| provide for inclusion of a numeric value—that is, it may not include “{0}”. This |
| is especially true for the explicit cases “0” and “1” (which may have patterns like |
| “zero seconds”). In certain languages such as Arabic and Hebrew, this may also be |
| true with certain units for the plural cases “zero”, “one”, or “two” (in these |
| languages, such plural cases are only used for the corresponding exact numeric |
| values, so there is no concern about loss of precision without the numeric value).</p> |
| |
| <p>Units, like other values with a <strong>count</strong> |
| attribute, use a special inheritance. See <strong>Part 1: |
| Core:</strong> <em>Section 4.1 <a href= |
| "tr35.html#Multiple_Inheritance">Multiple Inheritance</a></em> |
| .</p> |
| |
| <p>The displayName is used for labels, such as in a UI. It is |
| typically lowercased and as neutral a plural form as possible, |
| and then uses the casing context for the proper display. For |
| example, for English in a UI it would appear as titlecase:</p> |
| <p><strong>Duration:</strong></p> |
| <table style="margin-left: 5em"> |
| <tr> |
| <td>Days</td> |
| <td style="color: silver">enter the vacation length</td> |
| </tr> |
| </table><br> |
| <h3>6.1 <a name="Unit_Preference_and_Conversion" href="#Unit_Preference_and_Conversion">Unit Preference and Conversion Data</a> </h3> |
| |
| |
| <p> |
| Different locales have different preferences for which unit or combination of units is used for a particular usage, such as measuring a person’s height. This is more fine-grained than merely a preference for metric versus US or UK measurement systems. For example, one locale may use meters alone, while another may use centimeters alone or a combination of meters and centimeters; a third may use inches alone, or (informally) a combination of feet and inches. |
| </p> |
| <p> |
| The unit preference and conversion data allows formatting functions to pick the right measurement units for the locale and usage, and convert input measurement into those units. For example, a program (or database) could use 1.88 meters internally, but then for person-height have that measurement convert to <em>6 foot 2 inches</em> for en-US and to <em>188 centimeters </em>for de-CH. Using the unit display names and list formats, those results can then be displayed according to the desired width (eg <em>2″</em> vs <em>2 in</em> vs 2 <em>inches</em>) and using the locale display names and number formats. |
| </p> |
| <p> |
| The size of the measurement can also be taken into account, so that an infant can have a height as <em>18 inches</em>, and an adult the height as <em>6 foot 2 inches.</em> |
| </p> |
| <p> |
| This data is supplied in <strong>Part 6: <a href= |
| "tr35-info.html#Contents">Supplemental</a></strong>: <a href= |
| "tr35-info.html#Unit_Conversion">Section 13 Unit Conversion</a> and <a href= |
| "tr35-info.html#Unit_Preferences">Section 13 Unit Preferences</a>. |
| </p> |
| <h3>6.2 <a name="Unit_Identifiers" href="#Unit_Identifiers" >Unit Identifiers</a></h3> |
| <p> |
| Units are identified internally as described in this section. As with other identifiers in CLDR, the American English spelling is used for unit identifiers. These names should not be presented to end users, however. As in other cases, the translated names for different languages (or variants of English) are available in the CLDR localized data. |
| </p> |
| |
| <table> |
| <tr> |
| <td><strong>Name</strong> |
| </td> |
| <td><strong>Example</strong> |
| </td> |
| </tr> |
| <tr> |
| <td>long unit identifier |
| </td> |
| <td>length-meter, mass-pound, duration-day |
| </td> |
| </tr> |
| <tr> |
| <td>core unit identifier |
| </td> |
| <td>meter, pound, day |
| </td> |
| </tr> |
| </table><br> |
| |
| |
| <p> |
| Both the <em>unit identifier</em> and the <em>core unit identifier</em> are guaranteed to be unique, and clients can use either one to identify a unit. The associations between types and core unit identifiers are as prescribed in CLDR data; it is invalid for a client to create any additional associations. Except as specified in <em>Section 6.6 <a href="https://www.unicode.org/reports/tr35/tr35-general.html#Private_Use_Units">Private-Use Units</a></em>, all values are reserved by CLDR. |
| </p> |
| |
| <table> |
| <tr> |
| <td><strong>Name</strong> |
| </td> |
| <td><strong>Examples</strong> |
| </td> |
| </tr> |
| <tr> |
| <td>simple unit ID |
| </td> |
| <td>meter, foot, inch, pound, pound-force, … |
| </td> |
| </tr> |
| <tr> |
| <td>prefixed unit ID |
| </td> |
| <td>kilometer, centigram, … |
| <p> |
| <em>plus simple unit IDs</em> |
| </td> |
| </tr> |
| <tr> |
| <td>single unit ID |
| </td> |
| <td>square-foot, cubic-centimeter, …<br> |
| <em>plus prefixed unit IDs</em> |
| </td> |
| </tr> |
| <tr> |
| <td>core unit ID |
| </td> |
| <td>kilometer-per-hour, kilogram-meter, kilogram-meter-per-square-second, … |
| <p> |
| <em>plus single unit IDs</em> |
| </td> |
| </tr> |
| <tr> |
| <td>mixed unit ID |
| </td> |
| <td>foot-and-pound |
| </td> |
| </tr> |
| </table><br> |
| |
| |
| <p> |
| A core unit that is not a simple unit is called a <em>complex unit</em>. It is valid to construct a complex unit identifier from multiple simple unit identifiers using multiplication (kilogram-meter) and division (kilogram-per-meter). As usual, with division the part before the (first) -per- is called the <em>numerator</em>, and the part after it is called the <em>denominator</em>. |
| </p> |
| <p> |
| The conversion information uses the short unit identifiers, discarding the unitType. Thus “meter” is used instead of “length-meter”. The translation data currently uses the long unit identifiers, for backwards compatibility. However, that is likely to change in a future version. |
| </p> |
| <p> |
| The identifiers and unit conversion data are built to handle arbitrary combinations of core unit IDs using division (kilometer-per-hour), multiplication (kilogram-meter), powers (square-second), and SI prefixes (kilo-). Thus they support converting generated units such as inch-pound-per-square-week into comparable units, such as newtons. |
| </p><ul> |
| |
| <li>A power (square, cubic, pow4, etc) modifies one prefixed unit ID, and must occur immediately before it in the identifier: square-foot, not foot-square. |
| <li>Multiplication binds more tightly than division, so kilogram-meter-per-second-ampere is interpreted as (kg ⋅ m) / (s ⋅ a). |
| <li>Thus if -per- occurs multiple times, each occurrence after the first is equivalent to a multiplication: <ul> |
| |
| <li>kilogram-meter-per-second-ampere ⩧ kilogram-meter-per-second-per-ampere. |
| </ul> |
| </li></ul> |
| |
| <h4>Nomenclature</h4> |
| |
| |
| <p> |
| For the US spelling, see the <a href="https://www.nist.gov/pml/special-publication-811">Preface of the Guide for the Use of the International System of Units (SI), NIST special publication 811</a>, which is explicit about the discrepancy with the English-language BIPM spellings: |
| </p> |
| <p> |
| |
| In keeping with U.S. and International practice (see Sec. C.2), this Guide uses the dot on the line as the decimal marker. In addition this Guide utilizes the American spellings “meter,” “liter,” and “deka” rather than “metre,” “litre,” and “deca,” and the name “metric ton” rather than “tonne.” |
| </p> |
| <h4>Syntax</h4> |
| |
| |
| <p> |
| The formal syntax for identifiers is provided below. |
| </p> |
| |
| <table> |
| <tr> |
| <td>unit_identifier |
| </td> |
| <td>:= |
| </td> |
| <td>long_unit_identifier<br> |
| | mixed_unit_identifier |
| <p> |
| | core_unit_identifier |
| </td> |
| </tr> |
| <tr> |
| <td>long_unit_identifier |
| </td> |
| <td>:= |
| </td> |
| <td>type "-" core_unit_identifier |
| </td> |
| </tr> |
| <tr> |
| <td>core_unit_identifier |
| </td> |
| <td>:= |
| </td> |
| <td>product_unit ("-per-" product_unit)*<br>| "per-" product_unit ("-per-" product_unit)* |
| <ul> |
| <li><em>Examples:</em> |
| <ul> |
| <li>foot-per-second-per-second</li> |
| <li>per-second</li> |
| </ul> |
| </li> |
| <li><em>Note: </em>The normalized form will have only one "per"</li> |
| </ul> |
| </td> |
| </tr> |
| <tr> |
| <td>mixed_unit_identifier |
| </td> |
| <td>:= |
| </td> |
| <td>(single_unit | pu_single_unit) ("-and-" (single_unit | pu_single_unit ))*<ul> |
| |
| <li><em>Example: foot-and-inch</em> |
| </ul> |
| |
| </td> |
| </tr> |
| <tr> |
| <td>product_unit |
| </td> |
| <td>:= |
| </td> |
| <td>single_unit ("-" single_unit)* ("-" pu_single_unit)* |
| <p> |
| | pu_single_unit ("-" pu_single_unit)*<ul> |
| |
| <li><em>Example: </em>foot-pound-force |
| <li><em>Constraint:</em> No pu_single_unit may precede a single unit</li></ul> |
| |
| </td> |
| </tr> |
| <tr> |
| <td>single_unit |
| </td> |
| <td>:= |
| </td> |
| <td>(dimensionality_prefix)? prefixed_unit<ul> |
| |
| <li><em>Example: </em>square-meter</li></ul> |
| |
| </td> |
| </tr> |
| <tr> |
| <td>pu_single_unit |
| </td> |
| <td>:= |
| </td> |
| <td>“xxx-” single-unit | “x-” single-unit<ul> |
| |
| <li><em>Example: </em>xxx-square-knuts (a Harry Potter unit) |
| <li><em>Note: </em>“x-” is only for backwards compatibility |
| <li>See Section 6.6 <a href="#Private_Use_Units">Private-Use Units</a> |
| </ul></td> |
| </tr> |
| <tr> |
| <td>dimensionality_prefix |
| </td> |
| <td>:= |
| </td> |
| <td>"square-" |
| <p> |
| | "cubic-" |
| <p> |
| | "pow" ([2-9]|1[0-5]) "-"<ul> |
| |
| <li><em>Note: </em>"pow2-" and "pow3-" canonicalize to "square-" and "cubic-"</li></ul> |
| |
| </td> |
| </tr> |
| <tr> |
| <td>prefixed_unit |
| </td> |
| <td> |
| </td> |
| <td>(si_prefix)? simple_unit<ul> |
| |
| <li><em>Example: </em>kilometer</li></ul> |
| |
| </td> |
| </tr> |
| <tr> |
| <td>si_prefix |
| </td> |
| <td>:= |
| </td> |
| <td>"deka" | "hecto" | "kilo", … <ul> |
| |
| <li><em>Note: </em>See full list at <a href="https://www.nist.gov/pml/special-publication-811">NIST special publication 811</a></li></ul> |
| |
| </td> |
| </tr> |
| <tr> |
| <td>simple_unit |
| </td> |
| <td>:= |
| </td> |
| <td>unit_component ("-" unit_component)* |
| <p> |
| | “em” | “g” | “us” | “hg” | “of”<ul> |
| |
| <li><em>Example: </em>gallon-imperial</li> |
| <li><em>Constraint: </em>At least one unit_component must not itself be a simple_unit |
| <li><em>Note: </em>3 simple units are currently allowed as legacy usage, |
| where a component wouldn’t be a unit_component (eg for “<strong>g</strong>-force”) |
| |
| <ul> |
| |
| <li>We will likely deprecate those and add conformant aliases in the future. |
| <li>“hg” and “of” are already only in deprecated simple_units. |
| </ul> |
| </li> |
| </ul> |
| |
| </td> |
| </tr> |
| <tr> |
| <td>unit_component |
| </td> |
| <td>:= |
| </td> |
| <td>[a-z]{3,∞} | “1” “0”{2,3}<ul> |
| |
| <li><em>Constraints: </em> |
| <ul><li>Cannot be "per", "and", "square", "cubic", "xxx", or "x"; or start with an SI prefix.</li> |
| <li>While the syntax allows any number of letters greater than 3, the unit_components need to be distinct if truncated to 8 letters. This allows for possible future support of units in Unicode Locale Identifiers.</li></ul> |
| <li><em>Example: </em>foot</li></ul> |
| |
| </td> |
| </tr> |
| </table> |
| |
| |
| <h3>6.3 <a name="Example_Units" href="#Example_Units">Example Units</a></h3> |
| <p>The |
| following table contains examples of types and units currently |
| defined by CLDR. The units in CLDR are not |
| comprehensive; it is anticipated that more will be added over |
| time. The complete list of supported units is in the validity |
| data: see <em>Section <a href="tr35.html#Validity_Data">3.11 |
| Validity Data</a></em>. The compound |
| units in the table below either require specialized formatting |
| or have a numerator and/or demoninator that are not defined as |
| valid standalone units. Note: as explained in <em>Section 6.4 |
| <a href="#compound-units">Compound Units</a></em>, CLDR |
| provides data to format any compound unit composed of two |
| simple units from the following table.</p> |
| <table> |
| <tr> |
| <th>Type</th> |
| <th>Core Unit Identifier</th> |
| <th>Compound?</th> |
| <th>Sample Format</th> |
| </tr> |
| <tr> |
| <td><em>acceleration</em></td> |
| <td>g-force</td> |
| <td>simple</td> |
| <td>{0} G</td> |
| </tr> |
| <tr> |
| <td><em>acceleration</em></td> |
| <td>meter-per-square-second</td> |
| <td>compound</td> |
| <td>{0} m/s²</td> |
| </tr> |
| <tr> |
| <td><em>angle</em></td> |
| <td>revolution</td> |
| <td>simple</td> |
| <td>{0} rev</td> |
| </tr> |
| <tr> |
| <td><em>angle</em></td> |
| <td>radian</td> |
| <td>simple</td> |
| <td>{0} rad</td> |
| </tr> |
| <tr> |
| <td><em>angle</em></td> |
| <td>degree</td> |
| <td>simple</td> |
| <td>{0}°</td> |
| </tr> |
| <tr> |
| <td><em>angle</em></td> |
| <td>arc-minute</td> |
| <td>simple</td> |
| <td>{0}′</td> |
| </tr> |
| <tr> |
| <td><em>angle</em></td> |
| <td>arc-second</td> |
| <td>simple</td> |
| <td>{0}″</td> |
| </tr> |
| <tr> |
| <td><em>area</em></td> |
| <td>square-kilometer</td> |
| <td>simple</td> |
| <td>{0} km²</td> |
| </tr> |
| <tr> |
| <td><em>area</em></td> |
| <td>hectare</td> |
| <td>simple</td> |
| <td>{0} ha</td> |
| </tr> |
| <tr> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| </tr> |
| <tr> |
| <td><em>area</em></td> |
| <td>square-inch</td> |
| <td>simple</td> |
| <td>{0} in²</td> |
| </tr> |
| <tr> |
| <td><em>area</em></td> |
| <td>dunam</td> |
| <td>simple</td> |
| <td>{0} dunam</td> |
| </tr> |
| <tr> |
| <td><em>concentr</em></td> |
| <td>karat</td> |
| <td>simple</td> |
| <td>{0} kt</td> |
| <td>dimensionless</td> |
| </tr> |
| <tr> |
| <td><em>concentr</em></td> |
| <td>milligram-per-deciliter</td> |
| <td>compound</td> |
| <td>{0} mg/dL</td> |
| </tr> |
| <tr> |
| <td><em>concentr</em></td> |
| <td>millimole-per-liter</td> |
| <td>compound</td> |
| <td>{0} mmol/L</td> |
| </tr> |
| <tr> |
| <td><em>concentr</em></td> |
| <td>permillion</td> |
| <td>compound</td> |
| <td>{0} ppm</td> |
| <td>dimensionless</td> |
| </tr> |
| <tr> |
| <td><em>concentr</em></td> |
| <td>percent</td> |
| <td>simple</td> |
| <td>{0}%</td> |
| <td>dimensionless</td> |
| </tr> |
| <tr> |
| <td><em>concentr</em></td> |
| <td>permille</td> |
| <td>simple</td> |
| <td>{0}‰</td> |
| <td>dimensionless</td> |
| </tr> |
| <tr> |
| <td><em>concentr</em></td> |
| <td>permyriad</td> |
| <td>simple</td> |
| <td>{0}‱</td> |
| <td>dimensionless</td> |
| </tr> |
| <tr> |
| <td><em>concentr</em></td> |
| <td>mole</td> |
| <td>simple</td> |
| <td>{0} mol</td> |
| <td>dimensionless</td> |
| </tr> |
| <tr> |
| <td><em>consumption</em></td> |
| <td>liter-per-kilometer</td> |
| <td>compound</td> |
| <td>{0} L/km</td> |
| </tr> |
| <tr> |
| <td><em>consumption</em></td> |
| <td>liter-per-100-kilometer</td> |
| <td>compound</td> |
| <td>{0} L/100km</td> |
| </tr> |
| <tr> |
| <td><em>consumption</em></td> |
| <td>mile-per-gallon (US)</td> |
| <td>compound</td> |
| <td>{0} mpg</td> |
| </tr> |
| <tr> |
| <td><em>consumption</em></td> |
| <td>mile-per-gallon-imperial</td> |
| <td>compound</td> |
| <td>{0} mpg Imp.</td> |
| </tr> |
| <tr> |
| <td><em>digital</em></td> |
| <td>petabyte</td> |
| <td>simple</td> |
| <td>{0} PB</td> |
| </tr> |
| <tr> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| </tr> |
| <tr> |
| <td><em>digital</em></td> |
| <td>byte</td> |
| <td>simple</td> |
| <td>{0} byte</td> |
| </tr> |
| <tr> |
| <td><em>digital</em></td> |
| <td>bit</td> |
| <td>simple</td> |
| <td>{0} bit</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>century</td> |
| <td>simple</td> |
| <td>{0} c</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>year</td> |
| <td>simple</td> |
| <td>{0} y</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>year-person</td> |
| <td>simple</td> |
| <td>{0} y</td> |
| <td>for duration or age related to a person</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>month</td> |
| <td>simple</td> |
| <td>{0} m</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>month-person</td> |
| <td>simple</td> |
| <td>{0} m</td> |
| <td>for duration or age related to a person</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>week</td> |
| <td>simple</td> |
| <td>{0} w</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>week-person</td> |
| <td>simple</td> |
| <td>{0} w</td> |
| <td>for duration or age related to a person</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>day</td> |
| <td>simple</td> |
| <td>{0} d</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>day-person</td> |
| <td>simple</td> |
| <td>{0} d</td> |
| <td>for duration or age related to a person</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>hour</td> |
| <td>simple</td> |
| <td>{0} h</td> |
| </tr> |
| <tr> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| </tr> |
| <tr> |
| <td><em>duration</em></td> |
| <td>nanosecond</td> |
| <td>simple</td> |
| <td>{0} ns</td> |
| </tr> |
| <tr> |
| <td><em>electric</em></td> |
| <td>ampere</td> |
| <td>simple</td> |
| <td>{0} A</td> |
| </tr> |
| <tr> |
| <td><em>electric</em></td> |
| <td>milliampere</td> |
| <td>simple</td> |
| <td>{0} mA</td> |
| </tr> |
| <tr> |
| <td><em>electric</em></td> |
| <td>ohm</td> |
| <td>simple</td> |
| <td>{0} Ω</td> |
| </tr> |
| <tr> |
| <td><em>electric</em></td> |
| <td>volt</td> |
| <td>simple</td> |
| <td>{0} V</td> |
| </tr> |
| <tr> |
| <td><em>energy</em></td> |
| <td>kilocalorie</td> |
| <td>simple</td> |
| <td>{0} kcal</td> |
| </tr> |
| <tr> |
| <td><em>energy</em></td> |
| <td>calorie</td> |
| <td>simple</td> |
| <td>{0} cal</td> |
| </tr> |
| <tr> |
| <td><em>energy</em></td> |
| <td>foodcalorie</td> |
| <td>simple</td> |
| <td>{0} Cal</td> |
| </tr> |
| <tr> |
| <td><em>energy</em></td> |
| <td>kilojoule</td> |
| <td>simple</td> |
| <td>{0} kJ</td> |
| </tr> |
| <tr> |
| <td><em>energy</em></td> |
| <td>joule</td> |
| <td>simple</td> |
| <td>{0} J</td> |
| </tr> |
| <tr> |
| <td><em>energy</em></td> |
| <td>kilowatt-hour</td> |
| <td>simple</td> |
| <td>{0} kWh</td> |
| </tr> |
| <tr> |
| <td><em>energy</em></td> |
| <td>electronvolt</td> |
| <td>simple</td> |
| <td>{0} eV</td> |
| </tr> |
| <tr> |
| <td><em>energy</em></td> |
| <td>british-thermal-unit</td> |
| <td>simple</td> |
| <td>{0} Btu</td> |
| </tr> |
| <tr> |
| <td><em>force</em></td> |
| <td>pound-force</td> |
| <td>simple</td> |
| <td>{0} lbf</td> |
| </tr> |
| <tr> |
| <td><em>force</em></td> |
| <td>newton</td> |
| <td>simple</td> |
| <td>{0} N</td> |
| </tr> |
| <tr> |
| <td><em>frequency</em></td> |
| <td>gigahertz</td> |
| <td>simple</td> |
| <td>{0} GHz</td> |
| </tr> |
| <tr> |
| <td><em>frequency</em></td> |
| <td>megahertz</td> |
| <td>simple</td> |
| <td>{0} MHz</td> |
| </tr> |
| <tr> |
| <td><em>frequency</em></td> |
| <td>kilohertz</td> |
| <td>simple</td> |
| <td>{0} kHz</td> |
| </tr> |
| <tr> |
| <td><em>frequency</em></td> |
| <td>hertz</td> |
| <td>simple</td> |
| <td>{0} Hz</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>kilometer</td> |
| <td>simple</td> |
| <td>{0} km</td> |
| </tr> |
| <tr> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>inch</td> |
| <td>simple</td> |
| <td>{0} in</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>parsec</td> |
| <td>simple</td> |
| <td>{0} pc</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>light-year</td> |
| <td>simple</td> |
| <td>{0} ly</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>astronomical-unit</td> |
| <td>simple</td> |
| <td>{0} au</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>furlong</td> |
| <td>simple</td> |
| <td>{0} fur</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>fathom</td> |
| <td>simple</td> |
| <td>{0} fm</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>nautical-mile</td> |
| <td>simple</td> |
| <td>{0} nmi</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>mile-scandinavian</td> |
| <td>simple</td> |
| <td>{0} smi</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>point</td> |
| <td>simple</td> |
| <td>{0} pt</td> |
| <td>typographic point, 1/72 inch</td> |
| </tr> |
| <tr> |
| <td><em>length</em></td> |
| <td>solar-radius</td> |
| <td>simple</td> |
| <td>{0} R☉</td> |
| </tr> |
| <tr> |
| <td><em>light</em></td> |
| <td>lux</td> |
| <td>simple</td> |
| <td>{0} lx</td> |
| </tr> |
| <tr> |
| <td><em>light</em></td> |
| <td>solar-luminosity</td> |
| <td>simple</td> |
| <td>{0} L☉</td> |
| </tr> |
| <tr> |
| <td><em>mass</em></td> |
| <td>metric-ton</td> |
| <td>simple</td> |
| <td>{0} t</td> |
| </tr> |
| <tr> |
| <td><em>mass</em></td> |
| <td>kilogram</td> |
| <td>simple</td> |
| <td>{0} kg</td> |
| </tr> |
| <tr> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| </tr> |
| <tr> |
| <td><em>mass</em></td> |
| <td>ounce</td> |
| <td>simple</td> |
| <td>{0} oz</td> |
| </tr> |
| <tr> |
| <td><em>mass</em></td> |
| <td>ounce-troy</td> |
| <td>simple</td> |
| <td>{0} oz t</td> |
| </tr> |
| <tr> |
| <td><em>mass</em></td> |
| <td>carat</td> |
| <td>simple</td> |
| <td>{0} CD</td> |
| </tr> |
| <tr> |
| <td><em>mass</em></td> |
| <td>dalton</td> |
| <td>simple</td> |
| <td>{0} Da</td> |
| </tr> |
| <tr> |
| <td><em>mass</em></td> |
| <td>earth-mass</td> |
| <td>simple</td> |
| <td>{0} M⊕</td> |
| </tr> |
| <tr> |
| <td><em>mass</em></td> |
| <td>solar-mass</td> |
| <td>simple</td> |
| <td>{0} M☉</td> |
| </tr> |
| <tr> |
| <td><em>power</em></td> |
| <td>gigawatt</td> |
| <td>simple</td> |
| <td>{0} GW</td> |
| </tr> |
| <tr> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| </tr> |
| <tr> |
| <td><em>power</em></td> |
| <td>milliwatt</td> |
| <td>simple</td> |
| <td>{0} mW</td> |
| </tr> |
| <tr> |
| <td><em>power</em></td> |
| <td>horsepower</td> |
| <td>simple</td> |
| <td>{0} hp</td> |
| </tr> |
| <tr> |
| <td><em>pressure</em></td> |
| <td>hectopascal</td> |
| <td>simple</td> |
| <td>{0} hPa</td> |
| </tr> |
| <tr> |
| <td><em>pressure</em></td> |
| <td>millimeter-ofhg</td> |
| <td>simple</td> |
| <td>{0} mm Hg</td> |
| </tr> |
| <tr> |
| <td><em>pressure</em></td> |
| <td>pound-force-per-square-inch</td> |
| <td>compound</td> |
| <td>{0} psi</td> |
| </tr> |
| <tr> |
| <td><em>pressure</em></td> |
| <td>inch-ofhg</td> |
| <td>simple</td> |
| <td>{0} inHg</td> |
| </tr> |
| <tr> |
| <td><em>pressure</em></td> |
| <td>millibar</td> |
| <td>simple</td> |
| <td>{0} mbar</td> |
| </tr> |
| <tr> |
| <td><em>pressure</em></td> |
| <td>atmosphere</td> |
| <td>simple</td> |
| <td>{0} atm</td> |
| </tr> |
| <tr> |
| <td><em>pressure</em></td> |
| <td>kilopascal</td> |
| <td>simple</td> |
| <td>{0} kPa</td> |
| </tr> |
| <tr> |
| <td><em>pressure</em></td> |
| <td>megapascal</td> |
| <td>simple</td> |
| <td>{0} MPa</td> |
| </tr> |
| <tr> |
| <td><em>speed</em></td> |
| <td>kilometer-per-hour</td> |
| <td>compound</td> |
| <td>{0} km/h</td> |
| </tr> |
| <tr> |
| <td><em>speed</em></td> |
| <td>meter-per-second</td> |
| <td>compound</td> |
| <td>{0} m/s</td> |
| </tr> |
| <tr> |
| <td><em>speed</em></td> |
| <td>mile-per-hour</td> |
| <td>compound</td> |
| <td>{0} mi/h</td> |
| </tr> |
| <tr> |
| <td><em>speed</em></td> |
| <td>knot</td> |
| <td>simple</td> |
| <td>{0} kn</td> |
| </tr> |
| <tr> |
| <td><em>temperature</em></td> |
| <td>generic</td> |
| <td>simple</td> |
| <td>{0}°</td> |
| </tr> |
| <tr> |
| <td><em>temperature</em></td> |
| <td>celsius</td> |
| <td>simple</td> |
| <td>{0}°C</td> |
| </tr> |
| <tr> |
| <td><em>temperature</em></td> |
| <td>fahrenheit</td> |
| <td>simple</td> |
| <td>{0}°F</td> |
| </tr> |
| <tr> |
| <td><em>temperature</em></td> |
| <td>kelvin</td> |
| <td>simple</td> |
| <td>{0} K</td> |
| </tr> |
| <tr> |
| <td><em>torque</em></td> |
| <td>pound-force-foot</td> |
| <td>simple</td> |
| <td>{0} lbf⋅ft</td> |
| </tr> |
| <tr> |
| <td><em>torque</em></td> |
| <td>newton-meter</td> |
| <td>simple</td> |
| <td>{0} N⋅m</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>cubic-kilometer</td> |
| <td>simple</td> |
| <td>{0} km³</td> |
| </tr> |
| <tr> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>cubic-inch</td> |
| <td>simple</td> |
| <td>{0} in³</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>megaliter</td> |
| <td>simple</td> |
| <td>{0} ML</td> |
| </tr> |
| <tr> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| <td>...</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>pint</td> |
| <td>simple</td> |
| <td>{0} pt</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>cup</td> |
| <td>simple</td> |
| <td>{0} c</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>fluid-ounce (US)</td> |
| <td>simple</td> |
| <td>{0} fl oz</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>fluid-ounce-imperial</td> |
| <td>simple</td> |
| <td>{0} fl oz Imp.</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>tablespoon</td> |
| <td>simple</td> |
| <td>{0} tbsp</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>teaspoon</td> |
| <td>simple</td> |
| <td>{0} tsp</td> |
| </tr> |
| <tr> |
| <td><em>volume</em></td> |
| <td>barrel</td> |
| <td>simple</td> |
| <td>{0} bbl</td> |
| </tr> |
| </table><br> |
| <p>There are three widths: <strong>long</strong>, |
| <strong>short</strong>, and <strong>narrow</strong>. As usual, |
| the narrow forms may not be unique: in English, 1′ could mean 1 |
| minute of arc, or 1 foot. Thus narrow forms should only be used |
| where the context makes the meaning clear.</p> |
| <p>Where the unit of measurement is one of the <a href= |
| "https://physics.nist.gov/cuu/Units/units.html">International |
| System of Units (SI)</a>, the short and narrow forms will |
| typically use the international symbols, such as “mm” for |
| millimeter. They may, however, be different if that is |
| customary for the language or locale. For example, in Russian |
| it may be more typical to see the Cyrillic characters “мм”.</p> |
| <p>Units are included for translation even where they are not |
| typically used in a particular locale, such as kilometers in |
| the US, or inches in Germany. This is to account for use by |
| travelers and specialized domains, such as the German |
| “̌Fernseher von 32 bis 55 Zoll (80 bis 140 cm)” for TV screen |
| size in inches and centimeters.</p> |
| <p>For temperature, there is a special unit <unit |
| type="temperature-generic">, which is used when it is clear |
| from context whether Celcius or Fahrenheit is implied.</p> |
| <p>For duration, there are special units such as <unit |
| type="duration-year-person"> and <unit |
| type="duration-year-week"> for indicating the age of a |
| person, which requires special forms in some languages. For |
| example, in "zh", references to a person being 3 days old or 30 |
| years old would use the forms “他3天大” and “他30岁” |
| respectively.</p> |
| <h3>6.4 <a name="compound-units" href="#compound-units" >Compound Units</a><a name= |
| "compoundUnitPattern" ></a><a name="perUnitPatterns" ></a></h3> |
| <p>A common combination of units is X per Y, such as <em>miles |
| per hour</em> or <em>liters per second</em> or <em>kilowatt-hours</em>. </p> |
| |
| <p>There are different types of structure used to build the localized name of compound units. All of these follow the inheritance specified in <a href= |
| "tr35.html#Lateral_Inheritance">Part 1, Section 4.1.2 Lateral |
| Inheritance</a>.</p> |
| <p><strong>Prefixes</strong> are for powers of 10 and powers of 1024 (the latter only used with digital units of measure). These are invariant for case, gender, or plural (though those could be added in the future if needed by a language).</p> |
| <pre><compoundUnit type="10p9"><br> <unitPrefixPattern>Giga{0}</unitPrefixPattern><br></compoundUnit> |
| |
| <compoundUnit type="1024p3"><br> <unitPrefixPattern>Gibi{0}</unitPrefixPattern><br></compoundUnit> |
| </pre> |
| <p><strong>compoundUnitPatterns</strong> are used for compounding units by multiplication or division: kilowatt-hours, or meters per second. These are invariant for case, gender, or plural (though those could be added in the future if needed by a language).</p> |
| <pre> |
| <compoundUnit type="per"><br> <compoundUnitPattern>{0} pro {1}</compoundUnitPattern><br></compoundUnit> |
| |
| <compoundUnit type="times"><br> <compoundUnitPattern>{0}⋅{1}</compoundUnitPattern><br></compoundUnit> |
| </pre><p>There can be at most one "per" pattern used in producing a compound unit, while the "times" pattern can be used multiple times.</p> |
| <p><strong>compoundUnitPattern1s</strong> are used for expressing powers, such as square meter or cubic foot. These are the most complicated, since they can vary by plural category (count), by case, and by gender. However, these extra attributes are only used if the are present in the <strong>grammaticalFeatures</strong> element for the language in question. See <a href="tr35-general.html#Grammatical_Features">Section 15, Grammatical Features</a>. Note that the additional grammar elements are only present in the <unitLength type='long'> form. </p> |
| <pre> |
| <compoundUnit type="power2"><br> <compoundUnitPattern1>{0} kw.</compoundUnitPattern1><br> <compoundUnitPattern1 count="one">{0} kwadratowe</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" case="accusative">{0} kwadratowe</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" case="dative">{0} kwadratowemu</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" case="genitive">{0} kwadratowego</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" case="instrumental">{0} kwadratowym</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" case="locative">{0} kwadratowym</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" case="vocative">{0} kwadratowe</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="feminine">{0} kwadratowa</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="feminine" case="accusative">{0} kwadratową</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="feminine" case="dative">{0} kwadratowej</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="feminine" case="genitive">{0} kwadratowej</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="feminine" case="instrumental">{0} kwadratową</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="feminine" case="locative">{0} kwadratowej</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="feminine" case="vocative">{0} kwadratowa</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="inanimate">{0} kwadratowy</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="inanimate" case="accusative">{0} kwadratowy</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="inanimate" case="dative">{0} kwadratowemu</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="inanimate" case="genitive">{0} kwadratowego</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="inanimate" case="instrumental">{0} kwadratowym</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="inanimate" case="locative">{0} kwadratowym</compoundUnitPattern1><br> <compoundUnitPattern1 count="one" gender="inanimate" case="vocative">{0} kwadratowy</compoundUnitPattern1><br> <compoundUnitPattern1 count="few">{0} kwadratowe</compoundUnitPattern1><br> <compoundUnitPattern1 count="few" case="accusative">{0} kwadratowe</compoundUnitPattern1><br> <compoundUnitPattern1 count="few" case="dative">{0} kwadratowym</compoundUnitPattern1> |
| …</pre> |
| |
| <p> </p> |
| <p>Some units already |
| have 'precomputed' forms, such as <strong>kilometer-per-hour</strong>; where such units exist, |
| they should be used in preference. </p> |
| |
| <p>If there is no precomputed form, the following process in pseudocode is used to generate a pattern for the compound unit. </p> |
| <p> </p> |
| <p><strong>pattern(unitId, locale, length, pluralCategory, caseVariant)</strong></p> |
| <ol> |
| <li>If the unitId is empty or invalid, fail</li> |
| <li>Put the unitId into normalized order: hour-kilowatt => kilowatt-hour, meter-square-meter-per-second-second => cubic-meter-per-square-second</li> |
| <li>Set result to be getValue(unitId with length, pluralCategory, caseVariant) |
| <ol> |
| <li>If result is not empty, return it</li> |
| </ol> |
| </li> |
| <li>Divide the unitId into numerator (the part before the "-per-") and denominator (the part after the "-per-). If both are empty, fail</li> |
| <li>Set both globalPlaceholder and globalPlaceholderPosition to be empty</li> |
| <li>Set numeratorUnitString to patternTimes(numerator, length, per0(pluralCategory), per0(caseVariant))</li> |
| <li>Set denominatorUnitString to patternTimes(denominator, length, per1(pluralCategory), per1(caseVariant)) </li> |
| <li>Set perPattern to be getValue(times, locale, length)</li> |
| <li>If the denominatorString is empty, set result to denominatorString, otherwise set result to format(perPattern, numeratorString, denominatorString) </li> |
| <li>return format(result, globalPlacholder, globalPlaceholderPosition)</li> |
| </ol> |
| <p><strong>patternTimes(product_unit, locale, length, pluralCategory, caseVariant)</strong></p> |
| <ol> |
| <li>Set hasMultiple to true iff product_unit has more than one single_unit</li> |
| <li>Set timesPattern to be getValue(times, locale, length)</li> |
| <li>Set result to be empty</li> |
| <li>For each single_unit in product_unit |
| <ol> |
| <li>If hasMultiple |
| <ol> |
| <li>Set singlePluralCategory to be times0(pluralCategory)</li> |
| <li>Set singleCaseVariant to be times0(caseVariant)</li> |
| <li>Set pluralCategory to be times1(pluralCategory)</li> |
| <li>Set caseVariant to be times1(caseVariant)</li> |
| </ol> |
| </li> |
| <li>Get the gender of that single_unit</li> |
| <li>If singleUnit starts with a dimensionality_prefix, such as 'square-' |
| <ol> |
| <li>set dimensionalityPrefixPattern to be getValue(that dimensionality_prefix, locale, length, singlePluralCategory, singleCaseVariant, gender), such as "{0} kwadratowym"</li> |
| <li>set singlePluralCategory to be power0(singlePluralCategory)</li> |
| <li>set singleCaseVariant to be power0(singleCaseVariant)</li> |
| <li>remove the dimensionality_prefix from singleUnit</li> |
| </ol> |
| </li> |
| <li>if singleUnit starts with an si_prefix, such as 'centi' |
| <ol> |
| <li>set siPrefixPattern to be getValue(that si_prefix, locale, length), such as "centy{0}"</li> |
| <li>set singlePluralCategory to be prefix0(singlePluralCategory)</li> |
| <li>set singleCaseVariant to be prefix0(singleCaseVariant)</li> |
| <li>remove the si_prefix from singleUnit</li> |
| </ol> |
| </li> |
| <li>Set corePattern to be the getValue(singleUnit, locale, length, singlePluralCategory, singleCaseVariant), such as "{0} metrem"</li> |
| <li>Extract(corePattern, coreUnit, placeholder, placeholderPosition) from that pattern.</li> |
| <li>If the position is <em>middle</em>, then fail</li> |
| <li>If globalPlaceholder is empty |
| <ol> |
| <li>Set globalPlaceholder to placeholder</li> |
| <li>Set globalPlaceholderPosition to placeholderPosition</li> |
| </ol> |
| </li> |
| <li>If siPrefixPattern is not empty |
| <ol> |
| <li>Set coreUnit to be the combineLowercasing(locale, length, siPrefixPattern, coreUnit)</li> |
| </ol> |
| </li> |
| <li>If dimensionalityPrefixPattern is not empty |
| <ol> |
| <li>Set coreUnit to be the combineLowercasing(locale, length, dimensionalityPrefixPattern, coreUnit)</li> |
| </ol> |
| </li> |
| <li>If the result is empty, set result to be coreUnit</li> |
| <li>Otherwise set result to be format(timesPattern, result, coreUnit)</li> |
| </ol> |
| </li> |
| <li>Return result</li> |
| </ol> |
| <p><strong>combineLowercasing(locale, length, prefixPattern, coreUnit)</strong></p> |
| <ol> |
| <li>If the length is "long" and the prefixPattern contains no spaces, lowercase the coreUnit according to the locale, thus "Quadrat{0}" causes "Zentimeter" to become "zentimeter"</li> |
| <li>return format(prefixPattern, unitPattern), eg "Quadratzentimeter"</li> |
| </ol> |
| <p><strong>format(pattern, arguments…)</strong></p> |
| <ol> |
| <li>return the result of substituting the arguments for the placeholders {0}, {1}, etc.</li> |
| </ol> |
| <p><strong>getValue(key, locale, length, variants…)</strong></p> |
| <ol> |
| <li>return the element value in the locale for the path corresponding to the key, locale, length, and variants — using normal inheritance including <a href="https://unicode-org.github.io/cldr/ldml/tr35.html#Multiple_Inheritance">Lateral Inheritance</a> and <a href="https://unicode-org.github.io/cldr/ldml/tr35.html#Parent_Locales">Parent Locales</a>.</li> |
| </ol> |
| <p><strong>Extract(corePattern, coreUnit, placeHolder, placeholderPosition)</strong></p> |
| <ol> |
| <li>Find the position of the <strong>placeHolder</strong> in the core pattern</li> |
| <li>Set <strong>placeHolderPosition</strong> to that postion (start, middle, or end)</li> |
| <li>Remove the <strong>placeHolder</strong> from the <strong>corePattern</strong> and set <strong>coreUnit</strong> to that result</li> |
| </ol> |
| <p><strong>per0(...), times0(...), etc.</strong></p> |
| <ol> |
| <li>These represent the <strong>deriveCompound</strong> data values from <strong>Section 16 <a href="#Grammatical_Derivations">Grammatical Derivations</a></strong>, where value0 of the per-structure is given as per0(...), and so on.</li> |
| <li>"power" corresponds to dimensionality_prefix, while "prefix" corresponds to si_prefix.</li> |
| </ol> |
| <p>If the locale does not provide full modern coverage, the process could fall back to root locale for some localized patterns. That may give a "ransom-note" effect for the user. To avoid that, it may be preferable to abort the process at that point, and then localize the unitId for the root locale.</p> |
| <p>If a unit is not supported by root, then the localization is not supported by CLDR and will fail.</p> |
| <h4>Precomposed Compound Units</h4> |
| <p>At each point in the process, if there is a precomposed form for a segment of the unitId, then that precomposed form should be used instead. For example, if there is a pattern in the locale for (square-kilometer, length, singlePluralCategory, singleCaseVariant, gender), then it should be used instead of composing the name from "square" and "kilometer".</p> |
| <p></p> |
| |
| <p>There is also a precomposed <strong>perUnitPattern</strong> which is used as the |
| denominator with another unit name. For example, a form such as |
| "{0} per second" can be used to form "2 feet <strong>per |
| second</strong>". The difference between these is that in some inflected |
| languages, the compoundUnit cannot be used to form grammatical |
| phrases. This is typically because the "per" + "second" combine |
| in a non-trivial way. The <strong>perUnitPattern</strong> should be applied if the denominator has only one element, and matches the perUnitPattern type.</p> |
| |
| <h3>6.5 <a name="Unit_Sequences" href="#Unit_Sequences" id= |
| "Unit_Sequences">Unit Sequences (Mixed Units)</a></h3> |
| <p>Units may be used in composed sequences (aka <em>mixed units</em>), such as <strong>5° |
| 30′</strong> for 5 degrees 30 minutes, or <strong>3 ft 2 |
| in.</strong> For that purpose, the appropriate width of the unit |
| listPattern can be used to compose the units in a sequence.</p> |
| <pre><listPattern type="unit"> (for the long form) |
| <listPattern type="unit-narrow"> |
| <listPattern type="unit-short"> |
| </pre> |
| <p>In such a sequence, decimal fractions are typically only displayed for |
| the last element of the sequence, if at all.</p> |
| |
| <h3>6.6 <a name="durationUnit" href="#durationUnit" id= |
| "durationUnit">durationUnit</a></h3> |
| <p>The durationUnit is a special type of unit used for composed |
| time unit durations.</p> |
| <pre><durationUnit type="hms"> |
| <durationUnitPattern>h:mm:ss</durationUnitPattern> <!-- 33:04:59 --> |
| </durationUnit> </pre> |
| <p>The type contains a skeleton, where 'h' stands for hours, |
| 'm' for minutes, and 's' for sections. These are the same |
| symbols used in availableFormats, except that there is no need |
| to distinguish different forms of the hour.</p> |
| <h3>6.7 <a name="coordinateUnit" href="#coordinateUnit" id= |
| "coordinateUnit">coordinateUnit</a></h3> |
| <p>The <strong>coordinateUnitPattern</strong> is a special type |
| of pattern used for composing degrees of latitude and |
| longitude, with an indicator of the quadrant. There are exactly |
| 4 type values, plus a displayName for the items in this |
| category. An angle is composed using the appropriate |
| combination of the <strong>angle-degrees</strong>, |
| <strong>angle-arc-minute</strong> and |
| <strong>angle-arc-second</strong> values. It is then |
| substituted for the placeholder field {0} in the appropriate |
| <strong>coordinateUnit</strong> pattern.</p> |
| <p class="xmlExample"> |
| <displayName>direction</displayName><br> |
| <coordinateUnitPattern |
| type="east">{0}E</coordinateUnitPattern><br> |
| <coordinateUnitPattern |
| type="north">{0}N</coordinateUnitPattern><br> |
| <coordinateUnitPattern |
| type="south">{0}S</coordinateUnitPattern><br> |
| <coordinateUnitPattern |
| type="west">{0}W</coordinateUnitPattern></p> |
| <h3>6.8 <a name="Territory_Based_Unit_Preferences" href= |
| "#Territory_Based_Unit_Preferences" id= |
| "Territory_Based_Unit_Preferences">Territory-Based Unit |
| Preferences</a></h3> |
| <p>Different locales have different preferences for which unit |
| or combination of units is used for a particular usage, such as |
| measuring a person’s height. This is more fine-grained than |
| merely a preference for metric versus US or UK measurement |
| systems. For example, one locale may use meters alone, while |
| another may use centimeters alone or a combination of meters |
| and centimeters; a third may use inches alone, or (informally) |
| a combination of feet and inches.</p> |
| <p>The <unitPreferenceData> element, described in |
| <a href="tr35-info.html#Preferred_Units_For_Usage">Preferred |
| Units for Specific Usages</a>, provides information on which |
| unit or combination of units is used for various purposes in |
| different locales, with options for the level of formality and |
| the scale of the measurement (e.g measuring the height of an |
| adult versus that of an infant).</p> |
| |
| <h3>6.9 <a name="Private_Use_Units" href="#Private_Use_Units" |
| id="Private_Use_Units">Private-Use Units</a></h3> |
| <p> |
| CLDR has reserved the "xxx-" prefix in the simple_unit part of the unit identifier BNF |
| for private-use units. CLDR will never define a type, simple unit, or compound unit |
| such that the unit identifier starts with "xxx-", ends with "-xxx", or contains "-xxx-". |
| </p> |
| <p> |
| For example, if you wanted to define your own unit "foo", you could use the simple unit "xxx-foo". |
| </p> |
| <p> |
| It is valid to construct compound units containing one or more private-use simple units. |
| For example, "xxx-foo-per-second" and "xxx-foo-per-xxx-bar" are both valid core unit |
| identifiers for compound units. |
| </p> |
| <p> |
| As explained earlier, CLDR defines all associations between types and units. It is |
| therefore not possible to construct a valid long unit identifier containing a private-use |
| unit; only core unit identifiers are possible. |
| </p> |
| <p>The older syntax used “x-”, which was expanded to “xxx-” to simplify use with BCP47 |
| syntax. That should be converted to “xxx-”.</p> |
| <h2>7 <a name="POSIX_Elements" href="#POSIX_Elements" id= |
| "POSIX_Elements">POSIX Elements</a></h2> |
| <p class="dtd"><!ELEMENT posix (alias | (messages*, |
| special*)) ><br> |
| <!ELEMENT messages (alias | ( yesstr*, nostr*)) ></p> |
| <p>The following are included for compatibility with POSIX.</p> |
| <p><posix><br> |
| <posix:messages><br> |
| <posix:yesstr><span style="color: #0000FF">ja</span></posix:yesstr><br> |
| |
| <posix:nostr><span style="color: #0000FF">nein</span></posix:nostr><br> |
| |
| </posix:messages><br> |
| <posix></p> |
| <ol> |
| <li>The values for yesstr and nostr contain a colon-separated |
| list of strings that would normally be recognized as "yes" |
| and "no" responses. For cased languages, this shall include |
| only the lower case version. POSIX locale generation tools |
| must generate the upper case equivalents, and the abbreviated |
| versions, and add the English words wherever they do not |
| conflict. Examples: |
| <ul> |
| <li>ja → ja:Ja:j:J:yes:Yes:y:Y</li> |
| <li>ja → ja:Ja:j:J:yes:Yes // exclude y:Y if it conflicts |
| with the native "no".</li> |
| </ul> |
| </li> |
| <li>The older elements yesexpr and noexpr are deprecated. |
| They should instead be generated from yesstr and nostr so |
| that they match all the responses.</li> |
| </ol> |
| <p>So for English, the appropriate strings and expressions |
| would be as follows:</p> |
| <p>yesstr "yes:y"<br> |
| nostr "no:n"</p> |
| <p>The generated yesexpr and noexpr would be:</p> |
| <p><code>yesexpr "^([yY]([eE][sS])?)"<br></code> This would |
| match y,Y,yes,yeS,yEs,yES,Yes,YeS,YEs,YES.<br> |
| <br> |
| <code>noexpr "^([nN][oO]?)"</code><br> |
| This would match n,N,no,nO,No,NO.</p> |
| <h2>8 <a name="Reference_Elements" href="#Reference_Elements" |
| id="Reference_Elements">Reference Element</a></h2> |
| <p>(Use only in supplemental data; deprecated for ldml.dtd and |
| locale data)</p> |
| <p class="dtd"><!ELEMENT references ( reference* ) ><br> |
| <!ELEMENT reference ( #PCDATA ) ><br> |
| <!ATTLIST reference type NMTOKEN #REQUIRED><br> |
| <!ATTLIST reference standard ( true | false ) #IMPLIED |
| ><br> |
| <!ATTLIST reference uri CDATA #IMPLIED ></p> |
| <p>The references section supplies a central location for |
| specifying references and standards. The uri should be supplied |
| if at all possible. If not online, then a ISBN number should be |
| supplied, such as in the following example:</p> |
| <p class="example"><reference type="R2" |
| uri="https://www.ur.se/nyhetsjournalistik/3lan.html">Landskoder |
| på Internet</reference><br> |
| <reference type="R3" uri="URN:ISBN:91-47-04974-X">Svenska |
| skrivregler</reference></p> |
| <h2>9 <a name="Segmentations" href="#Segmentations" id= |
| "Segmentations">Segmentations</a></h2> |
| <p class="dtd"><!ELEMENT segmentations ( alias | |
| segmentation*) ></p> |
| <p class="dtd"><!ELEMENT segmentation ( alias | (variables?, |
| segmentRules? , exceptions?, suppressions?) | special*) |
| ><br> |
| <!ATTLIST segmentation type NMTOKEN #REQUIRED ></p> |
| <p class="dtd"><!ELEMENT variables ( alias | variable*) |
| ></p> |
| <p class="dtd"><!ELEMENT variable ( #PCDATA ) ><br> |
| <!ATTLIST variable id CDATA #REQUIRED ></p> |
| <p class="dtd"><!ELEMENT segmentRules ( alias | rule*) |
| ></p> |
| <p class="dtd"><!ELEMENT rule ( #PCDATA ) ><br> |
| <!ATTLIST rule id NMTOKEN #REQUIRED ></p> |
| <p class="dtd"><!ELEMENT suppressions ( suppression* ) |
| ></p> |
| <p class="dtd"><!ATTLIST suppressions type NMTOKEN |
| "standard" ></p> |
| <p class="dtd"><!ATTLIST suppressions draft ( approved | |
| contributed | provisional | unconfirmed ) #IMPLIED ></p> |
| <p class="dtd"><!ELEMENT suppression ( #PCDATA ) ></p> |
| <p>The segmentations element provides for segmentation of text |
| into words, lines, or other segments. The structure is based on |
| [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX29">UAX29</a>] |
| notation, but adapted to be machine-readable. It uses a list of |
| variables (representing character classes) and a list of rules. |
| Each must have an id attribute.</p> |
| <p>The rules in <i>root</i> implement the segmentations found |
| in [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX29">UAX29</a>] and |
| [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX14">UAX14</a>], for |
| grapheme clusters, words, sentences, and lines. They can be |
| overridden by rules in child locales.</p> |
| <p>Here is an example:</p> |
| <pre><segmentations> |
| <segmentation type="GraphemeClusterBreak"> |
| <variables> |
| <variable id="$CR">\p{Grapheme_Cluster_Break=CR}</variable> |
| <variable id="$LF">\p{Grapheme_Cluster_Break=LF}</variable> |
| <variable id="$Control">\p{Grapheme_Cluster_Break=Control}</variable> |
| <variable id="$Extend">\p{Grapheme_Cluster_Break=Extend}</variable> |
| <variable id="$L">\p{Grapheme_Cluster_Break=L}</variable> |
| <variable id="$V">\p{Grapheme_Cluster_Break=V}</variable> |
| <variable id="$T">\p{Grapheme_Cluster_Break=T}</variable> |
| <variable id="$LV">\p{Grapheme_Cluster_Break=LV}</variable> |
| <variable id="$LVT">\p{Grapheme_Cluster_Break=LVT}</variable> |
| </variables> |
| <segmentRules> |
| <rule id="3"> $CR × $LF </rule> |
| <rule id="4"> ( $Control | $CR | $LF ) ÷ </rule> |
| <rule id="5"> ÷ ( $Control | $CR | $LF ) </rule> |
| <rule id="6"> $L × ( $L | $V | $LV | $LVT ) </rule> |
| <rule id="7"> ( $LV | $V ) × ( $V | $T ) </rule> |
| <rule id="8"> ( $LVT | $T) × $T </rule> |
| <rule id="9"> × $Extend </rule> |
| </segmentRules> |
| </segmentation> |
| ...</pre> |
| <p><b>Variables:</b> All variable ids must start with a $, and |
| otherwise be valid identifiers according to the Unicode |
| definitions in [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX31">UAX31</a>]. The |
| contents of a variable is a regular expression using variables |
| and <a href="tr35.html#Unicode_Sets">UnicodeSet</a>s. The |
| ordering of variables is important; they are evaluated in order |
| from first to last (see <i><a href= |
| "#Segmentation_Inheritance">Section 9.1 Segmentation |
| Inheritance</a></i>). It is an error to use a variable before |
| it is defined.</p> |
| <p><b>Rules:</b> The contents of a rule uses the syntax of |
| [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX29">UAX29</a>]. The |
| rules are evaluated in numeric id order (which may not be the |
| order in which the appear in the file). The first rule that |
| matches determines the status of a boundary position, that is, |
| whether it breaks or not. Thus ÷ means a break is allowed; × |
| means a break is forbidden. It is an error if the rule does not |
| contain exactly one of these characters (except where a rule |
| has no contents at all, or if the rule uses a variable that has |
| not been defined.</p> |
| <p>There are some implicit rules:</p> |
| <ul> |
| <li>The implicit initial rules are always "start-of-text ÷" |
| and "÷ end-of-text"; these are not to be included |
| explicitly.</li> |
| <li>The implicit final rule is always "Any ÷ Any". This is |
| not to be included explicitly.</li> |
| </ul> |
| <blockquote> |
| <p><b>Note:</b> A rule like X Format* -> X in [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX29">UAX29</a>] and |
| [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX14">UAX14</a>] is |
| not supported. Instead, this needs to be expressed as normal |
| regular expressions. The normal way to support this is to |
| modify the variables, such as in the following example:</p> |
| <pre id="line870"> |
| <variable id="$Format">\p{Word_Break=Format}</variable> |
| <variable id="$Katakana">\p{Word_Break=Katakana}</variable> |
| ... |
| <!-- In place of rule 3, add format and extend to everything --> |
| <variable id="$X">[$Format $Extend]*</variable> |
| <variable id="$Katakana">($Katakana $X)</variable> |
| <variable id="$ALetter">($ALetter $X)</variable> |
| ...</pre> |
| </blockquote> |
| <h3>9.1 <a name="Segmentation_Inheritance" href= |
| "#Segmentation_Inheritance" id= |
| "Segmentation_Inheritance">Segmentation Inheritance</a></h3> |
| <p>Variables and rules both inherit from the parent.</p> |
| <p><b>Variables:</b> The child's variable list is logically |
| appended to the parent's, and evaluated in that order. For |
| example:</p> |
| <p><font color="#0000FF"><code>// in parent</code></font> |
| <code><br> |
| <variable id="$AL">[:linebreak=AL:]</variable><br> |
| <variable |
| id="$YY">[[:linebreak=XX:]$AL]</variable></code> |
| <font color="#0000FF"><code>// adds $AL</code></font></p> |
| <p><font color="#0000FF"><code>// in child</code></font> |
| <code><br> |
| <variable id="$AL">[$AL && |
| [^a-z]]</variable> <font color="#0000FF">// changes $AL, |
| does not affect $YY</font><br> |
| <variable id="$ABC">[abc]</variable></code> |
| <font color="#0000FF"><code>// adds new rule</code></font></p> |
| <p><b>Rules:</b> The rules are also logically appended to the |
| parent's. Because rules are evaluated in numeric id order, to |
| insert a rule in between others just requires using an |
| intermediate number. For example, to insert a rule after |
| id="10.1" and before id="10.2", just use id="10.15". To delete |
| a rule, use empty contents, such as:</p> |
| <p><code><rule id="3"/></code> <font color= |
| "#0000FF"><code>// deletes rule 3</code></font></p> |
| <h3>9.2 <a name="Segmentation_Exceptions" href= |
| "#Segmentation_Exceptions" id= |
| "Segmentation_Exceptions">Segmentation Suppressions</a></h3> |
| <p><b>Note:</b> As of CLDR 26, the |
| <code><suppressions></code> data is to be considered a |
| technology preview. Data currently in CLDR was extracted from |
| the Unicode Localization Interoperability project, or ULI. See |
| <a href="http://uli.unicode.org">http://uli.unicode.org</a> for |
| more information on the ULI project.</p> |
| <p>The segmentation <b>suppressions</b> list provides a set of |
| cases which, though otherwise identified as a segment by rules, |
| should be skipped (suppressed) during segmentation.</p> |
| <p>For example, in the English phrase "Mr. Smith", CLDR |
| segmentation rules would normally find a Sentence Break between |
| "Mr" and "Smith". However, typically, "Mr." is just an |
| abbreviation for "Mister", and not actually the end of a |
| sentence.</p> |
| <p>Each suppression has a separate |
| <code><suppression></code> element, whose contents are |
| the break to be skipped.</p> |
| <p>Example:</p> |
| <pre> |
| <segmentation type="SentenceBreak"> |
| <suppressions type="standard" draft="provisional"> |
| <suppression>Maj.</suppression> |
| <suppression>Mr.</suppression> |
| <suppression>Lt.Cdr.</suppression> |
| . . . |
| </suppressions> |
| </segmentation> |
| </pre> |
| <p><b>Note:</b> These elements were called |
| <code><exceptions></code> and |
| <code><exception></code> prior to CLDR 26, but those |
| names are now deprecated.</p> |
| <h2>10 <a name="Transforms" href="#Transforms" id= |
| "Transforms">Transforms</a></h2> |
| <p>Transforms provide a set of rules for transforming text via |
| a specialized set of context-sensitive matching rules. They are |
| commonly used for transliterations or transcriptions, but also |
| other transformations such as full-width to half-width (for |
| <i>katakana</i> characters). The rules can be simple one-to-one |
| relationships between characters, or involve more complicated |
| mappings. Here is an example:</p> |
| <pre> |
| <transform source="Greek" target="Latin" variant="UNGEGN" direction="both"> |
| ... |
| <comment>Useful variables</comment> |
| <tRule>$gammaLike = [ΓΚΞΧγκξχϰ] ;</tRule> |
| <tRule>$egammaLike = [GKXCgkxc] ;</tRule> |
| ... |
| <comment>Rules are predicated on running NFD first, and NFC afterwards</comment> |
| <tRule>::NFD (NFC) ;</tRule> |
| ... |
| <tRule>λ ↔ l ;</tRule> |
| <tRule>Λ ↔ L ;</tRule> |
| ... |
| <tRule>γ } $gammaLike ↔ n } $egammaLike ;</tRule> |
| <tRule>γ ↔ g ;</tRule> |
| ... |
| <tRule>::NFC (NFD) ;</tRule> |
| ... |
| </transform></pre> |
| <p>The source and target values are valid locale identifiers, |
| where 'und' means an unspecified language, plus some additional |
| extensions.</p> |
| <ul> |
| <li>The long names of a script according to [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX24">UAX24</a>] may |
| be used instead of the short script codes. The script |
| identifier may also omit und; that is, "und_Latn" may be |
| written as just "Latn".</li> |
| <li>The long names of the English languages may also be used |
| instead of the languages.</li> |
| <li>The term "Any" may be used instead of a solitary |
| "und".</li> |
| <li>Other identifiers may be used for special purposes. In |
| CLDR, these include: Accents, Digit, Fullwidth, Halfwidth, |
| Jamo, NumericPinyin, Pinyin, Publishing, Tone. (Other than |
| these values, valid private use locale identifiers should be |
| used, such as "x-Special".)</li> |
| <li>When presenting localizing transform names, the "und_" is |
| normally omitted. Thus for a transliterator with the ID |
| "und_Latn-und_Grek" (or the equivalent "Latin-Greek"), the |
| translated name for Greek would be Λατινικό-Ελληνικό.</li> |
| </ul> |
| <p>In version 29.0, BCP47 identifiers were added as aliases |
| (while retaining the old identifiers). The following table |
| shows the relationship between the old identifiers and the |
| BCP47 format identifiers.</p> |
| <table class='simple'> |
| <tbody> |
| <tr> |
| <th>Old ID</th> |
| <th>BCP47 ID</th> |
| <th>Comments</th> |
| </tr> |
| <tr> |
| <td><strong>es_FONIPA</strong>-es_419_FONIPA</td> |
| <td>es-419-fonipa-t-<strong>es-fonipa</strong></td> |
| <td rowspan="2">The order reverses with -t-. That is, the |
| language subtag part is what results.</td> |
| </tr> |
| <tr> |
| <td><strong>hy_AREVMDA</strong>-hy_AREVMDA_FONIPA</td> |
| <td>hy-arevmda-fonipa-t-<strong>hy-arevmda</strong></td> |
| </tr> |
| <tr> |
| <td><strong>Devanagari</strong>-Latin</td> |
| <td>und-Latn-t-<strong>und-deva</strong></td> |
| <td rowspan="2">Scripts add <strong>und-</strong></td> |
| </tr> |
| <tr> |
| <td><strong>Latin</strong>-Devanagari</td> |
| <td>und-Deva-t-<strong>und-latn</strong></td> |
| </tr> |
| <tr> |
| <td>Greek-Latin/UNGEGN</td> |
| <td>und-Latn-t-und-grek-<strong>m0-ungegn</strong></td> |
| <td>Variants use the <strong>-m0-</strong> key.</td> |
| </tr> |
| <tr> |
| <td>Russian-Latin/BGN</td> |
| <td>ru<strong>-Latn</strong>-t-ru-m0-bgn</td> |
| <td>Languages will have a script when it isn’t the |
| default.</td> |
| </tr> |
| <tr> |
| <td>Any-Hex/xml</td> |
| <td>und-t-<strong>d0-hex</strong>-m0-xml</td> |
| <td rowspan="2"><strong>Any</strong> becomes |
| <strong>und</strong>, and keys <strong>d0</strong> |
| (destination) and <strong>s0</strong> (source) are used |
| for non-locales.</td> |
| </tr> |
| <tr> |
| <td>Hex-Any/xml</td> |
| <td>und-t-<strong>s0-hex</strong>-m0-xml</td> |
| </tr> |
| <tr> |
| <td>Any-<strong>Publishing</strong></td> |
| <td>und-t-d0-<strong>publish</strong></td> |
| <td rowspan="2">Non-locales are normally the lowercases |
| of the old ID, but may change because of BCP47 length |
| restrictions.</td> |
| </tr> |
| <tr> |
| <td><strong>Publishing</strong>-Any</td> |
| <td>und-t-s0-<strong>publish</strong></td> |
| </tr> |
| </tbody> |
| </table> |
| <p>Note that the script and region codes are cased iff they are |
| in the main subtag, but are lowercase in extensions.</p> |
| <h3>10.1 <a name="Inheritance" href="#Inheritance" id= |
| "Inheritance">Inheritance</a></h3> |
| <p>The CLDR transforms are built using the following locale |
| inheritance. While this inheritance is not required of LDML |
| implementations, the transforms supplied with CLDR may not |
| otherwise behave as expected without some changes.</p> |
| <p>For either the source or the target, the fallback starts |
| from the maximized locale ID (using the likely-subtags data). |
| It also uses the country for lookup before the base language is |
| reached, and root is never accessed: instead the script(s) |
| associated with the language are used. Where there are multiple |
| scripts, the maximized script is tried first, and then the |
| other scripts associated with the language (from supplemental |
| data).</p> |
| <p>For example, see the bolded items below in the fallback |
| chain for <strong>az_IR</strong>.</p> |
| <table> |
| <tr> |
| <th> </th> |
| <th>Locale ID</th> |
| <th>Comments</th> |
| </tr> |
| <tr> |
| <td>1</td> |
| <td><strong>az_Arab_IR</strong></td> |
| <td>The maximized locale for az_IR</td> |
| </tr> |
| <tr> |
| <td>2</td> |
| <td>az_Arab</td> |
| <td>Normal fallback</td> |
| </tr> |
| <tr> |
| <td>3</td> |
| <td><strong>az_IR</strong></td> |
| <td>Inserted country locale</td> |
| </tr> |
| <tr> |
| <td>4</td> |
| <td>az</td> |
| <td>Normal fallback</td> |
| </tr> |
| <tr> |
| <td>5</td> |
| <td><strong>Arab</strong></td> |
| <td>Maximized script</td> |
| </tr> |
| <tr> |
| <td>6</td> |
| <td><strong>Cyrl</strong></td> |
| <td>Other associated script</td> |
| </tr> |
| </table> |
| <p>The source, target, and variant use "laddered" fallback, |
| where the source changes the most quickly (using the above |
| rules), then the target (using the above rules), then the |
| variant if any, is discarded. That is, in pseudo code:</p> |
| <ul> |
| <li>for variant in {variant, ""} |
| <ul> |
| <li>for target in target-chain |
| <ul> |
| <li>for source in source-chain |
| <ul> |
| <li>transform = lookup source-target/variant</li> |
| <li>if transform != null return transform</li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <p>For example, here is the fallback chain for |
| <strong>ru_RU-el_GR/BGN</strong>.</p> |
| <div align="center"> |
| <table> |
| <tr> |
| <th>source</th> |
| <th> </th> |
| <th>target</th> |
| <th>variant</th> |
| </tr> |
| <tr> |
| <td>ru_RU</td> |
| <td>-</td> |
| <td>el_GR</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>ru</td> |
| <td>-</td> |
| <td>el_GR</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>Cyrl</td> |
| <td>-</td> |
| <td>el_GR</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>ru_RU</td> |
| <td>-</td> |
| <td>el</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>ru</td> |
| <td>-</td> |
| <td>el</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>Cyrl</td> |
| <td>-</td> |
| <td>el</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>ru_RU</td> |
| <td>-</td> |
| <td>Grek</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>ru</td> |
| <td>-</td> |
| <td>Grek</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>Cyrl</td> |
| <td>-</td> |
| <td>Grek</td> |
| <td>/BGN</td> |
| </tr> |
| <tr> |
| <td>ru_RU</td> |
| <td>-</td> |
| <td>el_GR</td> |
| <td></td> |
| </tr> |
| <tr> |
| <td>ru</td> |
| <td>-</td> |
| <td>el_GR</td> |
| <td></td> |
| </tr> |
| <tr> |
| <td>Cyrl</td> |
| <td>-</td> |
| <td>el_GR</td> |
| <td></td> |
| </tr> |
| <tr> |
| <td>ru_RU</td> |
| <td>-</td> |
| <td>el</td> |
| <td></td> |
| </tr> |
| <tr> |
| <td>ru</td> |
| <td>-</td> |
| <td>el</td> |
| <td></td> |
| </tr> |
| <tr> |
| <td>Cyrl</td> |
| <td>-</td> |
| <td>el</td> |
| <td></td> |
| </tr> |
| <tr> |
| <td>ru_RU</td> |
| <td>-</td> |
| <td>Grek</td> |
| <td></td> |
| </tr> |
| <tr> |
| <td>ru</td> |
| <td>-</td> |
| <td>Grek</td> |
| <td></td> |
| </tr> |
| <tr> |
| <td>Cyrl</td> |
| <td>-</td> |
| <td>Grek</td> |
| <td></td> |
| </tr> |
| </table> |
| </div> |
| <p>Japanese and Korean are special, since they can be |
| represented by combined script codes, such as ja_Jpan, ja_Hrkt, |
| ja_Hira, or ja_Kana. These need to be considered in the above |
| fallback chain as well.</p> |
| <h4>10.1.1 <a name="Pivots" href="#Pivots" id= |
| "Pivots">Pivots</a></h4> |
| <p>Transforms can also use <i>pivots</i>. These are used when |
| there is no direct transform between a source and target, but |
| there are transforms X-Y and Y-Z. In such a case, the |
| transforms can be internally chained to get X-Y = X-Y;Y-Z. This |
| is done explicitly with the Indic script transforms: to get |
| Devanagari-Latin, internally it is done by transforming first |
| from Devanagari to Interindic (an internal superset encoding |
| for Indic scripts), then from Interindic to Latin. This allows |
| there to be only N sets of transform rules for the Indic |
| scripts: each one to and from Interindic. These pivots are |
| explicitly represented in the CLDR transforms.</p> |
| <p>Note that the characters currently used by Interindic are |
| private use characters. To prevent those from “leaking” out |
| into text, transforms converting from Interindic must ensure |
| that they convert all the possible values used in |
| Interindic.</p> |
| <p>The pivots can also be produced automatically (implicitly), |
| as a fallback. A particularly useful pivot is IPA, since that |
| tends to preserve pronunciation. For example, <em>Czech to |
| IPA</em> can be chained with <em>IPA to Katakana</em> to get |
| <em>Czech to Katakana</em>.</p> |
| <p>CLDR often has special forms of IPA: not just "und-FONIPA" |
| but "cs-FONIPA": specifically IPA that has come from Czech. |
| These variants typically preserve some features of the source |
| language — such as double consonants — that are |
| indistinguishable from single consonants in that language, but |
| that are often preserved in traditional transliterations. Thus |
| when matching prospective pivots, FONIPA is treated specially. |
| If there is an exact match, that match is used (such as |
| cs-cs_FONIPA + cs_FONIPA-ko). Otherwise, the language is |
| ignored, as for example in cs-cs_FONIPA + ru_FONIPA-ko.</p> |
| <p>The interaction of implicit pivots and inheritance may |
| result in a longer inheritance chain lookup than desired, so |
| implementers may consider having some sort of caching mechanism |
| to increase performance.</p> |
| <h3>10.2 <a name="Variants" href="#Variants" id= |
| "Variants">Variants</a></h3> |
| <p>Variants used in CLDR include UNGEGN and BGN, both |
| indicating sources for transliterations. There is an additional |
| attribute <code>private="true"</code> which is used to indicate |
| that the transform is meant for internal use, and should not be |
| displayed as a separate choice in a UI.</p> |
| <p>There are many different systems of transliteration. The |
| goal for the "unqualified" script transliterations are</p> |
| <ol> |
| <li>to be lossless when going to Latin and back</li> |
| <li>to be as lossless as possible when going to other |
| scripts</li> |
| <li>to abide by a common standard as much as possible |
| (possibly supplemented to meet goals 1 and 2).</li> |
| </ol> |
| <p>Language-to-language transliterations, and variant |
| script-to-script transliterations are generally transcriptions, |
| and not expected to be lossless.</p> |
| <p>Additional transliterations may also be defined, such as |
| customized language-specific transliterations (such as between |
| Russian and French), or those that match a particular |
| transliteration standard, such as the following:</p> |
| <ul> |
| <li>UNGEGN - United Nations Group of Experts on Geographical |
| Names</li> |
| <li>BGN - United States Board on Geographic Names</li> |
| <li>ISO9 - ISO/IEC 9</li> |
| <li>ISO15915 - ISO/IEC 15915</li> |
| <li>ISCII91 - ISCII 91</li> |
| <li>KMOCT - South Korean Ministry of Culture & |
| Tourism</li> |
| <li>USLC - US Library of Congress</li> |
| <li>UKPCGN - Permanent Committee on Geographical Names for |
| British Official Use</li> |
| <li>RUGOST - Russian Main Administration of Geodesy and |
| Cartography</li> |
| </ul> |
| <p>The rules for transforms are described in Section 10.3 |
| <a href="#Transform_Rules_Syntax">Transform Rules Syntax</a>. |
| For more information on Transliteration, see <a href= |
| "http://cldr.unicode.org/index/cldr-spec/transliteration-guidelines"> |
| Transliteration Guidelines</a>.</p> |
| <h3>10.3 <a name="Transform_Rules_Syntax" href= |
| "#Transform_Rules_Syntax" id="Transform_Rules_Syntax">Transform |
| Rules Syntax</a></h3> |
| <p class="dtd"><!ELEMENT transforms ( transform*) ><br> |
| <!ELEMENT transform ((comment | tRule)*) ><br> |
| <!ATTLIST transform source CDATA #IMPLIED ><br> |
| <!ATTLIST transform target CDATA #IMPLIED ><br> |
| <!ATTLIST transform variant CDATA #IMPLIED ><br> |
| <!ATTLIST transform direction ( forward | backward | both ) |
| "both" ><br> |
| <!ATTLIST transform alias CDATA #IMPLIED ><br> |
| <!--@VALUE--><br> |
| <!ATTLIST transform backwardAlias CDATA #IMPLIED ><br> |
| <!--@VALUE--><br> |
| <!ATTLIST transform visibility ( internal | external ) |
| "external" ><br> |
| <!ELEMENT comment (#PCDATA) ><br> |
| <!ELEMENT tRule (#PCDATA) ></p> |
| <p>The transform attributes indicate the |
| <strong>source</strong>, <strong>target</strong>, |
| <strong>direction</strong>, and <strong>alias</strong>es. For |
| example:</p> |
| <p class='example'><transform<br> |
| source="ja_Hrkt"<br> |
| target="ja_Latn"<br> |
| variant="BGN"<br> |
| direction="forward"<br> |
| draft="provisional"<br> |
| alias="Katakana-Latin/BGN |
| ja-Latn-t-ja-hrkt-m0-bgn"></p> |
| <p>The direction is either <strong>forward</strong> or |
| <strong>both</strong> (<strong>backward</strong> is possible in |
| theory, but not used). This indicates which directions the |
| rules support.</p> |
| <p>If the direction is <strong>forward</strong>, then an ID is |
| composed from <strong>target + "-" + source + "/" + |
| variant</strong>. If the direction is <strong>both</strong>, |
| then the inverse ID is also value: <strong>source + "-" + |
| target + "/" + variant</strong>. The <strong>alias</strong> |
| attribute contains a space-delimited list of alternant forward |
| IDs, while the <strong>backwardAlias</strong> contains a |
| space-delimited list of alternant backward IDs. The BCP47 |
| versions of the IDs will be in the <strong>alias</strong> |
| and/or <strong>backwardAlias</strong> attributes.</p> |
| <p>The <strong>visibility</strong> attribute indicates whether |
| the IDs should be externally visible, or whether they are only |
| used internally.</p> |
| <p>In previous versions, the rules were expressed as |
| fine-grained XML. That was discarded in CLDR version 29, in |
| favor of a simpler format where the separate rules are simply |
| terminated with ";".</p> |
| <p>The transform rules are similar to regular-expression |
| substitutions, but adapted to the specific domain of text |
| transformations. The rules and comments in this discussion will |
| be intermixed, with # marking the comments. The simplest rule |
| is a conversion rule, which replaces one string of characters |
| with another. The conversion rule takes the following form:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>xy → z |
| ;</code></td> |
| </tr> |
| </table> |
| <p>This converts any substring "xy" into "z". Rules are |
| executed in order; consider the following rules:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>sch → sh ;<br> |
| ss → z ;</code></td> |
| </tr> |
| </table> |
| <p>This conversion rule transforms "bass school" into "baz |
| shool". The transform walks through the string from start to |
| finish. Thus given the rules above "bassch" will convert to |
| "bazch", because the "ss" rule is found before the "sch" rule |
| in the string (later, we'll see a way to override this |
| behavior). If two rules can both apply at a given point in the |
| string, then the transform applies the first rule in the |
| list.</p> |
| <p>All of the ASCII characters except numbers and letters are |
| reserved for use in the rule syntax, as are the characters →, |
| ←, ↔. Normally, these characters do not need to be converted. |
| However, to convert them use either a pair of single quotes or |
| a slash. The pair of single quotes can be used to surround a |
| whole string of text. The slash affects only the character |
| immediately after it. For example, to convert from a |
| U+2190 ( ← ) LEFTWARDS ARROW to the string |
| "arrow sign" (with a space), use one of the following |
| rules:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>\← |
| → arrow\ sign ;<br> |
| '←' → 'arrow sign' ;<br> |
| '←' → arrow' 'sign ;</code></td> |
| </tr> |
| </table> |
| <p>Spaces may be inserted anywhere without any effect on the |
| rules. Use extra space to separate items out for clarity |
| without worrying about the effects. This feature is |
| particularly useful with combining marks; it is handy to put |
| some spaces around it to separate it from the surrounding text. |
| The following is an example:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code> → i ; # an |
| iota-subscript diacritic turns into an i.</code></td> |
| </tr> |
| </table> |
| <p>For a real space in the rules, place quotes around it. For a |
| real backslash, either double it \\, or quote it '\'. For a |
| real single quote, double it '', or place a backslash before it |
| \'.</p> |
| <p>Any text that starts with a hash mark and concludes a line |
| is a comment. Comments help document how the rules work. The |
| following shows a comment in a rule:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>x → ks ; # change |
| every x into ks</code></td> |
| </tr> |
| </table> |
| <p>The “\u” and “\x” hex notations can be used instead of any |
| letter. For instance, instead of using the Greek π, one could |
| write either of the following:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>\u03C0 → p ;<br> |
| \x{3C0} → p ;</code></td> |
| </tr> |
| </table> |
| <p>One can also define and use variables, such as:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>$pi = \u03C0 ;<br> |
| $pi → p ;</code></td> |
| </tr> |
| </table> |
| <h4>10.3.1 <a name="Dual_Rules" href="#Dual_Rules" id= |
| "Dual_Rules">Dual Rules</a></h4> |
| <p>Rules can also specify what happens when an inverse |
| transform is formed. To do this, we reverse the direction of |
| the "←" sign. Thus the above example becomes:</p> |
| <table cellspacing="0" cellpadding="8"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>$pi ← p |
| ;</code></td> |
| </tr> |
| </table> |
| <p>With the inverse transform, "p" will convert to the Greek p. |
| These two directions can be combined together into a dual |
| conversion rule by using the "↔" operator, yielding:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>$pi ↔ p |
| ;</code></td> |
| </tr> |
| </table> |
| <h4>10.3.2 <a name="Context" href="#Context" id= |
| "Context">Context</a></h4> |
| <p>Context can be used to have the results of a transformation |
| be different depending on the characters before or after. The |
| following rule removes hyphens, but only when they follow |
| lowercase characters:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>[:Lowercase:] { |
| '-' → ;</code></td> |
| </tr> |
| </table> |
| <p>Contexts can be before or after or both, such as in a rule |
| to remove hyphens between lowercase and uppercase letters:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>[:Lowercase:] { |
| '-' } [:Uppercase:] → ;</code></td> |
| </tr> |
| </table> |
| <p>Each context is optional and may be empty; the following two |
| rules are equivalent:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>$pi ↔ p ;<br> |
| {$pi} ↔ {p} ;</code></td> |
| </tr> |
| </table> |
| <p>The context itself ([: <code>Lowercase</code> :]) is |
| unaffected by the replacement; only the text within braces is |
| changed.</p> |
| <p>Character classes (UnicodeSets) in the contexts can contain |
| the special symbol $, which means “off either end of the |
| string”. It is roughly similar to $ and ^ in regex. Unlike |
| normal regex, however, it can occur in character classes. Thus |
| the following rule removes hyphens that are after lowercase |
| characters, <em>or</em> are at the start of a string.</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>[[:Lowercase:]$] |
| {'-' → ;</code></td> |
| </tr> |
| </table> |
| <p>Thus the negation of a UnicodeSet will normally also match |
| before or after the end of a string. The following will remove |
| hyphens that are not after lowercase characters<em>, including |
| hyphens at the start of a string</em>.</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>[^[:Lowercase:]] |
| {'-' → ;</code></td> |
| </tr> |
| </table> |
| <p>It will thus convert “-B A-B a-b” to “B AB a-b”.</p> |
| <h4>10.3.3 <a name="Revisiting" href="#Revisiting" id= |
| "Revisiting">Revisiting</a></h4> |
| <p>If the resulting text contains a vertical bar "|", then that |
| means that processing will proceed from that point and that the |
| transform will revisit part of the resulting text. Thus the | |
| marks a "cursor" position. For example, if we have the |
| following, then the string "xa" will convert to "w".</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>x → y | z ;<br> |
| z a → w;</code></td> |
| </tr> |
| </table> |
| <p>First, "xa" is converted to "yza". Then the processing will |
| continue from after the character "y", pick up the "za", and |
| convert it. Had we not had the "|", the result would have been |
| simply "yza". The '@' character can be used as filler character |
| to place the revisiting point off the start or end of the |
| string. Thus the following causes x to be replaced, and the |
| cursor to be backed up by two characters.</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>x → |
| |@@y;</code></td> |
| </tr> |
| </table> |
| <h4>10.3.4 <a name="Example" href="#Example" id= |
| "Example">Example</a></h4> |
| <p>The following shows how these features are combined together |
| in the Transliterator "Any-Publishing". This transform converts |
| the ASCII typewriter conventions into text more suitable for |
| desktop publishing (in English). It turns straight quotation |
| marks or UNIX style quotation marks into curly quotation marks, |
| fixes multiple spaces, and converts double-hyphens into a |
| dash.</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code># Variables<br> |
| <br> |
| $single = \' ;<br> |
| $space = ' ' ;<br> |
| $double = \" ;<br> |
| $back = \` ;<br> |
| $tab = '\u0008' ;<br> |
| <br> |
| # the following is for spaces, line ends, (, [, {, ...<br> |
| $makeRight = [[:separator:][:start punctuation:][:initial |
| punctuation:]] ;<br> |
| <br> |
| # fix UNIX quotes<br> |
| <br> |
| $back $back → “ ; # generate right d.q.m. (double quotation |
| mark)<br> |
| $back → ‘ ;<br> |
| <br> |
| # fix typewriter quotes, by context<br> |
| <br> |
| $makeRight { $double ↔ “ ; # convert a double to right |
| d.q.m. after certain chars<br> |
| ^ { $double → “ ; # convert a double at the start of the |
| line.<br> |
| $double ↔ ” ; # otherwise convert to a left q.m.<br> |
| <br> |
| $makeRight {$single} ↔ ‘ ; # do the same for s.q.m.s<br> |
| ^ {$single} → ‘ ;<br> |
| $single ↔ ’;<br> |
| <br> |
| # fix multiple spaces and hyphens<br> |
| <br> |
| $space {$space} → ; # collapse multiple spaces<br> |
| '--' ↔ — ; # convert fake dash into real one</code></td> |
| </tr> |
| </table> |
| <p>There is an online demo where the rules can be tested, |
| at:</p> |
| <p><a target="demo" href= |
| "https://util.unicode.org/UnicodeJsps/transform.jsp">http://unicode.org/cldr/utility/transform.jsp</a></p> |
| <h4>10.3.5 <a name="Rule_Syntax" href="#Rule_Syntax" id= |
| "Rule_Syntax">Rule Syntax</a></h4> |
| <p>The following describes the full format of the list of rules |
| used to create a transform. Each rule in the list is terminated |
| by a semicolon. The list consists of the following:</p> |
| <ul> |
| <li>an optional filter rule</li> |
| <li>zero or more transform rules</li> |
| <li>zero or more variable-definition rules</li> |
| <li>zero or more conversion rules</li> |
| <li>an optional inverse filter rule</li> |
| </ul> |
| <p>The filter rule, if present, must appear at the beginning of |
| the list, before any of the other rules. The inverse |
| filter rule, if present, must appear at the end of the list, |
| after all of the other rules. The other rules may occur |
| in any order and be freely intermixed.</p> |
| <p>The rule list can also generate the inverse of the |
| transform. In that case, the inverse of each of the rules is |
| used, as described below.</p> |
| <h4>10.3.6 <a name="Transform_Rules" href="#Transform_Rules" |
| id="Transform_Rules">Transform Rules</a></h4> |
| <p>Each transform rule consists of two colons followed by a |
| transform name, which is of the form source-target. For |
| example:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>:: NFD ;<br> |
| :: und_Latn-und_Greek ;<br> |
| :: Latin-Greek; # alternate form</code></td> |
| </tr> |
| </table> |
| <p>If either the source or target is 'und', it can be omitted, |
| thus 'und_NFC' is equivalent to 'NFC'. For compatibility, the |
| English names for scripts can be used instead of the und_Latn |
| locale name, and "Any" can be used instead of "und". Case is |
| not significant.</p> |
| <p>The following transforms are defined not by rules, but by |
| the operations in the Unicode Standard, and may be used in |
| building any other transform:</p> |
| <blockquote> |
| <b>Any-NFC, Any-NFD, Any-NFKD, Any-NFKC</b> - the |
| normalization forms defined by [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX15">UAX15</a>].<br> |
| <p><b>Any-Lower, Any-Upper, Any-Title</b> - full case |
| transformations, defined by [<a href= |
| "tr35.html#Unicode">Unicode</a>] Chapter 3.</p> |
| </blockquote> |
| <p>In addition, the following special cases are defined:</p> |
| <blockquote> |
| <b>Any-Null</b> - has no effect; that is, each character is |
| left alone.<br> |
| <b>Any-Remove</b> - maps each character to the empty string; |
| this, removes each character. |
| </blockquote> |
| <p>The inverse of a transform rule uses parentheses to indicate |
| what should be done when the inverse transform is used. For |
| example:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>:: lower () ; # |
| only executed for the normal<br> |
| :: (lower) ; # only executed for the inverse<br> |
| :: lower ; # executed for both the normal and the |
| inverse</code></td> |
| </tr> |
| </table> |
| <h4>10.3.7 <a name="Variable_Definition_Rules" href= |
| "#Variable_Definition_Rules" id= |
| "Variable_Definition_Rules">Variable Definition Rules</a></h4> |
| <p>Each variable definition is of the following form:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>$variableName = |
| contents ;</code></td> |
| </tr> |
| </table> |
| <p>The variable name can contain letters and digits, but must |
| start with a letter. More precisely, the variable names use |
| Unicode identifiers as defined by [<a href= |
| "https://www.unicode.org/reports/tr41/#UAX31">UAX31</a>]. The |
| identifier properties allow for the use of foreign letters and |
| numbers.</p> |
| <p>The contents of a variable definition is any sequence of |
| Unicode sets and characters or characters. For example:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>$mac = M [aA] [cC] |
| ;</code></td> |
| </tr> |
| </table> |
| <p>Variables are only replaced within other variable definition |
| rules and within conversion rules. They have no effect on |
| transliteration rules.</p> |
| <h4>10.3.8 <a name="Filter_Rules" href="#Filter_Rules" id= |
| "Filter_Rules">Filter Rules</a></h4> |
| <p>A filter rule consists of two colons followed by a |
| UnicodeSet. This filter is global in that only the characters |
| matching the filter will be affected by any transform rules or |
| conversion rules. The inverse filter rule consists of two |
| colons followed by a UnicodeSet in parentheses. This filter is |
| also global for the inverse transform.</p> |
| <p>For example, the Hiragana-Latin transform can be implemented |
| by "pivoting" through the Katakana converter, as follows:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>:: [:^Katakana:] ; |
| # do not touch any katakana that was in the text!<br> |
| :: Hiragana-Katakana;<br> |
| :: Katakana-Latin;<br> |
| :: ([:^Katakana:]) ; # do not touch any katakana that was |
| in the text<br> |
| |
| # for the inverse either!</code></td> |
| </tr> |
| </table> |
| <p>The filters keep the transform from mistakenly converting |
| any of the "pivot" characters. Note that this is a case where a |
| rule list contains no conversion rules at all, just transform |
| rules and filters.</p> |
| <h4>10.3.9 <a name="Conversion_Rules" href="#Conversion_Rules" |
| id="Conversion_Rules">Conversion Rules</a></h4> |
| <p>Conversion rules can be forward, backward, or double. The |
| complete conversion rule syntax is described below:</p> |
| <p><b>Forward</b></p> |
| <blockquote> |
| <p>A forward conversion rule is of the following form:</p> |
| <blockquote> |
| <pre> |
| before_context { text_to_replace } after_context → completed_result | result_to_revisit ;</pre> |
| </blockquote> |
| <p>If there is no before_context, then the "{" can be |
| omitted. If there is no after_context, then the "}" can be |
| omitted. If there is no result_to_revisit, then the "|" can |
| be omitted. A forward conversion rule is only executed for |
| the normal transform and is ignored when generating the |
| inverse transform.</p> |
| </blockquote> |
| <p><b>Backward</b></p> |
| <blockquote> |
| <p>A backward conversion rule is of the following form:</p> |
| <blockquote> |
| <pre> |
| completed_result | result_to_revisit ← before_context { text_to_replace } after_context ;</pre> |
| </blockquote> |
| <p>The same omission rules apply as in the case of forward |
| conversion rules. A backward conversion rule is only executed |
| for the inverse transform and is ignored when generating the |
| normal transform.</p> |
| </blockquote> |
| <p><b>Dual</b></p> |
| <blockquote> |
| <p>A dual conversion rule combines a forward conversion rule |
| and a backward conversion rule into one, as discussed above. |
| It is of the form:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>a { b | c } d ↔ |
| e { f | g } h ;</code></td> |
| </tr> |
| </table> |
| <p>When generating the normal transform and the inverse, the |
| revisit mark "|" and the before and after contexts are |
| ignored on the sides where they do not belong. Thus, the |
| above is exactly equivalent to the sequence of the following |
| two rules:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>a { b c } |
| d → f | g ;<br> |
| b | c ← e { f g } h ; </code></td> |
| </tr> |
| </table> |
| </blockquote> |
| <h4>10.3.10 <a name= |
| "Intermixing_Transform_Rules_and_Conversion_Rules" href= |
| "#Intermixing_Transform_Rules_and_Conversion_Rules" id= |
| "Intermixing_Transform_Rules_and_Conversion_Rules">Intermixing |
| Transform Rules and Conversion Rules</a></h4> |
| <p>Transform rules and conversion rules may be freely |
| intermixed. Inserting a transform rule into the middle of a set |
| of conversion rules has an important side effect.</p> |
| <p>Normally, conversion rules are considered together as a |
| group. The only time their order in the rule set is |
| important is when more than one rule matches at the same point |
| in the string. In that case, the one that occurs earlier |
| in the rule set wins. In all other situations, when |
| multiple rules match overlapping parts of the string, the one |
| that matches earlier wins.</p> |
| <p>Transform rules apply to the whole string. If you have |
| several transform rules in a row, the first one is applied to |
| the whole string, then the second one is applied to the whole |
| string, and so on. To reconcile this behavior with the |
| behavior of conversion rules, transform rules have the side |
| effect of breaking a surrounding set of conversion rules into |
| two groups: First all of the conversion rules before the |
| transform rule are applied as a group to the whole string in |
| the usual way, then the transform rule is applied to the whole |
| string, and then the conversion rules after the transform rule |
| are applied as a group to the whole string. For example, |
| consider the following rules:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>abc → xyz;<br> |
| xyz → def;<br> |
| ::Upper;</code></td> |
| </tr> |
| </table> |
| <p>If you apply these rules to “abcxyz”, you get |
| “XYZDEF”. If you move the “::Upper;” to the middle of the |
| rule set and change the cases accordingly, then applying this |
| to “abcxyz” produces “DEFDEF”.</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>abc → xyz;<br> |
| ::Upper;<br> |
| XYZ → DEF;</code></td> |
| </tr> |
| </table> |
| <p>This is because “::Upper;” causes the transliterator to |
| reset to the beginning of the string. The first rule turns the |
| string into “xyzxyz”, the second rule upper cases the whole |
| thing to “XYZXYZ”, and the third rule turns this into |
| “DEFDEF”.</p> |
| <p>This can be useful when a transform naturally occurs in |
| multiple “passes.” Consider this rule set:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>[:Separator:]* → ' |
| ';<br> |
| 'high school' → 'H.S.';<br> |
| 'middle school' → 'M.S.';<br> |
| 'elementary school' → 'E.S.';</code></td> |
| </tr> |
| </table> |
| <p>If you apply this rule to “high school”, you get “H.S.”, but |
| if you apply it to “high school” (with two spaces), you |
| just get “high school” (with one space). To have “high |
| school” (with two spaces) turn into “H.S.”, you'd either have |
| to have the first rule back up some arbitrary distance (far |
| enough to see “elementary”, if you want all the rules to work), |
| or you have to include the whole left-hand side of the first |
| rule in the other rules, which can make them hard to read and |
| maintain:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>$space = |
| [:Separator:]*;<br> |
| high $space school → 'H.S.';<br> |
| middle $space school → 'M.S.';<br> |
| elementary $space school → 'E.S.';</code></td> |
| </tr> |
| </table> |
| <p>Instead, you can simply insert “ <code>::Null;</code> ” in |
| order to get things to work right:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>[:Separator:]* → ' |
| ';<br> |
| ::Null;<br> |
| 'high school' → 'H.S.';<br> |
| 'middle school' → 'M.S.';<br> |
| 'elementary school' → 'E.S.';</code></td> |
| </tr> |
| </table> |
| <p>The “::Null;” has no effect of its own (the null transform, |
| by definition, does not do anything), but it splits the other |
| rules into two “passes”: The first rule is applied to the whole |
| string, normalizing all runs of white space into single spaces, |
| and then we start over at the beginning of the string to look |
| for the phrases. “high school” (with four |
| spaces) gets correctly converted to “H.S.”.</p> |
| <p>This can also sometimes be useful with rules that have |
| overlapping domains. Consider this rule set from |
| before:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>sch → sh ;<br> |
| ss → z ;</code></td> |
| </tr> |
| </table> |
| <p>Apply this rule to “bassch” results in “bazch” because “ss” |
| matches earlier in the string than “sch”. If you really wanted |
| “bassh”—that is, if you wanted the first rule to win even when |
| the second rule matches earlier in the string, you'd either |
| have to add another rule for this special case...</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>sch → sh ;<br> |
| ssch → ssh;<br> |
| ss → z ;</code></td> |
| </tr> |
| </table> |
| <p>...or you could use a transform rule to apply the |
| conversions in two passes:</p> |
| <table cellspacing="0" cellpadding="8" border="1"> |
| <tr> |
| <td valign="top" bgcolor="#EEEEEE"><code>sch → sh ;<br> |
| ::Null;<br> |
| ss → z ;</code></td> |
| </tr> |
| </table> |
| <h4>10.3.11 <a name="Inverse_Summary" href="#Inverse_Summary" |
| id="Inverse_Summary">Inverse Summary</a></h4> |
| <p>The following table shows how the same rule list generates |
| two different transforms, where the inverse is restated in |
| terms of forward rules (this is a contrived example, simply to |
| show the reordering):</p> |
| <table> |
| <tr bgcolor="#99CCFF"> |
| <th bgcolor="#CCCCCC">Original Rules</th> |
| <th bgcolor="#CCCCCC">Forward</th> |
| <th bgcolor="#CCCCCC">Inverse</th> |
| </tr> |
| <tr bgcolor="#99CCFF"> |
| <td bgcolor="#EEEEEE"><code>:: [:Uppercase Letter:] ;<br> |
| :: latin-greek ;<br> |
| :: greek-japanese ;<br> |
| x ↔ y ;<br> |
| z → w ;<br> |
| r ← m ;<br> |
| :: upper;<br> |
| a → b ;<br> |
| c ↔ d ;<br> |
| :: any-publishing ;<br> |
| :: ([:Number:]) ;</code></td> |
| <td bgcolor="#EEEEEE"><code>:: [:Uppercase Letter:] ;<br> |
| :: latin-greek ;<br> |
| :: greek-japanese ;<br> |
| x → y ;<br> |
| z → w ;<br> |
| :: upper ;<br> |
| a → b ;<br> |
| c → d ;<br> |
| :: any-publishing ;<br></code></td> |
| <td bgcolor="#EEEEEE"><code>:: [:Number:] ;<br> |
| :: publishing-any ;<br> |
| d → c ;<br> |
| :: lower ;<br> |
| y → x ;<br> |
| m → r ;<br> |
| :: japanese-greek ;<br> |
| :: greek-latin ;<br></code></td> |
| </tr> |
| </table> |
| <p>Note how the irrelevant rules (the inverse filter rule and |
| the rules containing ←) are omitted (ignored, actually) in the |
| forward direction, and notice how things are reversed: the |
| transform rules are inverted and happen in the opposite order, |
| and the groups of conversion rules are also executed in the |
| opposite relative order (although the rules within each group |
| are executed in the same order).</p> |
| <h2>11 <a name="ListPatterns" href="#ListPatterns" id= |
| "ListPatterns">List Patterns</a></h2> |
| <p class="dtd"><!ELEMENT listPatterns (alias | |
| (listPattern*, special*)) ></p> |
| <p class="dtd"><!ELEMENT listPattern (alias | |
| (listPatternPart*, special*)) ><br> |
| <!ATTLIST listPattern type (NMTOKEN) #IMPLIED ></p> |
| <p class="dtd"><!ELEMENT listPatternPart ( #PCDATA ) |
| ><br> |
| <!ATTLIST listPatternPart type (start | middle | end | 2 | |
| 3) #REQUIRED ></p> |
| <p>List patterns can be used to format variable-length lists of |
| things in a locale-sensitive manner, such as "Monday, Tuesday, |
| Friday, and Saturday" (in English) versus "lundi, mardi, |
| vendredi et samedi" (in French). For example, consider the |
| following example:</p> |
| <pre class="example"><listPatterns> |
| <listPattern> |
| <listPatternPart type="2">{0} and {1}</listPatternPart> |
| <listPatternPart type="start">{0}, {1}</listPatternPart> |
| <listPatternPart type="middle">{0}, {1}</listPatternPart> |
| <listPatternPart type="end">{0}, and {1}</listPatternPart> |
| </listPattern> |
| </listPatterns></pre> |
| <p>The data is used as follows: If there is a type type matches |
| exactly the number of elements in the desired list (such as "2" |
| in the above list), then use that pattern. Otherwise,</p> |
| <ol> |
| <li>Format the last two elements with the "end" format.</li> |
| <li>Then use middle format to add on subsequent elements |
| working towards the front, all but the very first element. |
| That is, {1} is what you've already done, and {0} is the |
| previous element.</li> |
| <li>Then use "start" to add the front element, again with {1} |
| as what you've done so far, and {0} is the first |
| element.</li> |
| </ol> |
| <p>Thus a list (a,b,c,...m, n) is formatted as: |
| <code>start(a,middle(b,middle(c,middle(...end(m, n))...)))</code></p> |
| <p>More sophisticated implementations can customize the process to improve the results for languages where context is important. For example:</p> |
| <table> |
| <tr> |
| <td rowspan="3">Spanish |
| </td> |
| <td>AND |
| </td> |
| <td>Use ‘e’ instead of ‘y’ in the listPatternPart for "end" and "2" in either of the following cases: |
| <ol> |
| |
| <li>The value substituted for {1} starts with ‘i’ |
| <ol> |
| <li><em>fuerte <strong>e</strong> indomable, </em>not <em>fuerte <strong>y</strong> indomable</em></li> |
| </ol></li> |
| <li>The value substituted for {1} starts with ‘hi’, but not with ‘hie’ or ‘hia’ |
| <ol> |
| <li><em>tos <strong>e</strong> hipo,</em> not <em>tos <strong>y</strong> hipo </em></li> |
| <li><em>gua <strong>y</strong> hielo,</em> not <em>agua <strong>e</strong> hielo </em></li> |
| </ol> |
| </li> |
| </ol></td> |
| </tr> |
| <tr> |
| <td>OR |
| </td> |
| <td>Use ‘u’ instead of ‘o’ in the listPatternPart for "end" and "2" in any of the following cases: |
| <ol> |
| |
| <li>The value substituted for {1} starts with ‘o’ or ‘ho’ |
| <ol> |
| <li><em>delfines <strong>u</strong> orcas,</em> not <em>deflines <strong>o</strong> orcas</em></li> |
| <li><em>mañana <strong>u</strong> hoy,</em> not <em>mañana <strong>o</strong> hoy</em></li> |
| </ol> |
| </li> |
| <li> The value substituted for {1} starts with ‘8’ |
| <ol> |
| <li><em>6 <strong>u</strong> 8,</em> not <em>6 <strong>o</strong> 8</em></li> |
| </ol> |
| </li> |
| <li>The value substituted for {1} starts with ‘11’ where the numeric value is 11 x 10<sup>3×y</sup> |
| (eg 11 thousand, 11.23 million, ...) |
| <ol> |
| <li><em>10 <strong>u</strong> 11,</em> not <em>10 <strong>o</strong> 11</em></li> |
| <li><em>10 <strong>u</strong> 11.000,</em> not <em>10 <strong>o</strong> 11.000</em></li> |
| <li><em>10 <strong>o</strong> 111,</em> not <em>10 <strong>u</strong> 111</em></li> |
| </ol> |
| </li></ol> |
| |
| </td> |
| </tr> |
| <tr> |
| <td colspan="2">See <a href='https://www.rae.es/consultas/cambio-de-la-y-copulativa-en-e'>Cambio de la y copulativa en e</a><br> |
| <strong>Note: </strong>more advanced implementations may also consider the pronunciation, such as foreign words where the ‘h’ is not mute.</td> |
| </tr> |
| <tr> |
| <td rowspan="2">Hebrew |
| </td> |
| <td>AND |
| </td> |
| <td>Use ‘-ו’ instead of ‘ו’ in the listPatternPart for "end" and "2" in the following case: |
| <ol> |
| <li>if the value substituted for {1} starts with something other than a Hebrew letter, such as a digit (0-9) or a Latin-script letter |
| <ol> |
| <li><em>one hour and two minutes = "שעה ושתי דקות"</em></li> |
| <li><em>one hour and 9 minutes = "שעה ו-9 דקות” </em></li> |
| </ol></li> |
| |
| |
| </ol></td> |
| </tr> |
| <tr> |
| <td colspan="2">See <a href="https://hebrew-academy.org.il/topic/hahlatot/punctuation/#target-3475">https://hebrew-academy.org.il/topic/hahlatot/punctuation/#target-3475</a></td> |
| </tr> |
| </table><br> |
| <p>The following type attributes are in use:</p> |
| <table border="1" cellpadding="2" cellspacing="0" class= |
| 'simple'> |
| <tr> |
| <th>type attribute value</th> |
| <th>Description</th> |
| <th>Examples</th> |
| </tr> |
| <tr> |
| <td nowrap>standard (or no <strong>type</strong>)</td> |
| <td>A typical 'and' list for arbitrary placeholders</td> |
| <td nowrap><em>January, February, and March</em></td> |
| </tr> |
| <tr> |
| <td>standard-short</td> |
| <td>A short version of an 'and' list, suitable for use with |
| short or abbreviated placeholder values</td> |
| <td><em>Jan., Feb., and Mar.</em></td> |
| </tr> |
| <tr> |
| <td>standard-narrow</td> |
| <td>A yet shorter version of a short 'and' list (where possible)</td> |
| <td><em>Jan., Feb., Mar.</em></td> |
| </tr> |
| <tr> |
| <td>or</td> |
| <td>A typical 'or' list for arbitrary placeholders</td> |
| <td><em>January, February, or March</em></td> |
| </tr> |
| <tr> |
| <td>or-short</td> |
| <td>A short version of an 'or' list</td> |
| <td><em>Jan., Feb., or Mar.</em></td> |
| </tr> |
| <tr> |
| <td>or-narrow</td> |
| <td>A yet shorter version of a short 'or' list (where possible)</td> |
| <td><em>Jan., Feb., or Mar.</em></td> |
| </tr> |
| <tr> |
| <td>unit</td> |
| <td>A list suitable for wide units</td> |
| <td><em>3 feet, 7 inches</em></td> |
| </tr> |
| <tr> |
| <td>unit-short</td> |
| <td>A list suitable for short units</td> |
| <td><em>3 ft, 7 in</em></td> |
| </tr> |
| <tr> |
| <td>unit-narrow</td> |
| <td>A list suitable for narrow units, where space on the |
| screen is very limited.</td> |
| <td><em>3′ 7″</em></td> |
| </tr> |
| </table> |
| <p>In many languages there may not be a difference among many |
| of these lists. In others, the spacing, the length or presence |
| or a conjunction, and the separators may change.</p> |
| <h3>11.1 <a name="List_Gender" href="#List_Gender" id= |
| "List_Gender">Gender of Lists</a></h3> |
| <p class="dtd"><!-- Gender List support --><br> |
| <!ELEMENT gender ( personList+ ) ><br> |
| <!ELEMENT personList EMPTY ><br> |
| <!ATTLIST personList type ( neutral | mixedNeutral | |
| maleTaints ) #REQUIRED ><br> |
| <!ATTLIST personList locales NMTOKENS #REQUIRED ><br></p> |
| <p>This can be used to determine the gender of a list of 2 or |
| more persons, such as "Tom and Mary", for use with |
| gender-selection messages. For example,</p> |
| <pre class="example"> |
| <supplementalData> |
| <gender> |
| <!-- neutral: gender(list) = other --> |
| <personList type="neutral" locales="af da en..."/> |
| |
| <!-- mixedNeutral: gender(all male) = male, gender(all female) = female, otherwise gender(list) = other --> |
| <personList type="mixedNeutral" locales="el"/> |
| |
| <!-- maleTaints: gender(all female) = female, otherwise gender(list) = male --> |
| <personList type="maleTaints" locales="ar ca..."/> |
| </gender> |
| </supplementalData></pre> |
| <p>There are three ways the gender of a list can be |
| formatted:</p> |
| <ol> |
| <li><b>neutral:</b> A gender-independent "other" form will be |
| used for the list.</li> |
| <li><b>mixedNeutral:</b> If the elements of the list are all |
| male, "male" form is used for the list. If all the elements |
| of the lists are female, "female" form is used. If the list |
| has a mix of male, female and neutral names, the "other" form |
| is used.</li> |
| <li><b>maleTaints:</b> If all the elements of the lists are |
| female, "female" form is used, otherwise the "male" form is |
| used.</li> |
| </ol> |
| <h2>12 <a name="Context_Transform_Elements" href= |
| "#Context_Transform_Elements" id= |
| "Context_Transform_Elements">ContextTransform Elements</a></h2> |
| <p class="dtd"><!ELEMENT contextTransforms ( alias | |
| (contextTransformUsage*, special*)) ><br> |
| <!ELEMENT contextTransformUsage ( alias | |
| (contextTransform*, special*)) ><br> |
| <!ATTLIST contextTransformUsage type CDATA #REQUIRED |
| ><br> |
| <!ELEMENT contextTransform ( #PCDATA ) ><br> |
| <!ATTLIST contextTransform type ( uiListOrMenu | stand-alone |
| ) #REQUIRED ></p> |
| <p>CLDR locale elements provide data for display names or |
| symbols in many categories. The default capitalization for |
| these elements is intended to be the form used in the middle of |
| running text. In many languages, other capitalization may be |
| required in other contexts, depending on the type of name or |
| symbol.</p> |
| <p>Each <contextTransformUsage> element’s type attribute |
| specifies a category of data from the table below; the element |
| includes one or more <contextTransform> elements that |
| specify how to perform capitalization of this category of data |
| in different contexts. The <contextTransform> elements |
| are needed primarily for cases in which the capitalization is |
| other than the default form used in the middle of running text. |
| However, it is also useful to mark cases in which it is |
| <em>known</em> that no transformation from this default form is |
| needed; this may be necessary, for example, to override the |
| transformation specified by a parent locale. The following |
| values are currently defined for the <contextTransform> |
| element:</p> |
| <ul> |
| <li>"titlecase-firstword" designates the case in which raw |
| CLDR text that is in middle-of-sentence form, typically |
| lowercase, needs to have its first word titlecased.</li> |
| <li>"no-change" designates the case in which it is known that |
| no change from the raw CLDR text (middle-of-sentence form) is |
| needed.</li> |
| </ul> |
| <p>Four contexts for capitalization behavior are currently |
| identified. Two need no data, and hence have no corresponding |
| <contextTransform> elements:</p> |
| <ul> |
| <li>In the middle of running text: This is the default form, |
| so no additional data is required.</li> |
| <li>At the beginning of a complete sentence: The initial word |
| is titlecased, no additional data is required to indicate |
| this.</li> |
| </ul> |
| <p>Two other contexts require <contextTransform> elements |
| if their capitalization behavior is other than the default for |
| running text. The context is identified by the type attribute, |
| as follows:</p> |
| <ul> |
| <li>uiListOrMenu: Capitalization appropriate to a |
| user-interface list or menu.</li> |
| <li>stand-alone: Capitalization appropriate to an isolated |
| user-interface element (e.g. an isolated name on a calendar |
| page)</li> |
| </ul> |
| <p>Example:</p> |
| <pre> <contextTransforms> |
| <contextTransformUsage type="languages"> |
| <contextTransform type="uiListOrMenu">titlecase-firstword</contextTransform> |
| <contextTransform type="stand-alone">titlecase-firstword</contextTransform> |
| </contextTransformUsage> |
| <contextTransformUsage type="month-format-except-narrow"> |
| <contextTransform type="uiListOrMenu">titlecase-firstword</contextTransform> |
| </contextTransformUsage> |
| <contextTransformUsage type="month-standalone-except-narrow"> |
| <contextTransform type="uiListOrMenu">titlecase-firstword</contextTransform> |
| </contextTransformUsage> |
| </contextTransforms></pre> |
| <table cellspacing="0" cellpadding="2" border="1" class= |
| 'simple'> |
| <caption> |
| <a name="contextTransformUsage_type_attribute_values" href= |
| "#contextTransformUsage_type_attribute_values" id= |
| "contextTransformUsage_type_attribute_values">Element |
| contextTransformUsage type attribute values</a> |
| </caption> |
| <tr> |
| <th>type attribute value</th> |
| <th>Description</th> |
| </tr> |
| <tr> |
| <td>all</td> |
| <td>Special value, indicates that the specified |
| transformation applies to all of the categories below</td> |
| </tr> |
| <tr> |
| <td>language</td> |
| <td>localeDisplayNames language names</td> |
| </tr> |
| <tr> |
| <td>script</td> |
| <td>localeDisplayNames script names</td> |
| </tr> |
| <tr> |
| <td>territory</td> |
| <td>localeDisplayNames territory names</td> |
| </tr> |
| <tr> |
| <td>variant</td> |
| <td>localeDisplayNames variant names</td> |
| </tr> |
| <tr> |
| <td>key</td> |
| <td>localeDisplayNames key names</td> |
| </tr> |
| <tr> |
| <td>keyValue</td> |
| <td>localeDisplayNames key value type names</td> |
| </tr> |
| <tr> |
| <td>month-format-except-narrow</td> |
| <td>dates/calendars/calendar[type=*]/months format wide and |
| abbreviated month names</td> |
| </tr> |
| <tr> |
| <td>month-standalone-except-narrow</td> |
| <td>dates/calendars/calendar[type=*]/months stand-alone |
| wide and abbreviated month names</td> |
| </tr> |
| <tr> |
| <td>month-narrow</td> |
| <td>dates/calendars/calendar[type=*]/months format and |
| stand-alone narrow month names</td> |
| </tr> |
| <tr> |
| <td>day-format-except-narrow</td> |
| <td>dates/calendars/calendar[type=*]/days format wide and |
| abbreviated day names</td> |
| </tr> |
| <tr> |
| <td>day-standalone-except-narrow</td> |
| <td>dates/calendars/calendar[type=*]/days stand-alone wide |
| and abbreviated day names</td> |
| </tr> |
| <tr> |
| <td>day-narrow</td> |
| <td>dates/calendars/calendar[type=*]/days format and |
| stand-alone narrow day names</td> |
| </tr> |
| <tr> |
| <td>era-name</td> |
| <td>dates/calendars/calendar[type=*]/eras (wide) era |
| names</td> |
| </tr> |
| <tr> |
| <td>era-abbr</td> |
| <td>dates/calendars/calendar[type=*]/eras abbreviated era |
| names</td> |
| </tr> |
| <tr> |
| <td>era-narrow</td> |
| <td>dates/calendars/calendar[type=*]/eras narrow era |
| names</td> |
| </tr> |
| <tr> |
| <td>quarter-format-wide</td> |
| <td>dates/calendars/calendar[type=*]/quarters format wide |
| quarter names</td> |
| </tr> |
| <tr> |
| <td>quarter-standalone-wide</td> |
| <td>dates/calendars/calendar[type=*]/quarters stand-alone |
| wide quarter names</td> |
| </tr> |
| <tr> |
| <td>quarter-abbreviated</td> |
| <td>dates/calendars/calendar[type=*]/quarters format and |
| stand-alone abbreviated quarter names</td> |
| </tr> |
| <tr> |
| <td>quarter-narrow</td> |
| <td>dates/calendars/calendar[type=*]/quarters format and |
| stand-alone narrow quarter names</td> |
| </tr> |
| <tr> |
| <td>calendar-field</td> |
| <td>dates/fields/field[type=*]/displayName field names<br> |
| (for relative forms see type "tense" below)</td> |
| </tr> |
| <tr> |
| <td>zone-exemplarCity</td> |
| <td>dates/timeZoneNames/zone[type=*]/exemplarCity city |
| names</td> |
| </tr> |
| <tr> |
| <td>zone-long</td> |
| <td>dates/timeZoneNames/zone[type=*]/long zone names</td> |
| </tr> |
| <tr> |
| <td>zone-short</td> |
| <td>dates/timeZoneNames/zone[type=*]/short zone names</td> |
| </tr> |
| <tr> |
| <td>metazone-long</td> |
| <td>dates/timeZoneNames/metazone[type=*]/long metazone |
| names</td> |
| </tr> |
| <tr> |
| <td>metazone-short</td> |
| <td>dates/timeZoneNames/metazone[type=*]/short metazone |
| names</td> |
| </tr> |
| <tr> |
| <td>symbol</td> |
| <td>numbers/currencies/currency[type=*]/symbol symbol |
| names</td> |
| </tr> |
| <tr> |
| <td>currencyName</td> |
| <td>numbers/currencies/currency[type=*]/displayName |
| currency names</td> |
| </tr> |
| <tr> |
| <td>currencyName-count</td> |
| <td> |
| numbers/currencies/currency[type=*]/displayName[count=*] |
| currency names for use with count</td> |
| </tr> |
| <tr> |
| <td>relative</td> |
| <td>dates/fields/field[type=*]/relative and |
| dates/fields/field[type=*]/relativeTime relative field |
| names</td> |
| </tr> |
| <tr> |
| <td>unit-pattern</td> |
| <td> |
| units/unitLength[type=*]/unit[type=*]/unitPattern[count=*] |
| unit names</td> |
| </tr> |
| <tr> |
| <td>number-spellout</td> |
| <td>rbnf/rulesetGrouping[type=*]/ruleset[type=*]/rbnfrule |
| number spellout rules</td> |
| </tr> |
| </table> |
| <h2>13 <a name="Choice_Patterns" href="#Choice_Patterns" id= |
| "Choice_Patterns">Choice Patterns</a></h2> |
| <p>A choice pattern is a string that chooses among a number of |
| strings, based on numeric value. It has the following form:</p> |
| <p><choice_pattern> = <choice> ( '|' <choice> |
| )*<br> |
| <choice> = |
| <number><relation><string><br> |
| <number> = ('+' | '-')? (<font size="3">'∞' | [0-9]+ ('.' |
| [0-9]+)?)<br> |
| <relation> = '<' | '</font> <span style= |
| "color: blue">≤'</span></p> |
| <p>The interpretation of a choice pattern is that given a |
| number N, the pattern is scanned from right to left, for each |
| choice evaluating <number> <relation> N. The first |
| choice that matches results in the corresponding string. If no |
| match is found, then the first string is used. For example:</p> |
| <table border="1" cellpadding="0" cellspacing="0"> |
| <tr> |
| <td width="33%">Pattern</td> |
| <td width="33%">N</td> |
| <td width="34%">Result</td> |
| </tr> |
| <tr> |
| <td width="33%" rowspan="4">0≤Rf|1≤Ru|1<Re</td> |
| <td width="33%">-<font size="3">∞,</font> -3, -1, |
| -0.000001</td> |
| <td width="34%">Rf (defaulted to first string)</td> |
| </tr> |
| <tr> |
| <td width="33%">0, 0.01, 0.9999</td> |
| <td width="34%">Rf</td> |
| </tr> |
| <tr> |
| <td width="33%">1</td> |
| <td width="34%">Ru</td> |
| </tr> |
| <tr> |
| <td width="33%">1.00001, 5, 99, <font size= |
| "3">∞</font></td> |
| <td width="34%">Re</td> |
| </tr> |
| </table> |
| <p>Quoting is done using ' characters, as in date or number |
| formats.</p> |
| <h2>14 <a name="Annotations" href="#Annotations" id= |
| "Annotations">Annotations and Labels</a></h2> |
| <p>Annotations provide information about characters, typically |
| used in input. For example, on a mobile keyboard they can be |
| used to do completion. They are typically used for symbols, |
| especially emoji characters.</p> |
| <p>For more information, see version 5.0 or <a href= |
| "https://unicode.org/reports/tr51/">UTR #51, Unicode Emoji</a>. |
| (Note that during the period between the publication of CLDR |
| v31 and that of Emoji 5.0, the “Latest Proposed Update” link |
| should be used to get to the draft specification for Emoji |
| 5.0.)<br></p> |
| <p class="dtd"><!ELEMENT annotations ( annotation* ) |
| ></p> |
| <p class="dtd"><!ELEMENT annotation ( #PCDATA ) ></p> |
| <p class="dtd"><!ATTLIST annotation cp CDATA #REQUIRED |
| ></p> |
| <p class="dtd"><!ATTLIST annotation type (tts) #IMPLIED |
| ></p> |
| <p>There are two kinds of annotations: <strong>short |
| names</strong>, and <strong>keywords</strong>.</p> |
| <p>With an attribute <strong>type="tts"</strong>, the value is |
| a <strong>short name</strong>, such as one that can be used for |
| text-to-speech. It should be treated as one of the element |
| values for other purposes.</p> |
| <p>When there is no <strong>type</strong> attribute, the value |
| is a set of <strong>keywords</strong>, delimited by |. Spaces |
| around each element are to be trimmed. The |
| <strong>keywords</strong> are words associated with the |
| character(s) that might be used in searching for the character, |
| or in predictive typing on keyboards. The short name itself can |
| be used as a keyword.</p> |
| <p>Here is an example from German:</p> |
| <pre class="example"> |
| <annotation cp="👎">schlecht | Hand | Daumen | nach unten</annotation> |
| <annotation cp="👎" type="tts">Daumen runter</annotation> |
| </pre> |
| <p>The cp attribute value has two formats: either a single |
| string, or if contained within […] a UnicodeSet. The latter |
| format can contain multiple code points or strings. A code |
| point pr string can occur in multiple annotation element |
| <strong>cp</strong> values, such as the following, which also |
| contains the "thumbs down" character.</p> |
| <pre class="example"> |
| <span><annotation cp='[☝✊-✍👆-👐👫-👭💁🖐🖕🖖🙅🙆🙋🙌🙏🤘]'>hand</annotation></span></pre> |
| <p>Both for short names and keywords, values do not have to |
| match between different languages. They should be the most |
| common values that people using <em>that</em> language would |
| associated with those characters. For example, a "black heart" |
| might have the association of "wicked" in English, but not in |
| some other languages.</p> |
| <p>The cp value may contain sequences, but does not contain any |
| Emoji or Text Variant (VS15 & VS16) characters. All such |
| characters should be removed before looking up any short names |
| and keywords.</p> |
| <h3>14.1 <a name="SynthesizingNames" href="#SynthesizingNames" |
| id="SynthesizingNames">Synthesizing Sequence Names</a></h3> |
| <p>Many emoji are represented by sequences of characters. When |
| there are no annotation elements for that string, the short |
| name can be synthesized as follows. <strong>Note:</strong> The |
| process details may change after the release of this |
| specification, and may further change in the future if other |
| sequences are added. Please see the <a href= |
| 'https://sites.google.com/site/cldr/index/downloads/cldr-30#TOC-Known-Issues'> |
| Known Issues</a> section of the CLDR download page for any |
| updates.</p> |
| <ol> |
| <li>If <strong>sequence</strong> is an <strong>emoji flag |
| sequence</strong>, look up the territory name in CLDR for the |
| corresponding ASCII characters and return as the short name. |
| For example, the regional indicator symbols P+F would map to |
| “Französisch-Polynesien” in German.</li> |
| <li>If <strong>sequence</strong> is an <strong>emoji tag |
| sequence</strong>, look up the subdivision name in CLDR for |
| the corresponding ASCII characters and return as the short |
| name. For example, the TAG characters gbsct would map to |
| “Schottland” in German.</li> |
| <li>If <strong>sequence</strong> is a keycap sequence or 🔟, |
| use the characterLabel for "keycap" as the |
| <strong>prefixName</strong> and set the |
| <strong>suffix</strong> to be the sequence (or "10" in the |
| case of 🔟), then go to step 8.</li> |
| <li>Let <strong>suffix</strong> and |
| <strong>prefixName</strong> be "".</li> |
| <li>If <strong>sequence</strong> contains any emoji |
| modifiers, move them (in order) into <strong>suffix</strong>, |
| removing them from <strong>sequence</strong>.</li> |
| <li>If <strong>sequence</strong> is a "KISS", "HEART", "FAMILY", or "HOLDING HANDS" emoji ZWJ sequence, move the characters in <strong> |
| sequence</strong> to the front of <strong>suffix</strong>, |
| and set the <strong>sequence</strong> to be "💏", "💑", or |
| "👪" respectively, and go to step 7. |
| <ol> |
| <li>A KISS sequence contains ZWJ, "💋", and "❤", which are |
| skipped in moving to <strong>suffix</strong>.</li> |
| <li>A HEART sequence contains ZWJ and "❤", which are |
| skipped in moving to <strong>suffix</strong>.</li> |
| <li>A HOLDING HANDS sequence contains ZWJ+🤝+ZWJ, which are skipped in moving to <strong>suffix</strong>.</li> |
| <li>A FAMILY sequence contains only characters from the |
| set {👦, 👧, 👨, 👩, 👴, 👵, 👶}. Nothing is skipped in moving |
| to <strong>suffix</strong>, except ZWJ.</li> |
| </ol> |
| </li> |
| <li>If <strong>sequence</strong> ends with ♂ or ♀, and does |
| not have a name, remove the ♂ or ♀ and move the name for "👨" |
| or "👩" respectively to the start of |
| <strong>prefixName</strong>.</li> |
| <li>Transform <strong>sequence</strong> and append to |
| <strong>prefixName</strong>, by successively getting names |
| for the longest subsequences, skipping any singleton ZWJ |
| characters. If there is more than one name, use the |
| listPattern for unit-short, type=2 to link them.</li> |
| <li>Transform <strong>suffix</strong> into |
| <strong>suffixName</strong> in the same manner.</li> |
| <li>If both the <strong>prefixName</strong> and |
| <strong>suffixName</strong> are non-empty, form the name by |
| joining them with the "category-list" characterLabelPattern |
| and return it. Otherwise return whichever of them is |
| non-empty.</li> |
| </ol> |
| <p>The synthesized keywords can follow a similar process.</p> |
| <ol> |
| <li>For an <strong>emoji flag sequence</strong> or |
| <strong>emoji tag sequence</strong> representing a |
| subdivision, use "flag".</li> |
| <li>For keycap sequences, use "keycap".</li> |
| <li>For other sequences, add the keywords for the |
| subsequences used to get the short names for |
| <strong>prefixName</strong>, and the short names used for |
| <strong>suffixName</strong>.</li> |
| </ol> |
| <p>Some examples for English data (v30) are given in the |
| following table.</p> |
| <table cellspacing="0" cellpadding="2" border="1"> |
| <caption> |
| Synthesized Emoji Sequence Names |
| </caption> |
| <tbody> |
| <tr> |
| <th>Sequence</th> |
| <th>Short Name</th> |
| <th>Keywords</th> |
| </tr> |
| <tr> |
| <td>🇪🇺</td> |
| <td>European Union</td> |
| <td>flag</td> |
| </tr> |
| <tr> |
| <td>#️⃣</td> |
| <td>keycap: #</td> |
| <td>keycap</td> |
| </tr> |
| <tr> |
| <td>9️⃣</td> |
| <td>keycap: 9</td> |
| <td>keycap</td> |
| </tr> |
| <tr> |
| <td>💏</td> |
| <td>kiss</td> |
| <td>couple</td> |
| </tr> |
| <tr> |
| <td>👩❤️💋👩</td> |
| <td>kiss: woman, woman</td> |
| <td>couple, woman</td> |
| </tr> |
| <tr> |
| <td>💑</td> |
| <td>couple with heart</td> |
| <td>love, couple</td> |
| </tr> |
| <tr> |
| <td>👩❤️👩</td> |
| <td>couple with heart: woman, woman</td> |
| <td>love, couple, woman</td> |
| </tr> |
| <tr> |
| <td>👪</td> |
| <td>family</td> |
| <td>family</td> |
| </tr> |
| <tr> |
| <td>👩👩👧</td> |
| <td>family: woman, woman, girl</td> |
| <td>woman, family, girl</td> |
| </tr> |
| <tr> |
| <td>👦🏻</td> |
| <td>boy: light skin tone</td> |
| <td>young, light skin tone, boy</td> |
| </tr> |
| <tr> |
| <td>👩🏿</td> |
| <td>woman: dark skin tone</td> |
| <td>woman, dark skin tone</td> |
| </tr> |
| <tr> |
| <td>👨⚖</td> |
| <td>man judge</td> |
| <td>scales, justice, man</td> |
| </tr> |
| <tr> |
| <td>👨🏿⚖</td> |
| <td>man judge: dark skin tone</td> |
| <td>scales, justice, dark skin tone, man</td> |
| </tr> |
| <tr> |
| <td>👩⚖</td> |
| <td>woman judge</td> |
| <td>woman, scales, judge</td> |
| </tr> |
| <tr> |
| <td>👩🏼⚖</td> |
| <td>woman judge: medium-light skin tone</td> |
| <td>woman, scales, medium-light skin tone, judge</td> |
| </tr> |
| <tr> |
| <td>👮</td> |
| <td>police officer</td> |
| <td>police, cop, officer</td> |
| </tr> |
| <tr> |
| <td>👮🏿</td> |
| <td>police officer: dark skin tone</td> |
| <td>police, cop, officer, dark skin tone</td> |
| </tr> |
| <tr> |
| <td>👮♂️</td> |
| <td>man police officer</td> |
| <td>police, cop, officer, man</td> |
| </tr> |
| <tr> |
| <td>👮🏼♂️</td> |
| <td>man police officer: medium-light skin tone</td> |
| <td>police, cop, officer, medium-light skin tone, |
| man</td> |
| </tr> |
| <tr> |
| <td>👮♀️</td> |
| <td>woman police officer</td> |
| <td>police, woman, cop, officer</td> |
| </tr> |
| <tr> |
| <td>👮🏿♀️</td> |
| <td>woman police officer: dark skin tone</td> |
| <td>police, woman, cop, officer, dark skin tone</td> |
| </tr> |
| <tr> |
| <td>🚴</td> |
| <td>person biking</td> |
| <td>cyclist, bicycle, biking</td> |
| </tr> |
| <tr> |
| <td>🚴🏿</td> |
| <td>person biking: dark skin tone</td> |
| <td>cyclist, bicycle, biking, dark skin tone</td> |
| </tr> |
| <tr> |
| <td>🚴♂️</td> |
| <td>man biking</td> |
| <td>cyclist, bicycle, biking, man</td> |
| </tr> |
| <tr> |
| <td>🚴🏿♂️</td> |
| <td>man biking: dark skin tone</td> |
| <td>cyclist, bicycle, biking, dark skin tone, man</td> |
| </tr> |
| <tr> |
| <td>🚴♀️</td> |
| <td>woman biking</td> |
| <td>cyclist, woman, bicycle, biking</td> |
| </tr> |
| <tr> |
| <td>🚴🏿♀️</td> |
| <td>woman biking: dark skin tone</td> |
| <td>cyclist, woman, bicycle, biking, dark skin tone</td> |
| </tr> |
| </tbody> |
| </table> |
| <p>For more information, see <a href= |
| 'https://unicode.org/reports/tr51'>Unicode Emoji</a>.</p> |
| <h3>14.2 <a name="Character_Labels" href="#Character_Labels" |
| id="Character_Labels">Annotations Character Labels</a></h3> |
| <p class="dtd"><!ELEMENT characterLabels ( alias | ( |
| characterLabelPattern*, characterLabel*, special* ) ) ></p> |
| <p class="dtd"><!ELEMENT characterLabelPattern ( #PCDATA ) |
| ></p> |
| <p class="dtd"><!ATTLIST characterLabelPattern type NMTOKEN |
| #REQUIRED ></p> |
| <p class="dtd"><!ATTLIST characterLabelPattern count (0 | 1 |
| | zero | one | two | few | many | other) #IMPLIED > <!-- |
| count only used for certain patterns" --></p> |
| <p class="dtd"><!ELEMENT characterLabel ( #PCDATA ) ></p> |
| <p class="dtd"><!ATTLIST characterLabel type NMTOKEN |
| #REQUIRED ></p> |
| <p>The character labels can be used for categories or groups of |
| characters in a character picker or keyboard palette. They have |
| the above structure. Items with special meanings are explained |
| below. Many of the categories are based on terms used in |
| Unicode. Consult the <a href= |
| 'https://www.unicode.org/glossary/'>Unicode Glossary</a> where |
| the meaning is not clear.</p> |
| <p>The following are special patterns used in composing |
| labels.</p> |
| <table> |
| <caption> |
| characterLabelPattern |
| </caption> |
| <tr> |
| <th>Type</th> |
| <th>English</th> |
| <th>Description of the group specified.</th> |
| </tr> |
| <tr> |
| <th>all</th> |
| <td>{0} — all</td> |
| <td>Used where the title {0} is just a subset. For example, |
| {0} might be "Latin", and contain the most common Latin |
| characters. Then "Latin — all" would be all of them.</td> |
| </tr> |
| <tr> |
| <th>category-list</th> |
| <td>{0}: {1}</td> |
| <td>Use for a name, where {0} is the main item like |
| "Family", and {1} is a list of one or more components or |
| subcategories. The list is formatted using a list |
| pattern.</td> |
| </tr> |
| <tr> |
| <th>compatibility</th> |
| <td>{0} — compatibility</td> |
| <td>For grouping Unicode compatibility characters |
| separately, such as "Arabic — compatibility".</td> |
| </tr> |
| <tr> |
| <th>enclosed</th> |
| <td>{0} — enclosed</td> |
| <td>For indicating enclosed forms, such as "digits — |
| enclosed"</td> |
| </tr> |
| <tr> |
| <th>extended</th> |
| <td>{0} — extended</td> |
| <td>For indicating a group of "extended" characters |
| (special use, technical, etc.)</td> |
| </tr> |
| <tr> |
| <th>historic</th> |
| <td>{0} — historic</td> |
| <td>For indicating a group of "historic" characters (no |
| longer in common use).</td> |
| </tr> |
| <tr> |
| <th>miscellaneous</th> |
| <td>{0} — miscellaneous</td> |
| <td>For indicating a group of "miscellaneous" characters |
| (typically that don't fall into a broader class).</td> |
| </tr> |
| <tr> |
| <th>other</th> |
| <td>{0} — other</td> |
| <td>Used where the title {0} is just a subset. For example, |
| {0} might be "Latin", and contain the most common Latin |
| characters. Then "Latin — other" would be the rest of |
| them.</td> |
| </tr> |
| <tr> |
| <th>scripts</th> |
| <td>scripts — {0}</td> |
| <td>For indicating a group of "scripts" characters matching |
| {0}. The value for {0} may be a geographic indicator, like |
| "Africa" (although there are specific combinations listed |
| below), or some other designation, like "other" (from |
| below).</td> |
| </tr> |
| <tr> |
| <th>strokes</th> |
| <td>{0} strokes</td> |
| <td>Used as an index title for CJK characters. It takes a |
| "count" value, which allows the right plural form to be |
| specified for the language.</td> |
| </tr> |
| <tr> |
| <th>subscript</th> |
| <td>subscript {0}</td> |
| <td>For indicating subscript forms, such as "subscript digits".</td> |
| </tr> |
| <tr> |
| <th>superscript</th> |
| <td>superscript {0}</td> |
| <td>For indicating superscript forms, such as "superscript digits".</td> |
| </tr> |
| </table> |
| <p>The following are character labels. Where the meaning of the |
| label is fairly clear (like "animal") or is in the Unicode |
| glossary, it is omitted.</p> |
| <table> |
| <caption> |
| characterLabel |
| </caption> |
| <tr> |
| <th>activities</th> |
| <td>activity</td> |
| <td>Human activities, such as running.</td> |
| </tr> |
| <tr> |
| <th>african_scripts</th> |
| <td>African script</td> |
| <td>Scripts associated with the continent of Africa.</td> |
| </tr> |
| <tr> |
| <th>american_scripts</th> |
| <td>American script</td> |
| <td>Scripts associated with the continents of North and |
| South America.</td> |
| </tr> |
| <tr> |
| <th>animals_nature</th> |
| <td>animal or nature</td> |
| <td>A broad category uses for</td> |
| </tr> |
| <tr> |
| <th>arrows</th> |
| <td>arrow</td> |
| <td>Arrow symbols</td> |
| </tr> |
| <tr> |
| <th>body</th> |
| <td>body</td> |
| <td>Symbols for body parts, such as an arm.</td> |
| </tr> |
| <tr> |
| <th>box_drawing</th> |
| <td>box drawing</td> |
| <td>Unicode box-drawing characters (geometric shapes)</td> |
| </tr> |
| <tr> |
| <th>bullets_stars</th> |
| <td>bullet or star</td> |
| <td>Unicode bullets (such as • or ‣ or ⁍) or stars |
| (★✩✪✵...)</td> |
| </tr> |
| <tr> |
| <th>consonantal_jamo</th> |
| <td>consonantal jamo</td> |
| <td>Korean Jamo consonants.</td> |
| </tr> |
| <tr> |
| <th>currency_symbols</th> |
| <td>currency symbol</td> |
| <td>Symbols such as $, ¥, £</td> |
| </tr> |
| <tr> |
| <th>dash_connector</th> |
| <td>dash or connector</td> |
| <td>Characters like _ or ⁓</td> |
| </tr> |
| <tr> |
| <th>dingbats</th> |
| <td>dingbat</td> |
| <td>Font dingbat characters, such as ❿ or ♜.</td> |
| </tr> |
| <tr> |
| <th>downwards_upwards_arrows</th> |
| <td>downwards upwards arrow</td> |
| <td>⇕,...</td> |
| </tr> |
| <tr> |
| <th>female</th> |
| <td>female</td> |
| <td>Indicates that a character is female or feminine in |
| appearance.</td> |
| </tr> |
| <tr> |
| <th>format</th> |
| <td>format</td> |
| <td>A Unicode format character.</td> |
| </tr> |
| <tr> |
| <th>format_whitespace</th> |
| <td>format & whitespace</td> |
| <td>A Unicode format character or whitespace.</td> |
| </tr> |
| <tr> |
| <th>full_width_form_variant</th> |
| <td>full-width variant</td> |
| <td>Full width variant, such as a wide A.</td> |
| </tr> |
| <tr> |
| <th>half_width_form_variant</th> |
| <td>half-width variant</td> |
| <td>Narrow width variant, such as a half-width katakana |
| character.</td> |
| </tr> |
| <tr> |
| <th>han_characters</th> |
| <td>Han character</td> |
| <td>Han (aka CJK: Chinese, Japanese, or Korean) |
| ideograph</td> |
| </tr> |
| <tr> |
| <th>han_radicals</th> |
| <td>Han radical</td> |
| <td>Radical (component) used in Han characters.</td> |
| </tr> |
| <tr> |
| <th>hanja</th> |
| <td>hanja</td> |
| <td>Korean name for Han character.</td> |
| </tr> |
| <tr> |
| <th>hanzi_simplified</th> |
| <td>Hanzi (simplified)</td> |
| <td>Simplified Chinese ideograph</td> |
| </tr> |
| <tr> |
| <th>hanzi_traditional</th> |
| <td>Hanzi (traditional)</td> |
| <td>Traditional Chinese ideograph</td> |
| </tr> |
| <tr> |
| <th>historic_scripts</th> |
| <td>historic script</td> |
| <td>Script no longer in common modern usage, such as Runes |
| or Hieroglyphs.</td> |
| </tr> |
| <tr> |
| <th>ideographic_desc_characters</th> |
| <td>ideographic desc. character</td> |
| <td>Special Unicode characters (see the glossary).</td> |
| </tr> |
| <tr> |
| <th>kanji</th> |
| <td>kanji</td> |
| <td>Japanese Han ideograph</td> |
| </tr> |
| <tr> |
| <th>keycap</th> |
| <td>keycap</td> |
| <td>A key on a computer keyboard or phone. For example, the |
| "3" key on a phone or laptop would be "keycap: 3"</td> |
| </tr> |
| <tr> |
| <th>limited_use</th> |
| <td>limited-use</td> |
| <td>Not in common modern use.</td> |
| </tr> |
| <tr> |
| <th>male</th> |
| <td>male</td> |
| <td>Indicates that a character is male or masculine in |
| appearance.</td> |
| </tr> |
| <tr> |
| <th>modifier</th> |
| <td>modifier</td> |
| <td>A Unicode modifier letter or symbol.</td> |
| </tr> |
| <tr> |
| <th>nonspacing</th> |
| <td>nonspacing</td> |
| <td>Uses for characters that occupy no width by themselves, |
| such as the ¨ over the a in ä.</td> |
| </tr> |
| </table> |
| <h3>14.3 <a name="Typographic_Names" href="#Typographic_Names" |
| id="Typographic_Names">Typographic Names</a></h3> |
| <p class='dtd'><!ELEMENT typographicNames ( alias | ( |
| axisName*, styleName*, featureName*, special* ) ) ></p> |
| <p class='dtd'><!ELEMENT axisName ( #PCDATA ) ><br> |
| <!ATTLIST axisName type (ital | opsz | slnt | wdth | wght) |
| #REQUIRED ><br> |
| <!ATTLIST axisName alt NMTOKENS #IMPLIED ></p> |
| <p class='dtd'><!ELEMENT styleName ( #PCDATA ) ><br> |
| <!ATTLIST styleName type (ital | opsz | slnt | wdth | wght) |
| #REQUIRED ><br> |
| <!ATTLIST styleName subtype NMTOKEN #REQUIRED ><br> |
| <!ATTLIST styleName alt NMTOKENS #IMPLIED ></p> |
| <p class='dtd'><!ELEMENT featureName ( #PCDATA ) ><br> |
| <!ATTLIST featureName type (afrc | cpsp | dlig | frac | lnum |
| | onum | ordn | pnum | smcp | tnum | zero) #REQUIRED ><br> |
| <!ATTLIST featureName alt NMTOKENS #IMPLIED ></p> |
| <p>The typographic names provide for names of font features for |
| use in a UI. This is useful for apps that show the name of font |
| styles and design axes according to the user’s languages. It |
| would also be useful for system-level libraries.</p> |
| <p>The identifers (types) use the tags from the OpenType |
| Feature Tag Registry. Given their large number, only the names |
| of frequently-used OpenType feature names are available CLDR. |
| (Many features are not user-visible settings, but instead serve |
| as a data channel for sofware to pass information to the font). |
| The example below shows an approach for using the CLDR data. Of |
| course, applications are free to implement their own algorithms |
| depending on their specific needs.</p> |
| <p>To find a localized subfamily name such as “Extraleicht |
| Schmal” for a font called “Extralight Condensed”, a system or |
| application library might do the following:</p> |
| <ol> |
| <li> |
| <p>Determine the set of languages in which the subfamily |
| name can potentially be returned.This is the union of the |
| languages for which the font contains ‘name’ table entries |
| with ID 2 or 17, plus the languages for which CLDR supplies |
| typographic names.</p> |
| </li> |
| <li> |
| <p>Use a language matching algorithm such as in ICU to find |
| the best available language given the user preferences. The |
| resulting subfamily name will be localized to this |
| language.</p> |
| </li> |
| <li> |
| <p>If the font’s ‘name’ table contains a typographic |
| subfamily name (ID17) in this language and all font |
| variation axes are set to their defaults, return this |
| name.</p> |
| </li> |
| <li> |
| <p>If the font’s ‘name’ table contains a font subfamilyname |
| (‘name’ID2) in this language and all font variation axes |
| are set to their defaults, return this name.</p> |
| </li> |
| <li> |
| <p>If the font has a style attributes (STAT) table, lookup |
| the design axis tags and their ordering. If the font has no |
| STAT table, assume [Width, Weight, Slant] as axis ordering, |
| and infer the font’s style atributes from other available |
| data in the font (eg. the OS/2 table).</p> |
| </li> |
| <li>For each design axis, find a localized style name for its |
| value. |
| <ol> |
| <li>If the font’s style attributes point to a ‘name’ |
| table entry that is available the result language, use |
| this name.</li> |
| <li>Otherwise, generate a fallback name from CLDR style |
| Name data. |
| <ol> |
| <li>The type key is the OpenType axis tag ( ‘wght’). |
| The subtype and alt keys are taken from the entry in |
| English CLDR where the string is equal to the English |
| name in the font. For example, when the font uses a |
| weight whose English style name is “Extralight”, this |
| will lead to subtype = “200” and alt = “variant”. If |
| there is no match, take the axis value (“200”) for |
| subtype and the empty string for alt.</li> |
| <li>Look up (type, subtype) in a data table derived |
| from CLDR’s style names. If CLDR supplies multiple |
| alternate names for this (type, subtype), use the one |
| whose “alt” key is matching; otherwise, use the |
| default alternate (which has no “alt” atribute in |
| CLDR).</li></ol></li> |
| </ol> |
| </li> |
| <li>Concatenate the strings, with a separator between |
| them.</li> |
| </ol> |
| <h2>15 <a name="Grammatical_Features" href="#Grammatical_Features" |
| id="Grammatical_Features">Grammatical Features</a></h2> |
| |
| |
| <p> |
| LDML supplies grammatical information that can be used to distinguish localized forms on a per-locale basis. The current data is part of an initial phase; the longer term plan is to add structure to permit localized forms based on these features, starting with measurement units such as the dative form in Serbian of “kilometer”. That will allow unit values to be inserted as placeholders into messages and adopt the right forms for grammatical agreement. |
| </p> |
| <p> |
| The current data includes the following: |
| </p><ul> |
| |
| <li>There are currently 3 grammatical features found in the <a href="https://github.com/unicode-org/cldr/blob/master/common/dtd/ldmlSupplemental.dtd#1229">DTD</a>: Gender, Case, Definiteness |
| <li>There are mappings from supported locales to grammatical features they exhibit in the file <a href="https://github.com/unicode-org/cldr/blob/master/common/supplemental/grammaticalFeatures.xml">grammaticalFeatures.xml</a>. Note that this is supplemental data, so the inheritance to the available locales needs to be done by the client.</li></ul> |
| |
| <p> |
| Note that the CLDR plural categories overlap some of these features, since some languages use case and other devices to change words based on the numeric values. |
| </p> |
| <h2>Features</h2> |
| |
| |
| <p class='dtd'> <!ELEMENT grammaticalData ( grammaticalFeatures*, grammaticalDerivations*) ><br> <!ELEMENT grammaticalFeatures ( grammaticalCase*, grammaticalGender*, grammaticalDefiniteness* ) ><br> |
| <!ATTLIST grammaticalFeatures targets NMTOKENS #REQUIRED ><br> |
| <!ATTLIST grammaticalFeatures locales NMTOKENS #REQUIRED > |
| </p> |
| <p> </p> |
| <p class='dtd'> |
| <!ELEMENT grammaticalCase EMPTY> |
| </p> |
| <p class='dtd'> |
| <!ATTLIST grammaticalCase values NMTOKENS #REQUIRED > |
| </p> |
| <p> </p> |
| <p class='dtd'> |
| <!ELEMENT grammaticalGender EMPTY> |
| </p> |
| <p class='dtd'> |
| <!ATTLIST grammaticalGender values NMTOKENS #REQUIRED > |
| </p> |
| <p> </p> |
| <p class='dtd'> |
| <!ELEMENT grammaticalDefiniteness EMPTY> |
| </p> |
| <p class='dtd'> |
| <!ATTLIST grammaticalDefiniteness values NMTOKENS #REQUIRED > |
| </p> |
| <h3>15.1<a name="Gender" href="#Gender" >Gender</a></h3> |
| <p> |
| Feature that classifies nouns in classes. This is grammatical gender, which may be assigned on the basis of sex in some languages, but may be completely separate in others. Also used to tag elements in CLDR that should agree with a particular gender of an associated noun. (adapted from: <a href="http://linguistics-ontology.org/gold/2010/GenderProperty">linguistics-ontology.org/gold/2010/GenderProperty</a>) |
| </p> |
| <h4>Example</h4> |
| |
| |
| |
| |
| |
| <pre class="prettyprint"><grammaticalFeatures targets="nominal" locales="es fr it pt"> |
| <grammaticalGender values="masculine feminine"/> |
| </pre> |
| |
| |
| <h4>Values</h4> |
| |
| |
| |
| <table> |
| <tr> |
| <td>animate |
| </td> |
| <td>In an animate/inanimate gender system, gender that denotes human or animate entities |
| </td> |
| <td>description adapted from: <a href="https://en.wikipedia.org/wiki/Grammatical_gender">wikipedia.org/wiki/Grammatical_gender</a> <a href="http://linguistics-ontology.org/gold/2010/AnimateGender">linguistics-ontology.org/gold/2010/AnimateGender</a> |
| </td> |
| </tr> |
| <tr> |
| <td>inanimate |
| </td> |
| <td>In an animate/inanimate gender system, gender that denotes object or inanimate entities |
| </td> |
| <td>adapted from: <a href="https://en.wikipedia.org/wiki/Grammatical_gender">wikipedia.org/wiki/Grammatical_gender</a> <a href="http://linguistics-ontology.org/gold/2010/InanimateGender">linguistics-ontology.org/gold/2010/InanimateGender</a> |
| </td> |
| </tr> |
| <tr> |
| <td>personal |
| </td> |
| <td>In an animate/inanimate gender system in some languages, gender that specifies the masculine gender of animate entities |
| </td> |
| <td>adapted from: <a href="https://en.wikipedia.org/wiki/Grammatical_gender">wikipedia.org/wiki/Grammatical_gender</a> <a href="http://linguistics-ontology.org/gold/2010/HumanGender">linguistics-ontology.org/gold/2010/HumanGender</a> |
| </td> |
| </tr> |
| <tr> |
| <td>common |
| </td> |
| <td>In a common–neuter gender system, gender that denotes human entities. |
| </td> |
| <td>adapted from: <a href="https://en.wikipedia.org/wiki/Grammatical_gender">wikipedia.org/wiki/Grammatical_gender</a> |
| </td> |
| </tr> |
| <tr> |
| <td>feminine |
| </td> |
| <td>In a masculine/feminine or in a masculine/feminine/neuter gender system, gender that denotes specifically female persons (or animals) or that is assigned arbitrarily to object. |
| </td> |
| <td>adapted from: wikipedia.org/wiki/Grammatical_gender <a href="http://linguistics-ontology.org/gold/2010/FeminineGender">linguistics-ontology.org/gold/2010/FeminineGender</a> |
| </td> |
| </tr> |
| <tr> |
| <td>masculine |
| </td> |
| <td>In a masculine/feminine or in a masculine/feminine/neuter gender system, gender that denotes specifically male persons (or animals) or that is assigned arbitrarily to object. |
| </td> |
| <td>adapted from: <a href="https://en.wikipedia.org/wiki/Grammatical_gender">wikipedia.org/wiki/Grammatical_gender</a> <a href="http://linguistics-ontology.org/gold/2010/MasculineGender">linguistics-ontology.org/gold/2010/MasculineGender</a> |
| </td> |
| </tr> |
| <tr> |
| <td>neuter |
| </td> |
| <td>In a masculine/feminine/neuter or common-neuter gender system, gender that generally denotes an object. |
| </td> |
| <td>adapted from: <a href="https://en.wikipedia.org/wiki/Grammatical_gender">wikipedia.org/wiki/Grammatical_gender</a> <a href="http://linguistics-ontology.org/gold/2010/NeuterGender">linguistics-ontology.org/gold/2010/NeuterGender</a> |
| </td> |
| </tr> |
| </table><br> |
| <h3>15.2<a name="Case" href="#Case">Case</a></h3> |
| |
| <h3>Case</h3> |
| |
| |
| <p> |
| Feature that encodes the syntactic (and sometimes semantic) relationship of a noun with the other constituents of the sentence. (adapted from <a href="http://linguistics-ontology.org/gold/2010/CaseProperty">linguistics-ontology.org/gold/2010/CaseProperty</a>) |
| </p> |
| <h4>Example</h4> |
| |
| |
| |
| |
| |
| <pre class="prettyprint"><grammaticalFeatures targets="nominal" locales="es fr it pt"> |
| <grammaticalGender values="masculine feminine"/> |
| </pre> |
| |
| |
| <h4>Values</h4> |
| |
| |
| |
| <table> |
| <tr> |
| <td><strong>Value</strong> |
| </td> |
| <td><strong>Definition</strong> |
| </td> |
| <td><strong>References</strong> |
| </td> |
| </tr> |
| <tr> |
| <td>ablative |
| </td> |
| <td>Ablative case expresses that the referent of the noun it marks is the location from which another referent is moving. It has the meaning 'from'. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#AblativeCase">purl.org/olia/olia.owl#AblativeCase</a> <a href="http://linguistics-ontology.org/gold/2010/AblativeCase">linguistics-ontology.org/gold/2010/AblativeCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>accusative |
| </td> |
| <td>Accusative case marks certain syntactic functions, usually direct objects. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#Accusative">purl.org/olia/olia.owl#Accusative</a> <a href="http://linguistics-ontology.org/gold/2010/AccusativeCase">linguistics-ontology.org/gold/2010/AccusativeCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>comitative |
| </td> |
| <td>Comitative Case expresses accompaniment. It carries the meaning 'with' or 'accompanied by'. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#ComitativeCase">purl.org/olia/olia.owl#ComitativeCase</a> <a href="http://linguistics-ontology.org/gold/2010/ComitativeCase">linguistics-ontology.org/gold/2010/ComitativeCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>dative |
| </td> |
| <td>Dative case marks indirect objects (for languages in which they are held to exist), or nouns having the role of a recipient (as of things given), a beneficiary of an action, or a possessor of an item. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#DativeCase">purl.org/olia/olia.owl#DativeCase</a> <a href="http://linguistics-ontology.org/gold/2010/DativeCase">linguistics-ontology.org/gold/2010/DativeCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>ergative |
| </td> |
| <td>In ergative-absolutive languages, the ergative case identifies the subject of a transitive verb. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#ErgativeCase">purl.org/olia/olia.owl#ErgativeCase</a> <a href="http://linguistics-ontology.org/gold/2010/ErgativeCase">linguistics-ontology.org/gold/2010/ErgativeCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>genitive |
| </td> |
| <td>Genitive case signals that the referent of the marked noun is the possessor of the referent of another noun, e.g. "the man's foot". In some languages, genitive case may express an associative relation between the marked noun and another noun. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#GenitiveCase">purl.org/olia/olia.owl#GenitiveCase</a> <a href="http://linguistics-ontology.org/gold/2010/GenitiveCase">linguistics-ontology.org/gold/2010/GenitiveCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>instrumental |
| </td> |
| <td>InstrumentalCase indicates that the referent of the noun it marks is the means of the accomplishment of the action expressed by the clause. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#InstrumentalCase">purl.org/olia/olia.owl#InstrumentalCase</a> <a href="http://linguistics-ontology.org/gold/2010/InstrumentalCase">linguistics-ontology.org/gold/2010/InstrumentalCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>locative |
| </td> |
| <td>Case that indicates a final location of action or a time of the action. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#LocativeCase">purl.org/olia/olia.owl#LocativeCase</a> <a href="http://linguistics-ontology.org/gold/2010/LocativeCase">linguistics-ontology.org/gold/2010/LocativeCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>locativecopulative |
| </td> |
| <td>Copulative Case marker that indicates a location. |
| </td> |
| <td>TBD Add reference, example |
| </td> |
| </tr> |
| <tr> |
| <td>nominative |
| </td> |
| <td>In nominative-accusative languages, nominative case marks clausal subjects and is applied to nouns in isolation |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#Nominative">purl.org/olia/olia.owl#Nominative</a> <a href="http://linguistics-ontology.org/gold/2010/NominativeCase">linguistics-ontology.org/gold/2010/NominativeCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>oblique |
| </td> |
| <td>Case that is used when a noun is the object of a verb or a proposition, except for nominative and vocative case. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#ObliqueCase">purl.org/olia/olia.owl#ObliqueCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>partitive |
| </td> |
| <td>The partitive case is a grammatical case which denotes "partialness", "without result", or "without specific identity". |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#PartitiveCase">purl.org/olia/olia.owl#PartitiveCase</a> <a href="http://linguistics-ontology.org/gold/2010/PartitiveCase">linguistics-ontology.org/gold/2010/PartitiveCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>prepositional |
| </td> |
| <td>Prepositional case refers to case marking that only occurs in combination with prepositions. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#PrepositionalCase">purl.org/olia/olia.owl#PrepositionalCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>sociative |
| </td> |
| <td>Case related to the person in whose company the action is carried out, or to any belongings of people which take part in the action. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#SociativeCase">purl.org/olia/olia.owl#SociativeCase</a> |
| </td> |
| </tr> |
| <tr> |
| <td>vocative |
| </td> |
| <td>Vocative case marks a noun whose referent is being addressed. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#VocativeCase">purl.org/olia/olia.owl#VocativeCase</a> <a href="http://linguistics-ontology.org/gold/2010/VocativeCase">linguistics-ontology.org/gold/2010/VocativeCase</a> |
| </td> |
| </tr> |
| </table> |
| |
| |
| <h3>Definiteness</h3> |
| |
| |
| <p> |
| Feature that encodes the fact that a noun has been already mentioned, or is familiar in the discourse. (adapted from <a href="https://glossary.sil.org/term/definiteness">https://glossary.sil.org/term/definiteness</a> ) |
| </p> |
| <h4>Values</h4> |
| |
| |
| |
| <table class='simple'> |
| <tr> |
| <td>definite |
| </td> |
| <td>Value referring to the capacity of identification of an entity. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#Definite">purl.org/olia/olia.owl#Definite</a> |
| </td> |
| </tr> |
| <tr> |
| <td>indefinite |
| </td> |
| <td>An entity is specified as indefinite when it refers to a non-particularized individual of the species denoted by the noun. |
| </td> |
| <td><a href="https://purl.org/olia/olia.owl#Indefinite">purl.org/olia/olia.owl#Indefinite</a> |
| </td> |
| </tr> |
| <tr> |
| <td>construct |
| </td> |
| <td>State of the first noun in a genitive phrase of a possessed noun followed by a possessor noun. |
| </td> |
| <td>no direct linked, but explained under: <a href="https://purl.org/olia/olia-top.owl#DefinitenessFeature">purl.org/olia/olia-top.owl#DefinitenessFeature</a> |
| </td> |
| </tr> |
| <tr> |
| <td>unspecified |
| </td> |
| <td>Noun without any definiteness marking in some specific construction (specific to Danish) |
| </td> |
| <td> </td> |
| </tr> |
| </table> |
| |
| <h2>16 <a name="Grammatical_Derivations" href="#Grammatical_Derivations">Grammatical Derivations</a></h2> |
| <pre class='dtd'><!ELEMENT grammaticalData ( grammaticalFeatures*, grammaticalDerivations*) > |
| <!ELEMENT grammaticalDerivations (deriveCompound*, deriveComponent*) > |
| <!ATTLIST grammaticalDerivations locales NMTOKENS #REQUIRED > |
| |
| <!ELEMENT deriveCompound EMPTY > |
| <!ATTLIST deriveCompound feature NMTOKENS #REQUIRED > |
| <!ATTLIST deriveCompound structure NMTOKENS #REQUIRED > |
| <!ATTLIST deriveCompound value NMTOKEN #REQUIRED > |
| |
| <!ATTLIST deriveComponent feature NMTOKENS #REQUIRED > |
| <!ATTLIST deriveComponent structure NMTOKENS #REQUIRED > |
| <!ATTLIST deriveComponent value0 NMTOKEN #REQUIRED > |
| <!ATTLIST deriveComponent value1 NMTOKEN #REQUIRED > |
| </pre> |
| <p>The grammatical derivation data contains information about the case, gender, and plural categories of compound units. This is supplemental data, so the inheritance by locale needs to be done by the client.</p> |
| <p><em>Note: In CLDR v38, the data for two locales is provided so that implemenations can ready their code for when more locale data is available. In subsequent releases structure may be further extended as more locales are added, to deal with additional locale requirements.</em></p> |
| <p>A compound unit can use 4 mechanisms, illustrated here in formatted strings:</p> |
| <ul> |
| <li><strong>Prefix</strong>: 1 <strong>kilo</strong>gram</li> |
| <li><strong>Power</strong>: 3 <strong>square</strong> kilometers</li> |
| <li><strong>Per</strong>: 3 kilograms <strong>per</strong> meter |
| <ul> |
| <li>An edge case is where there is no numerator, such as “1 per-second”</li> |
| </ul> |
| </li> |
| <li><strong>Times</strong>: 3 kilowatt<strong>-</strong>hours</li> |
| </ul> |
| <p>For the purposes of grammatical derivation (and name construction), a compound unit ID can be represented as a tree structure where the leaves are the atomic units, and the higher level node are one of the above. Here is an extreme example of that: <em>kilogram-square-kilometer-ampere-candela-per-square-second-mole</em></p> |
| <table class='simple' style=" margin-left: auto;margin-right: auto;"> |
| <tr> |
| <td colspan="6" style="text-align:center"><strong>per</strong></td> |
| </tr> |
| <tr> |
| <td colspan="4" style="text-align:center"><strong>times</strong></td> |
| <td colspan="2" style="text-align:center"><strong>times</strong></td> |
| </tr> |
| <tr> |
| <td style="text-align:center"><strong>kilo</strong></td> |
| <td style="text-align:center"><strong>square</strong></td> |
| <td style="text-align:center">ampere</td> |
| <td style="text-align:center">candela</td> |
| <td style="text-align:center"><strong>square</strong></td> |
| <td style="text-align:center">mole</td> |
| </tr> |
| <tr> |
| <td style="text-align:center">gram</td> |
| <td style="text-align:center"><strong>kilo</strong></td> |
| <td style="text-align:center">-</td> |
| <td style="text-align:center">-</td> |
| <td style="text-align:center">second</td> |
| <td style="text-align:center"> </td> |
| </tr> |
| <tr> |
| <td style="text-align:center">-</td> |
| <td style="text-align:center">meter</td> |
| <td style="text-align:center">-</td> |
| <td style="text-align:center">-</td> |
| <td colspan="2" style="text-align:center">-</td> |
| </tr> |
| </table> |
| <p>Note that the prefix and power nodes are unary (exactly 1 child), the per pattern is unary or binary (1 or 2 children), |
| and the times pattern is n-ary (where n > 1).</p> |
| <p> </p> |
| <p>Each section below is only applicable if the language has more than one value <em>for units</em>: |
| for example, for plural categories the language has to have more than just "other". |
| When that information is available for a language, it is found in |
| <strong>Section 15 <a href="#Grammatical_Features" id="Grammatical_Features2">Grammatical Features</a></strong>.</p> |
| <p dir="ltr">The gender derivation would be appropriate for an API call like <code>String genderValue = getGrammaticalGender(locale, "kilogram-meter-per-square-second")</code>. This can be used where the choice of word forms in the rest of a phrase can depend on the gender of the unit.</p> |
| <p dir="ltr">On the other hand, the derivation of plural category and case are used in building up the name of a compound unit, where the desired plural category is available from the number to be formatted with the unit, and the case value is known from the position in a message. For example, the case could be accusative if the formatted unit is to be the direct object in a sentence or phrase. This could be expressed in an API call such as <code>String inflectedName = getUnitName(locale, "kilogram-meter-per-square-second", pluralCategory, caseValue)</code>. </p> |
| <p dir="ltr">When deriving an inflected compound unit pattern, as the tree-stucture is processed by getting the appropriate localized patterns for the structural components and names for the atomic components. The computation of the plural category and the case of the subtrees can be computed from the <strong>deriveComponent</strong> data. The <strong>times</strong> data is treated as binary, and applied from left to right: with the example from above, the plural categories for the components of <em>kilogram-square-kilometer-ampere-candela</em> are computed by applying </p> |
| <p align="center"><strong>times</strong>(<em>kilogram, <strong>times</strong>(square-kilometer, <strong>times</strong>(ampere, candela)))</em></p> |
| <p dir="ltr">For a description of how to use these fields to construct a localized name, see <strong>Section 6.4 <a href="#compound-units">Compound Units</a></strong>.</p> |
| <p dir="ltr"> </p> |
| <h3 dir="ltr">16.1 <a name="gender_compound_units" href="#gender_compound_units">Deriving the Gender of Compound Units</a></h3> |
| <p dir="ltr">The <strong>deriveCompound[@feature="gender"]</strong> data provides information for how to derive the gender of the whole compound from the gender of its atomic units and structure. The attributeValues of value are: 0 (=gender of the first element), 1 (=gender of second element), or one of the valid gender values for the language: </p> |
| <p dir="ltr">Example:</p> |
| <pre><deriveCompound feature="gender" structure="per" value="0"/> <!-- gender(gram-per-meter) ← gender(gram) --> <br><deriveCompound feature="gender" structure="times" value="1"/> <!-- gender(newton-meter) ← gender(meter) --> <br><deriveCompound feature="gender" structure="power" value="0"/> <!-- gender(square-meter) ← gender(meter) --> <br><deriveCompound feature="gender" structure="prefix" value="0"/> <!-- gender(kilometer) ← gender(meter)--> </pre> |
| <p>For example, for gram-per-meter, the first line above means:</p> |
| <ul> |
| <li dir="ltr"> |
| <p>The gender of the compound is the gender of the first component of the 'per', that is, of the "gram". So if gram is feminine in that language, the gender of the compound is feminine. </p> |
| </li> |
| </ul> |
| <h3>16.2 <a name="plural_compound_units" href="#plural_compound_units">Deriving the Plural Category of Unit Components</a></h3> |
| <p>The <strong>deriveComponent[@feature="plural"]</strong> data provides information for how to derive the plural category for each of the atomic units, from the plural category of the whole compound and the structure of the compound. The attributeValues of value0 and value1 are: "compound" (=the pluralCategory of the compound), or one of the valid plural category values for the language.</p> |
| <p>Example:</p> |
| <pre> |
| <deriveComponent feature="plural" structure="per" value0="compound" value1="one"/> <!-- compound(gram-per-meter) ⇒ compound(gram) “per" singular(meter) --> |
| <deriveComponent feature="plural" structure="times" value0="one" value1="compound"/> <!-- compound(newton-meter) ⇒ singular(newton) “-" compound(meter) --> |
| <deriveComponent feature="plural" structure="power" value0="one" value1="compound"/> <!-- compound(square-meter) ⇒ singular(square) compound(meter) --> |
| <deriveComponent feature="plural" structure="prefix" value0="one" value1="compound"/> <!-- compound(kilometer) ⇒ singular(kilo) compound(meter) --></pre> |
| <p>For example, for gram-per-meter, the first line above means:</p> |
| |
| <ul> |
| <li dir="ltr"> |
| <p>When the plural form of gram-per-meter is needed (rather than singular), then the gram part of the translation has to have a plural form like “grams”, while the meter part of the translation has to have a singular form like “metre”. This would be composed with the pattern for "per" (say "{0} pro {1}") to get "grams pro metre".</p> |
| </li> |
| </ul> |
| <h3>16.3 <a name="case_compound_units" href="#case_compound_units">Deriving the Case of Unit Components</a></h3> |
| <p>The <strong>deriveComponent[@feature="plural"]</strong> data provides information for how to derive the plural category for each of the atomic units, from the plural category of the whole compound and the structure of the compound.The attributeValues of value0 and value1 are: compound (=the grammatical case of the compound), or one of the valid grammatical case values for the language.</p> |
| <p>Example:</p> |
| <pre><deriveComponent feature="case" structure="per" value0="compound" value1="nominative"/> <!-- compound(gram-per-meter) ⇒ compound(gram) “per" accusative(meter) --> |
| <deriveComponent feature="case" structure="times" value0="nominative" value1="compound"/> <!-- compound(newton-meter) ⇒ nominative(newton) “-" compound(meter) --> |
| <deriveComponent feature="case" structure="power" value0="nominative" value1="compound"/> <!-- compound(square-meter) ⇒ nominative(square) compound(meter) --> |
| <deriveComponent feature="case" structure="prefix" value0="nominative" value1="compound"/><!--compound(kilometer) ⇒ nominative(kilo) compound(meter) --></pre> |
| <p dir="ltr">For example, for gram-per-meter, the first line above means:</p> |
| <ul> |
| <li dir="ltr"> |
| <p>When the accusative form of gram-per-meter is needed, then the gram part of the translation has take the accusative case (eg, “gramu”, in a language that marks the accusative case with 'u'), while the meter part of the translation has a nominative form like “metre”. This would be composed with the pattern for "per" (say "{0} pro {1}") to get "gramu pro metre".</p> |
| </li> |
| </ul> |
| <p> </p> |
| |
| <hr> |
| <p class="copyright">Copyright © 2001–2020 Unicode, Inc. All |
| Rights Reserved. The Unicode Consortium makes no expressed or |
| implied warranty of any kind, and assumes no liability for |
| errors or omissions. No liability is assumed for incidental and |
| consequential damages in connection with or arising out of the |
| use of the information or programs contained or accompanying |
| this technical report. The Unicode <a href= |
| "https://unicode.org/copyright.html">Terms of Use</a> apply.</p> |
| <p class="copyright">Unicode and the Unicode logo are |
| trademarks of Unicode, Inc., and are registered in some |
| jurisdictions.</p> |
| </div> |
| </body> |
| </html> |