1*912701f9SAndroid Build Coastguard Worker## Unicode Technical Standard #35 2*912701f9SAndroid Build Coastguard Worker 3*912701f9SAndroid Build Coastguard Worker# Unicode Locale Data Markup Language (LDML)<br/>Part 6: Supplemental 4*912701f9SAndroid Build Coastguard Worker 5*912701f9SAndroid Build Coastguard Worker|Version|45 | 6*912701f9SAndroid Build Coastguard Worker|-------|-----------| 7*912701f9SAndroid Build Coastguard Worker|Editors|Steven Loomis (<a href="mailto:[email protected]">[email protected]</a>) and <a href="tr35.md#Acknowledgments">other CLDR committee members| 8*912701f9SAndroid Build Coastguard Worker 9*912701f9SAndroid Build Coastguard WorkerFor the full header, summary, and status, see [Part 1: Core](tr35.md). 10*912701f9SAndroid Build Coastguard Worker 11*912701f9SAndroid Build Coastguard Worker### _Summary_ 12*912701f9SAndroid Build Coastguard Worker 13*912701f9SAndroid Build Coastguard WorkerThis document describes parts of an XML format (_vocabulary_) for the exchange of structured locale data. This format is used in the [Unicode Common Locale Data Repository](https://www.unicode.org/cldr/). 14*912701f9SAndroid Build Coastguard Worker 15*912701f9SAndroid Build Coastguard WorkerThis is a partial document, describing only those parts of the LDML that are relevant for supplemental data. For the other parts of the LDML see the [main LDML document](tr35.md) and the links above. 16*912701f9SAndroid Build Coastguard Worker 17*912701f9SAndroid Build Coastguard Worker_Note:_ 18*912701f9SAndroid Build Coastguard WorkerSome links may lead to in-development or older 19*912701f9SAndroid Build Coastguard Workerversions of the data files. 20*912701f9SAndroid Build Coastguard WorkerSee <https://cldr.unicode.org> for up-to-date CLDR release data. 21*912701f9SAndroid Build Coastguard Worker 22*912701f9SAndroid Build Coastguard Worker### _Status_ 23*912701f9SAndroid Build Coastguard Worker 24*912701f9SAndroid Build Coastguard Worker<!-- _This is a draft document which may be updated, replaced, or superseded by other documents at any time. 25*912701f9SAndroid Build Coastguard WorkerPublication does not imply endorsement by the Unicode Consortium. 26*912701f9SAndroid Build Coastguard WorkerThis is not a stable document; it is inappropriate to cite this document as other than a work in progress._ --> 27*912701f9SAndroid Build Coastguard Worker 28*912701f9SAndroid Build Coastguard Worker_This document has been reviewed by Unicode members and other interested parties, and has been approved for publication by the Unicode Consortium. 29*912701f9SAndroid Build Coastguard WorkerThis is a stable document and may be used as reference material or cited as a normative reference by other specifications._ 30*912701f9SAndroid Build Coastguard Worker 31*912701f9SAndroid Build Coastguard Worker> _**A Unicode Technical Standard (UTS)** is an independent specification. Conformance to the Unicode Standard does not imply conformance to any UTS._ 32*912701f9SAndroid Build Coastguard Worker 33*912701f9SAndroid Build Coastguard Worker_Please submit corrigenda and other comments with the CLDR bug reporting form [[Bugs](tr35.md#Bugs)]. Related information that is useful in understanding this document is found in the [References](tr35.md#References). For the latest version of the Unicode Standard see [[Unicode](tr35.md#Unicode)]. For a list of current Unicode Technical Reports see [[Reports](tr35.md#Reports)]. For more information about versions of the Unicode Standard, see [[Versions](tr35.md#Versions)]._ 34*912701f9SAndroid Build Coastguard Worker 35*912701f9SAndroid Build Coastguard Worker## <a name="Parts" href="#Parts">Parts</a> 36*912701f9SAndroid Build Coastguard Worker 37*912701f9SAndroid Build Coastguard WorkerThe LDML specification is divided into the following parts: 38*912701f9SAndroid Build Coastguard Worker 39*912701f9SAndroid Build Coastguard Worker* Part 1: [Core](tr35.md#Contents) (languages, locales, basic structure) 40*912701f9SAndroid Build Coastguard Worker* Part 2: [General](tr35-general.md#Contents) (display names & transforms, etc.) 41*912701f9SAndroid Build Coastguard Worker* Part 3: [Numbers](tr35-numbers.md#Contents) (number & currency formatting) 42*912701f9SAndroid Build Coastguard Worker* Part 4: [Dates](tr35-dates.md#Contents) (date, time, time zone formatting) 43*912701f9SAndroid Build Coastguard Worker* Part 5: [Collation](tr35-collation.md#Contents) (sorting, searching, grouping) 44*912701f9SAndroid Build Coastguard Worker* Part 6: [Supplemental](tr35-info.md#Contents) (supplemental data) 45*912701f9SAndroid Build Coastguard Worker* Part 7: [Keyboards](tr35-keyboards.md#Contents) (keyboard mappings) 46*912701f9SAndroid Build Coastguard Worker* Part 8: [Person Names](tr35-personNames.md#Contents) (person names) 47*912701f9SAndroid Build Coastguard Worker* Part 9: [MessageFormat](tr35-messageFormat.md#Contents) (message format) 48*912701f9SAndroid Build Coastguard Worker 49*912701f9SAndroid Build Coastguard Worker## <a name="Contents" href="#Contents">Contents of Part 6, Supplemental</a> 50*912701f9SAndroid Build Coastguard Worker 51*912701f9SAndroid Build Coastguard Worker* Introduction [Supplemental Data](#Supplemental_Data) 52*912701f9SAndroid Build Coastguard Worker* [Territory Data](#Territory_Data) 53*912701f9SAndroid Build Coastguard Worker * [Supplemental Territory Containment](#Supplemental_Territory_Containment) 54*912701f9SAndroid Build Coastguard Worker * [Subdivision Containment](#Subdivision_Containment) 55*912701f9SAndroid Build Coastguard Worker * [Supplemental Territory Information](#Supplemental_Territory_Information) 56*912701f9SAndroid Build Coastguard Worker * [Territory-Based Preferences](#Territory_Based_Preferences) 57*912701f9SAndroid Build Coastguard Worker * [Preferred Units for Specific Usages](#Preferred_Units_For_Usage) 58*912701f9SAndroid Build Coastguard Worker * [`<rgScope>`: Scope of the “rg” Locale Key](#rgScope) 59*912701f9SAndroid Build Coastguard Worker* [Supplemental Language Data](#Supplemental_Language_Data) 60*912701f9SAndroid Build Coastguard Worker* [Supplemental Language Grouping](#Supplemental_Language_Grouping) 61*912701f9SAndroid Build Coastguard Worker* [Supplemental Code Mapping](#Supplemental_Code_Mapping) 62*912701f9SAndroid Build Coastguard Worker* ~~[Telephone Code Data](#Telephone_Code_Data)~~ (Deprecated) 63*912701f9SAndroid Build Coastguard Worker* ~~[Postal Code Validation (Deprecated)](#Postal_Code_Validation)~~ 64*912701f9SAndroid Build Coastguard Worker* [Supplemental Character Fallback Data](#Supplemental_Character_Fallback_Data) 65*912701f9SAndroid Build Coastguard Worker* [Coverage Levels](#Coverage_Levels) 66*912701f9SAndroid Build Coastguard Worker * [Definitions](#Coverage_Level_Definitions) 67*912701f9SAndroid Build Coastguard Worker * [Data Requirements](#Coverage_Level_Data_Requirements) 68*912701f9SAndroid Build Coastguard Worker * [Default Values](#Coverage_Level_Default_Values) 69*912701f9SAndroid Build Coastguard Worker* [Supplemental Metadata](#Appendix_Supplemental_Metadata) 70*912701f9SAndroid Build Coastguard Worker * [Supplemental Alias Information](#Supplemental_Alias_Information) 71*912701f9SAndroid Build Coastguard Worker * Table: [Alias Attribute Values](#Alias_Attribute_Values) 72*912701f9SAndroid Build Coastguard Worker * ~~[Supplemental Deprecated Information (Deprecated)](#Supplemental_Deprecated_Information)~~ 73*912701f9SAndroid Build Coastguard Worker * [Default Content](#Default_Content) 74*912701f9SAndroid Build Coastguard Worker* [Locale Metadata Elements](#Metadata_Elements) 75*912701f9SAndroid Build Coastguard Worker* [Version Information](#Version_Information) 76*912701f9SAndroid Build Coastguard Worker* [Parent Locales](#Parent_Locales) 77*912701f9SAndroid Build Coastguard Worker* [Unit Conversion](#Unit_Conversion) 78*912701f9SAndroid Build Coastguard Worker * [Unit Parsing Data](#unit-parsing-data) 79*912701f9SAndroid Build Coastguard Worker * [Unit Prefixes](#unit-prefixes) 80*912701f9SAndroid Build Coastguard Worker * [Constants](#constants) 81*912701f9SAndroid Build Coastguard Worker * [Conversion Data](#conversion-data) 82*912701f9SAndroid Build Coastguard Worker * [Derived Unit System](#derived-unit-system) 83*912701f9SAndroid Build Coastguard Worker * [Conversion Mechanisms](#conversion-mechanisms) 84*912701f9SAndroid Build Coastguard Worker * [Exceptional Cases](#exceptional-cases) 85*912701f9SAndroid Build Coastguard Worker * [Identities](#identities) 86*912701f9SAndroid Build Coastguard Worker * [Aliases](#aliases) 87*912701f9SAndroid Build Coastguard Worker * [“Duplicate” Units](#duplicate-units) 88*912701f9SAndroid Build Coastguard Worker * [Discarding Offsets](#discarding-offsets) 89*912701f9SAndroid Build Coastguard Worker * [Unresolved Units](#unresolved-units) 90*912701f9SAndroid Build Coastguard Worker* [Quantities and Base Units](#quantities-and-base-units) 91*912701f9SAndroid Build Coastguard Worker * [UnitType vs Quantity](#unittype-vs-quantity) 92*912701f9SAndroid Build Coastguard Worker * [Unit Identifier Normalization](#Unit_Identifier_Normalization) 93*912701f9SAndroid Build Coastguard Worker* [Mixed Units](#mixed-units) 94*912701f9SAndroid Build Coastguard Worker* [Testing](#testing) 95*912701f9SAndroid Build Coastguard Worker* [Unit Preferences](#Unit_Preferences) 96*912701f9SAndroid Build Coastguard Worker * [Unit Preferences Overrides](#Unit_Preferences_Overrides) 97*912701f9SAndroid Build Coastguard Worker * [Compute override units](#compute-override-units) 98*912701f9SAndroid Build Coastguard Worker * [Compute regions](#compute--regions) 99*912701f9SAndroid Build Coastguard Worker * [Compute the category](#compute-the-category) 100*912701f9SAndroid Build Coastguard Worker * [Unit Preferences Data](#Unit_Preferences_Data) 101*912701f9SAndroid Build Coastguard Worker * [Examples:](#examples) 102*912701f9SAndroid Build Coastguard Worker * [Compute the preferred output unit](#compute-the-preferred-output-unit) 103*912701f9SAndroid Build Coastguard Worker * [Search the ranked units](#search-the-ranked-units) 104*912701f9SAndroid Build Coastguard Worker * [Constraints](#constraints) 105*912701f9SAndroid Build Coastguard Worker * [Examples](#examples) 106*912701f9SAndroid Build Coastguard Worker* [Unit APIs](#unit-apis) 107*912701f9SAndroid Build Coastguard Worker 108*912701f9SAndroid Build Coastguard Worker## Introduction <a name="Supplemental_Data" href="#Supplemental_Data">Supplemental Data</a> 109*912701f9SAndroid Build Coastguard Worker 110*912701f9SAndroid Build Coastguard WorkerThe following represents the format for additional supplemental information. This is information that is important for internationalization and proper use of CLDR, but is not contained in the locale hierarchy. It is not localizable, nor is it overridden by locale data. The current CLDR data can be viewed in the [Supplemental Charts](https://unicode-org.github.io/cldr-staging/charts/38/supplemental/index.html). 111*912701f9SAndroid Build Coastguard Worker 112*912701f9SAndroid Build Coastguard Worker```xml 113*912701f9SAndroid Build Coastguard Worker<!ELEMENT supplementalData (version, generation?, cldrVersion?, currencyData?, territoryContainment?, subdivisionContainment?, languageData?, territoryInfo?, postalCodeData?, calendarData?, calendarPreferenceData?, weekData?, timeData?, measurementData?, unitPreferenceData?, timezoneData?, characters?, transforms?, metadata?, codeMappings?, parentLocales?, likelySubtags?, metazoneInfo?, plurals?, telephoneCodeData?, numberingSystems?, bcp47KeywordMappings?, gender?, references?, languageMatching?, dayPeriodRuleSet*, metaZones?, primaryZones?, windowsZones?, coverageLevels?, idValidity?, rgScope?) > 114*912701f9SAndroid Build Coastguard Worker``` 115*912701f9SAndroid Build Coastguard Worker 116*912701f9SAndroid Build Coastguard WorkerThe data in CLDR is presently split into multiple files: supplementalData.xml, supplementalMetadata.xml, characters.xml, likelySubtags.xml, ordinals.xml, plurals.xml, telephoneCodeData.xml, genderList.xml, plus transforms (see _Part 2 [Transforms](tr35-general.md#Transforms)_ and _Part 2 [Transform Rule Syntax](tr35-general.md#Transform_Rules_Syntax)_). The split is just for convenience: logically, they are treated as though they were a single file. Future versions of CLDR may split the data in a different fashion. Do not depend on any specific XML filename or path for supplemental data. 117*912701f9SAndroid Build Coastguard Worker 118*912701f9SAndroid Build Coastguard WorkerNote that [Chapter 10](#Metadata_Elements) presents information about metadata that is maintained on a per-locale basis. It is included in this section because it is not intended to be used as part of the locale itself. 119*912701f9SAndroid Build Coastguard Worker 120*912701f9SAndroid Build Coastguard Worker## <a name="Territory_Data" href="#Territory_Data">Territory Data</a> 121*912701f9SAndroid Build Coastguard Worker 122*912701f9SAndroid Build Coastguard Worker### <a name="Supplemental_Territory_Containment" href="#Supplemental_Territory_Containment">Supplemental Territory Containment</a> 123*912701f9SAndroid Build Coastguard Worker 124*912701f9SAndroid Build Coastguard Worker```xml 125*912701f9SAndroid Build Coastguard Worker<!ELEMENT territoryContainment ( group* ) > 126*912701f9SAndroid Build Coastguard Worker<!ELEMENT group EMPTY > 127*912701f9SAndroid Build Coastguard Worker<!ATTLIST group type NMTOKEN #REQUIRED > 128*912701f9SAndroid Build Coastguard Worker<!ATTLIST group contains NMTOKENS #IMPLIED > 129*912701f9SAndroid Build Coastguard Worker<!ATTLIST group grouping ( true | false ) #IMPLIED > 130*912701f9SAndroid Build Coastguard Worker<!ATTLIST group status ( deprecated, grouping ) #IMPLIED > 131*912701f9SAndroid Build Coastguard Worker``` 132*912701f9SAndroid Build Coastguard Worker 133*912701f9SAndroid Build Coastguard WorkerThe following data provides information that shows groupings of countries (regions). The data is based on the [[UNM49](tr35.md#UNM49)]. There is one special code, `QO` , which is used for outlying areas of Oceania that are typically uninhabited. The territory containment forms a tree with the following levels: 134*912701f9SAndroid Build Coastguard Worker 135*912701f9SAndroid Build Coastguard Worker+ World 136*912701f9SAndroid Build Coastguard Worker + Continent 137*912701f9SAndroid Build Coastguard Worker + Subcontinent 138*912701f9SAndroid Build Coastguard Worker + Country 139*912701f9SAndroid Build Coastguard Worker 140*912701f9SAndroid Build Coastguard WorkerExcluding groupings, in this tree: 141*912701f9SAndroid Build Coastguard Worker 142*912701f9SAndroid Build Coastguard Worker* All non-overlapping regions form a strict tree rooted at World. 143*912701f9SAndroid Build Coastguard Worker* All leaf-nodes (country) are always at depth 4. Some of these “country” regions are actually parts of other countries, such as Hong Kong (part of China). Such relationships are not part of the containment data. 144*912701f9SAndroid Build Coastguard Worker 145*912701f9SAndroid Build Coastguard WorkerFor a chart showing the relationships (plus the included timezones), see the [Territory Containment Chart](https://unicode-org.github.io/cldr-staging/charts/38/supplemental/territory_containment_un_m_49.html). The XML structure has the following form. 146*912701f9SAndroid Build Coastguard Worker 147*912701f9SAndroid Build Coastguard Worker```xml 148*912701f9SAndroid Build Coastguard Worker<territoryContainment> 149*912701f9SAndroid Build Coastguard Worker 150*912701f9SAndroid Build Coastguard Worker <group type="001" contains="002 009 019 142 150"/> <!--World --> 151*912701f9SAndroid Build Coastguard Worker <group type="011" contains="BF BJ CI CV GH GM GN GW LR ML MR NE NG SH SL SN TG"/> <!--Western Africa --> 152*912701f9SAndroid Build Coastguard Worker <group type="013" contains="BZ CR GT HN MX NI PA SV"/> <!--Central America --> 153*912701f9SAndroid Build Coastguard Worker <group type="014" contains="BI DJ ER ET KE KM MG MU MW MZ RE RW SC SO TZ UG YT ZM ZW"/> <!--Eastern Africa --> 154*912701f9SAndroid Build Coastguard Worker <group type="142" contains="030 035 062 145"/> <!--Asia --> 155*912701f9SAndroid Build Coastguard Worker <group type="145" contains="AE AM AZ BH CY GE IL IQ JO KW LB OM PS QA SA SY TR YE"/> <!--Western Asia --> 156*912701f9SAndroid Build Coastguard Worker <group type="015" contains="DZ EG EH LY MA SD TN"/> <!--Northern Africa --> 157*912701f9SAndroid Build Coastguard Worker... 158*912701f9SAndroid Build Coastguard Worker``` 159*912701f9SAndroid Build Coastguard Worker 160*912701f9SAndroid Build Coastguard WorkerThere are groupings that don't follow this regular structure, such as: 161*912701f9SAndroid Build Coastguard Worker 162*912701f9SAndroid Build Coastguard Worker```xml 163*912701f9SAndroid Build Coastguard Worker<group type="003" contains="013 021 029" grouping="true"/> <!--North America --> 164*912701f9SAndroid Build Coastguard Worker``` 165*912701f9SAndroid Build Coastguard Worker 166*912701f9SAndroid Build Coastguard WorkerThese are marked with the attribute `grouping="true"`. 167*912701f9SAndroid Build Coastguard Worker 168*912701f9SAndroid Build Coastguard WorkerWhen groupings have been deprecated but kept around for backwards compatibility, they are marked with the attribute `status="deprecated"`, like this: 169*912701f9SAndroid Build Coastguard Worker 170*912701f9SAndroid Build Coastguard Worker```xml 171*912701f9SAndroid Build Coastguard Worker<group type="029" contains="AN" status="deprecated"/> <!--Caribbean --> 172*912701f9SAndroid Build Coastguard Worker``` 173*912701f9SAndroid Build Coastguard Worker 174*912701f9SAndroid Build Coastguard WorkerWhen the containment relationship itself is a grouping, it is marked with the attribute `status="grouping"`, like this: 175*912701f9SAndroid Build Coastguard Worker 176*912701f9SAndroid Build Coastguard Worker```xml 177*912701f9SAndroid Build Coastguard Worker<group type="150" contains="EU" status="grouping"/> <!--Europe --> 178*912701f9SAndroid Build Coastguard Worker``` 179*912701f9SAndroid Build Coastguard Worker 180*912701f9SAndroid Build Coastguard WorkerThat is, the type value isn’t a grouping, but if you filter out groupings you can drop this containment. In the example above, EU is a grouping, and contained in 150. 181*912701f9SAndroid Build Coastguard Worker 182*912701f9SAndroid Build Coastguard Worker### <a name="Subdivision_Containment" href="#Subdivision_Containment">Subdivision Containment</a> 183*912701f9SAndroid Build Coastguard Worker 184*912701f9SAndroid Build Coastguard Worker```xml 185*912701f9SAndroid Build Coastguard Worker<!ELEMENT subdivisionContainment ( subgroup* ) > 186*912701f9SAndroid Build Coastguard Worker 187*912701f9SAndroid Build Coastguard Worker<!ELEMENT subgroup EMPTY > 188*912701f9SAndroid Build Coastguard Worker<!ATTLIST subgroup type NMTOKEN #REQUIRED > 189*912701f9SAndroid Build Coastguard Worker<!ATTLIST subgroup contains NMTOKENS #IMPLIED > 190*912701f9SAndroid Build Coastguard Worker``` 191*912701f9SAndroid Build Coastguard Worker 192*912701f9SAndroid Build Coastguard WorkerThe subdivision containment data is similar to the territory containment. It is based on ISO 3166-2 data, but may diverge from it in the future. 193*912701f9SAndroid Build Coastguard Worker 194*912701f9SAndroid Build Coastguard Worker```xml 195*912701f9SAndroid Build Coastguard Worker<subgroup type="BD" contains="bda bdb bdc bdd bde bdf bdg bdh" /> 196*912701f9SAndroid Build Coastguard Worker<subgroup type="bda" contains="bd02 bd06 bd07 bd25 bd50 bd51" /> 197*912701f9SAndroid Build Coastguard Worker``` 198*912701f9SAndroid Build Coastguard Worker 199*912701f9SAndroid Build Coastguard WorkerThe `type` is a [`unicode_region_subtag`](tr35.md#unicode_region_subtag) (territory) identifier for the top level of containment, or a [`unicode_subdivision_id`](tr35.md#unicode_subdivision_id) for lower levels of containment when there are multiple levels. The `contains` value is a space-delimited list of one or more [`unicode_subdivision_id`](tr35.md#unicode_subdivision_id) values. In the example above, subdivision bda contains other subdivisions bd02, bd06, bd07, bd25, bd50, bd51. 200*912701f9SAndroid Build Coastguard Worker 201*912701f9SAndroid Build Coastguard WorkerNote: Formerly (in CLDR 28 through 30): 202*912701f9SAndroid Build Coastguard Worker 203*912701f9SAndroid Build Coastguard Worker* The `type` attribute could only contain a `unicode_region_subtag`; 204*912701f9SAndroid Build Coastguard Worker* The `contains` attribute contained `unicode_subdivision_suffix` values; these are not unique across multiple territories, so... 205*912701f9SAndroid Build Coastguard Worker* For lower containment levels, a now-deprecated subtype `attribute` was used to specify the parent `unicode_subdivision_suffix`. 206*912701f9SAndroid Build Coastguard Worker 207*912701f9SAndroid Build Coastguard Worker\* The type attribute contained only a `unicode_region_subtag` `unicode_subdivision_suffix` values were used in the `contains` attribute; these are not unique across multiple territories, so for lower levels a now-deprecated 208*912701f9SAndroid Build Coastguard Worker 209*912701f9SAndroid Build Coastguard Worker### <a name="Supplemental_Territory_Information" href="#Supplemental_Territory_Information">Supplemental Territory Information</a> 210*912701f9SAndroid Build Coastguard Worker 211*912701f9SAndroid Build Coastguard Worker```xml 212*912701f9SAndroid Build Coastguard Worker<!ELEMENT territory ( languagePopulation* ) > 213*912701f9SAndroid Build Coastguard Worker<!ATTLIST territory type NMTOKEN #REQUIRED > 214*912701f9SAndroid Build Coastguard Worker<!ATTLIST territory gdp NMTOKEN #REQUIRED > 215*912701f9SAndroid Build Coastguard Worker<!ATTLIST territory literacyPercent NMTOKEN #REQUIRED > 216*912701f9SAndroid Build Coastguard Worker<!ATTLIST territory population NMTOKEN #REQUIRED > 217*912701f9SAndroid Build Coastguard Worker 218*912701f9SAndroid Build Coastguard Worker<!ELEMENT languagePopulation EMPTY > 219*912701f9SAndroid Build Coastguard Worker<!ATTLIST languagePopulation type NMTOKEN #REQUIRED > 220*912701f9SAndroid Build Coastguard Worker<!ATTLIST languagePopulation literacyPercent NMTOKEN #IMPLIED > 221*912701f9SAndroid Build Coastguard Worker<!ATTLIST languagePopulation writingPercent NMTOKEN #IMPLIED > 222*912701f9SAndroid Build Coastguard Worker<!ATTLIST languagePopulation populationPercent NMTOKEN #REQUIRED > 223*912701f9SAndroid Build Coastguard Worker<!ATTLIST languagePopulation officialStatus (de_facto_official | official | official_regional | official_minority) #IMPLIED > 224*912701f9SAndroid Build Coastguard Worker``` 225*912701f9SAndroid Build Coastguard Worker 226*912701f9SAndroid Build Coastguard WorkerThis data provides testing information for language and territory populations. The main goal is to provide approximate figures for the literate, functional population for each language in each territory: that is, the population that is able to read and write each language, and is comfortable enough to use it with computers. For a chart of this data, see [Territory-Language Information](https://unicode-org.github.io/cldr-staging/charts/38/supplemental/territory_language_information.html). 227*912701f9SAndroid Build Coastguard Worker 228*912701f9SAndroid Build Coastguard Worker_Example_ 229*912701f9SAndroid Build Coastguard Worker 230*912701f9SAndroid Build Coastguard Worker```xml 231*912701f9SAndroid Build Coastguard Worker<territory type="AO" gdp="175500000000" literacyPercent="70.4" population="19088100"> <!--Angola--> 232*912701f9SAndroid Build Coastguard Worker <languagePopulation type="pt" populationPercent="67" officialStatus="official"/> <!--Portuguese--> 233*912701f9SAndroid Build Coastguard Worker <languagePopulation type="umb" populationPercent="29"/> <!--Umbundu--> 234*912701f9SAndroid Build Coastguard Worker <languagePopulation type="kmb" writingPercent="10" populationPercent="25" references="R1034"/> <!--Kimbundu--> 235*912701f9SAndroid Build Coastguard Worker <languagePopulation type="ln" populationPercent="0.67" references="R1010"/> <!--Lingala--> 236*912701f9SAndroid Build Coastguard Worker</territory> 237*912701f9SAndroid Build Coastguard Worker``` 238*912701f9SAndroid Build Coastguard Worker 239*912701f9SAndroid Build Coastguard WorkerNote that reliable information is difficult to obtain; the information in CLDR is an estimate culled from different sources, including the World Bank, CIA Factbook, and others. The GDP and country literacy figures are taken from the World Bank where available, otherwise supplemented by FactBook data and other sources. The GDP figures are “PPP (constant 2000 international $)”. Much of the per-language data is taken from the Ethnologue, but is supplemented and processed using many other sources, including per-country census data. (The focus of the Ethnologue is native speakers, which includes people who are not literate, and excludes people who are functional second-language users.) Some references are marked in the XML files, with attributes such as `references="R1010"` . 240*912701f9SAndroid Build Coastguard Worker 241*912701f9SAndroid Build Coastguard WorkerThe percentages may add up to more than 100% due to multilingual populations, or may be less than 100% due to illiteracy or because the data has not yet been gathered or processed. Languages with smaller populations might not be included. 242*912701f9SAndroid Build Coastguard Worker 243*912701f9SAndroid Build Coastguard WorkerThe following describes the meaning of some of these terms—as used in CLDR—in more detail. 244*912701f9SAndroid Build Coastguard Worker 245*912701f9SAndroid Build Coastguard Worker<a name="literacy_percent" href="#literacy_percent">literacy percent for the territory</a> — an estimate of the percentage of the country’s population that is functionally literate. 246*912701f9SAndroid Build Coastguard Worker 247*912701f9SAndroid Build Coastguard Worker<a name="language_population_percent" href="#language_population_percent">language population percent</a> — an estimate of the number of people who are functional in that language in that country, including both first and second language speakers. The level of fluency is that necessary to use a UI on a computer, smartphone, or similar devices, rather than complete fluency. 248*912701f9SAndroid Build Coastguard Worker 249*912701f9SAndroid Build Coastguard Worker<a name="literacy_percent_for_langPop" href="#literacy_percent_for_langPop">literacy percent for language population</a> — Within the set of people who are functional in the corresponding language (as specified by [language population percent](#language_population_percent)), this is an estimate of the percentage of those people who are functionally literate in that language, that is, who are _capable_ of reading or writing in that language, even if they do not regularly use it for reading or writing. If not specified, this defaults to the [literacy percent for the territory](#literacy_percent). 250*912701f9SAndroid Build Coastguard Worker 251*912701f9SAndroid Build Coastguard Worker<a name="writing_percent" href="#writing_percent">writing percent</a> — Within the set of people who are functional in the corresponding language (as specified by [language population percent](#language_population_percent)), this is an estimate of the percentage of those people who regularly read or write a significant amount in that language. Ideally, the regularity would be measured as “7-day actives”. If it is known that the language is not widely or commonly written, but there are no solid figures, the value is typically given 1%-5%. 252*912701f9SAndroid Build Coastguard Worker 253*912701f9SAndroid Build Coastguard WorkerFor a language such as Swiss German, which is typically not written, even though nearly the whole native Germanophone population _could_ write in Swiss German, the [literacy percent for language population](#literacy_percent_for_langPop) is high, but the [writing percent](#writing_percent) is low. 254*912701f9SAndroid Build Coastguard Worker 255*912701f9SAndroid Build Coastguard Worker<a name="official_language" href="#official_language">official language</a> — as used in CLDR, a language that can generally be used in all communications with a central government. That is, people can expect that essentially all communication from the government is available in that language (ballots, information pamphlets, legal documents, …) and that they can use that language in any communication to the central government (petitions, forms, filing lawsuits, …). 256*912701f9SAndroid Build Coastguard Worker 257*912701f9SAndroid Build Coastguard WorkerOfficial languages for a country in this sense are not necessarily the same as those with official legal status in the country. For example, Irish is declared to be an official language in Ireland, but English has no such formal status in the United States. Languages such as the latter are called _de facto_ official languages. As another example, German has legal status in Italy, but cannot be used in all communications with the central government, and is thus not an official language _of Italy_ for CLDR purposes. It is, however, an _official regional language_. Other languages are declared to be official, but can’t actually be used for all communication with any major governmental entity in the country. There is no intention to mark such nominally official languages as “official” in the CLDR data. 258*912701f9SAndroid Build Coastguard Worker 259*912701f9SAndroid Build Coastguard Worker<a name="official_regional_language" href="#official_regional_language">official regional language</a> — a language that is official (_de jure_ or _de facto_) in a major region within a country, but does not qualify as an official language of the country as a whole. For example, it can be used in an official petition to a provincial government, but not the central government. The term “major” is meant to distinguish from smaller-scale usage, such as for a town or village. 260*912701f9SAndroid Build Coastguard Worker 261*912701f9SAndroid Build Coastguard Worker### <a name="Territory_Based_Preferences" href="#Territory_Based_Preferences">Territory-Based Preferences</a> 262*912701f9SAndroid Build Coastguard Worker 263*912701f9SAndroid Build Coastguard WorkerThe default preference for several locale items is based solely on a [unicode_region_subtag](tr35.md#unicode_region_subtag), which may either be specified as part of a [unicode_language_id](tr35.md#unicode_language_id), inferred from other locale ID elements using the [Likely Subtags](tr35.md#Likely_Subtags) mechanism, or provided explicitly using an “rg” [Region Override](tr35.md#RegionOverride) locale key. For more information on this process see [Locale Inheritance and Matching](tr35.md#Locale_Inheritance). The specific items that are handled in this way are: 264*912701f9SAndroid Build Coastguard Worker 265*912701f9SAndroid Build Coastguard Worker* Default calendar (see [Calendar Preference Data](tr35-dates.md#Calendar_Preference_Data)) 266*912701f9SAndroid Build Coastguard Worker* Default week conventions (first day of week and weekend days; see [Week Data](tr35-dates.md#Week_Data)) 267*912701f9SAndroid Build Coastguard Worker* Default hour cycle (see [Time Data](tr35-dates.md#Time_Data)) 268*912701f9SAndroid Build Coastguard Worker* Default currency (see [Supplemental Currency Data](tr35-numbers.md#Supplemental_Currency_Data)) 269*912701f9SAndroid Build Coastguard Worker* Default measurement system and paper size (see [Measurement System Data](tr35-general.md#Measurement_System_Data)) 270*912701f9SAndroid Build Coastguard Worker* Default units for specific usage (see [Preferred Units for Specific Usages](#Preferred_Units_For_Usage), below) 271*912701f9SAndroid Build Coastguard Worker 272*912701f9SAndroid Build Coastguard WorkerThe mu, ms, and rg keys also interact with the base locale and the unit preferences. For more information, see _[Unit Preferences](#Unit_Preferences)._ 273*912701f9SAndroid Build Coastguard Worker 274*912701f9SAndroid Build Coastguard Worker#### <a name="Preferred_Units_For_Usage" href="#Preferred_Units_For_Usage">Preferred Units for Specific Usages</a> 275*912701f9SAndroid Build Coastguard Worker 276*912701f9SAndroid Build Coastguard WorkerThe determination of preferred units depends on the locale identifer: the keys mu, ms, rg, the base locale (language, script, region) and the user preferences. 277*912701f9SAndroid Build Coastguard Worker_For information about preferred units and unit conversion, see [Unit Conversion](#Unit_Conversion) and [Unit Preferences](#Unit_Preferences)._ 278*912701f9SAndroid Build Coastguard Worker 279*912701f9SAndroid Build Coastguard Worker### <a name="rgScope" href="#rgScope">`<rgScope>`: Scope of the “rg” Locale Key</a> 280*912701f9SAndroid Build Coastguard Worker 281*912701f9SAndroid Build Coastguard WorkerThe supplemental `<rgScope>` element specifies the data paths for which the region used for data lookup is determined by the value of any “rg” key present in the locale identifier (see [Region Override](tr35.md#RegionOverride) and [Region Priority Inheritance](tr35.md#Region_Priority_Inheritance)). If no “rg” key is present, the region used for lookup is determined as usual: from the unicode_region_subtag if present, else inferred from the unicode_language_subtag. The DTD structure is as follows: 282*912701f9SAndroid Build Coastguard Worker 283*912701f9SAndroid Build Coastguard Worker```xml 284*912701f9SAndroid Build Coastguard Worker<!ELEMENT rgScope ( rgPath* ) > 285*912701f9SAndroid Build Coastguard Worker 286*912701f9SAndroid Build Coastguard Worker<!ELEMENT rgPath EMPTY > 287*912701f9SAndroid Build Coastguard Worker<!ATTLIST rgPath path CDATA #REQUIRED > 288*912701f9SAndroid Build Coastguard Worker``` 289*912701f9SAndroid Build Coastguard Worker 290*912701f9SAndroid Build Coastguard WorkerThe `<rgScope>` element contains a list of `<rgPath>` elements, each of which specifies a datapath for which any “rg” key determines the region for lookup. For example: 291*912701f9SAndroid Build Coastguard Worker 292*912701f9SAndroid Build Coastguard Worker```xml 293*912701f9SAndroid Build Coastguard Worker<rgScope> 294*912701f9SAndroid Build Coastguard Worker <rgPath path="//supplementalData/currencyData/fractions/info[@iso4217='#'][@digits='*'][@rounding='*'][@cashDigits='*'][@cashRounding='*']" draft="provisional" /> 295*912701f9SAndroid Build Coastguard Worker <rgPath path="//supplementalData/currencyData/fractions/info[@iso4217='#'][@digits='*'][@rounding='*'][@cashRounding='*']" draft="provisional" /> 296*912701f9SAndroid Build Coastguard Worker <rgPath path="//supplementalData/currencyData/fractions/info[@iso4217='#'][@digits='*'][@rounding='*']" draft="provisional" /> 297*912701f9SAndroid Build Coastguard Worker <rgPath path="//supplementalData/calendarPreferenceData/calendarPreference[@territories='#'][@ordering='*']" draft="provisional" /> 298*912701f9SAndroid Build Coastguard Worker ... 299*912701f9SAndroid Build Coastguard Worker <rgPath path="//supplementalData/unitPreferenceData/unitPreferences[@category='*'][@usage='*'][@scope='*']/unitPreference[@regions='#'][@alt='*']" draft="provisional" /> 300*912701f9SAndroid Build Coastguard Worker <rgPath path="//supplementalData/unitPreferenceData/unitPreferences[@category='*'][@usage='*'][@scope='*']/unitPreference[@regions='#']" draft="provisional" /> 301*912701f9SAndroid Build Coastguard Worker <rgPath path="//supplementalData/unitPreferenceData/unitPreferences[@category='*'][@usage='*']/unitPreference[@regions='#'][@alt='*']" draft="provisional" /> 302*912701f9SAndroid Build Coastguard Worker <rgPath path="//supplementalData/unitPreferenceData/unitPreferences[@category='*'][@usage='*']/unitPreference[@regions='#']" draft="provisional" /> 303*912701f9SAndroid Build Coastguard Worker</rgScope> 304*912701f9SAndroid Build Coastguard Worker``` 305*912701f9SAndroid Build Coastguard Worker 306*912701f9SAndroid Build Coastguard WorkerThe exact format of the path is provisional in CLDR 29, but as currently shown: 307*912701f9SAndroid Build Coastguard Worker 308*912701f9SAndroid Build Coastguard Worker* An attribute value of `'*'` indicates that the path applies regardless of the value of the attribute. 309*912701f9SAndroid Build Coastguard Worker* Each path must have exactly one attribute whose value is marked here as `'#'`; in actual data items with this path, the corresponding value is a list of region codes. It is the region codes in this list that are compared with the region specified by the “rg” key to determine which data item to use for this path. 310*912701f9SAndroid Build Coastguard Worker 311*912701f9SAndroid Build Coastguard Worker## <a name="Supplemental_Language_Data" href="#Supplemental_Language_Data">Supplemental Language Data</a> 312*912701f9SAndroid Build Coastguard Worker 313*912701f9SAndroid Build Coastguard Worker```xml 314*912701f9SAndroid Build Coastguard Worker<!ELEMENT languageData ( language* ) > 315*912701f9SAndroid Build Coastguard Worker<!ELEMENT language EMPTY > 316*912701f9SAndroid Build Coastguard Worker<!ATTLIST language type NMTOKEN #REQUIRED > 317*912701f9SAndroid Build Coastguard Worker<!ATTLIST language scripts NMTOKENS #IMPLIED > 318*912701f9SAndroid Build Coastguard Worker<!ATTLIST language territories NMTOKENS #IMPLIED > 319*912701f9SAndroid Build Coastguard Worker<!ATTLIST language variants NMTOKENS #IMPLIED > 320*912701f9SAndroid Build Coastguard Worker<!ATTLIST language alt NMTOKENS #IMPLIED > 321*912701f9SAndroid Build Coastguard Worker``` 322*912701f9SAndroid Build Coastguard Worker 323*912701f9SAndroid Build Coastguard WorkerThe language data is used for consistency checking and testing. It provides a list of which languages are used with which scripts and in which countries. To a large extent, however, the territory list has been superseded by the data in _[Supplemental Territory Information](#Supplemental_Territory_Information)_ . 324*912701f9SAndroid Build Coastguard Worker 325*912701f9SAndroid Build Coastguard Worker```xml 326*912701f9SAndroid Build Coastguard Worker<languageData> 327*912701f9SAndroid Build Coastguard Worker <language type="af" scripts="Latn" territories="ZA" /> 328*912701f9SAndroid Build Coastguard Worker <language type="am" scripts="Ethi" territories="ET" /> 329*912701f9SAndroid Build Coastguard Worker <language type="ar" scripts="Arab" territories="AE BH DZ EG IN IQ JO KW LB LY MA OM PS QA SA SD SY TN YE" /> 330*912701f9SAndroid Build Coastguard Worker ... 331*912701f9SAndroid Build Coastguard Worker``` 332*912701f9SAndroid Build Coastguard Worker 333*912701f9SAndroid Build Coastguard WorkerIf the language is not a modern language, or the script is not a modern script, or the language not a major language of the territory, then the `alt` attribute is set to secondary. 334*912701f9SAndroid Build Coastguard Worker 335*912701f9SAndroid Build Coastguard Worker```xml 336*912701f9SAndroid Build Coastguard Worker <language type="fr" scripts="Latn" territories="IT US" alt="secondary" /> 337*912701f9SAndroid Build Coastguard Worker ... 338*912701f9SAndroid Build Coastguard Worker``` 339*912701f9SAndroid Build Coastguard Worker 340*912701f9SAndroid Build Coastguard Worker## <a name="Supplemental_Language_Grouping" href="#Supplemental_Language_Grouping">Supplemental Language Grouping</a> 341*912701f9SAndroid Build Coastguard Worker 342*912701f9SAndroid Build Coastguard Worker```xml 343*912701f9SAndroid Build Coastguard Worker<!ELEMENT languageGroups ( languageGroup* ) > 344*912701f9SAndroid Build Coastguard Worker<!ELEMENT languageGroup ( #PCDATA ) > 345*912701f9SAndroid Build Coastguard Worker<!ATTLIST languageGroup parent NMTOKEN #REQUIRED > 346*912701f9SAndroid Build Coastguard Worker``` 347*912701f9SAndroid Build Coastguard Worker 348*912701f9SAndroid Build Coastguard WorkerThe language groups supply language containment. For example, the following indicates that aav is the Unicode language code for a language group that contains caq, crv, etc. 349*912701f9SAndroid Build Coastguard Worker 350*912701f9SAndroid Build Coastguard Worker```xml 351*912701f9SAndroid Build Coastguard Worker<languageGroup parent="fiu">chm et fi fit fkv hu izh kca koi krl kv liv mdf mns mrj myv smi udm vep vot vro</languageGroup> 352*912701f9SAndroid Build Coastguard Worker``` 353*912701f9SAndroid Build Coastguard Worker 354*912701f9SAndroid Build Coastguard WorkerThe vast majority of the languageGroup data is extracted from Wikidata, but may be overridden in some cases. The Wikidata information is more fine-grained, but makes use of language groups that don't have ISO or Unicode language codes. Those language groups are omitted from the data. For example, Wikidata has the following child-parent chain: only the first and last elements are present in the language groups. 355*912701f9SAndroid Build Coastguard Worker 356*912701f9SAndroid Build Coastguard Worker| Name | Wikidata Code | Language Code | 357*912701f9SAndroid Build Coastguard Worker| ------------------------- | ------------------------------------------------ | ------------- | 358*912701f9SAndroid Build Coastguard Worker| Finnish | [Q1412](https://www.wikidata.org/wiki/Q1412) | fi | 359*912701f9SAndroid Build Coastguard Worker| Finnic languages | [Q33328](https://www.wikidata.org/wiki/Q33328) | 360*912701f9SAndroid Build Coastguard Worker| Finno-Samic languages | [Q163652](https://www.wikidata.org/wiki/Q163652) | 361*912701f9SAndroid Build Coastguard Worker| Finno-Volgaic languages | [Q161236](https://www.wikidata.org/wiki/Q161236) | 362*912701f9SAndroid Build Coastguard Worker| Finno-Permic languages | [Q161240](https://www.wikidata.org/wiki/Q161240) | 363*912701f9SAndroid Build Coastguard Worker| Finno-Ugric languages | [Q79890](https://www.wikidata.org/wiki/Q79890) | fiu | 364*912701f9SAndroid Build Coastguard Worker 365*912701f9SAndroid Build Coastguard Worker## <a name="Supplemental_Code_Mapping" href="#Supplemental_Code_Mapping">Supplemental Code Mapping</a> 366*912701f9SAndroid Build Coastguard Worker 367*912701f9SAndroid Build Coastguard Worker```xml 368*912701f9SAndroid Build Coastguard Worker<!ELEMENT codeMappings (languageCodes*, territoryCodes*, currencyCodes*) > 369*912701f9SAndroid Build Coastguard Worker 370*912701f9SAndroid Build Coastguard Worker<!ELEMENT languageCodes EMPTY > 371*912701f9SAndroid Build Coastguard Worker<!ATTLIST languageCodes type NMTOKEN #REQUIRED> 372*912701f9SAndroid Build Coastguard Worker<!ATTLIST languageCodes alpha3 NMTOKEN #REQUIRED> 373*912701f9SAndroid Build Coastguard Worker 374*912701f9SAndroid Build Coastguard Worker<!ELEMENT territoryCodes EMPTY > 375*912701f9SAndroid Build Coastguard Worker<!ATTLIST territoryCodes type NMTOKEN #REQUIRED> 376*912701f9SAndroid Build Coastguard Worker<!ATTLIST territoryCodes numeric NMTOKEN #REQUIRED> 377*912701f9SAndroid Build Coastguard Worker<!ATTLIST territoryCodes alpha3 NMTOKEN #REQUIRED> 378*912701f9SAndroid Build Coastguard Worker<!ATTLIST territoryCodes fips10 NMTOKEN #IMPLIED> 379*912701f9SAndroid Build Coastguard Worker<!ATTLIST territoryCodes internet NMTOKENS #IMPLIED> [deprecated] 380*912701f9SAndroid Build Coastguard Worker 381*912701f9SAndroid Build Coastguard Worker<!ELEMENT currencyCodes EMPTY > 382*912701f9SAndroid Build Coastguard Worker<!ATTLIST currencyCodes type NMTOKEN #REQUIRED> 383*912701f9SAndroid Build Coastguard Worker<!ATTLIST currencyCodes numeric NMTOKEN #REQUIRED> 384*912701f9SAndroid Build Coastguard Worker``` 385*912701f9SAndroid Build Coastguard Worker 386*912701f9SAndroid Build Coastguard WorkerThe code mapping information provides mappings between the subtags used in the CLDR locale IDs (from BCP 47) and other coding systems or related information. The language codes are only provided for those codes that have two letters in BCP 47 to their ISO three-letter equivalents. The territory codes provide mappings to numeric (UN M.49 [[UNM49](tr35.md#UNM49)] codes, equivalent to ISO numeric codes), ISO three-letter codes, FIPS 10 codes, and the internet top-level domain codes. 387*912701f9SAndroid Build Coastguard Worker 388*912701f9SAndroid Build Coastguard WorkerThe alphabetic codes are only provided where different from the type. For example: 389*912701f9SAndroid Build Coastguard Worker 390*912701f9SAndroid Build Coastguard Worker```xml 391*912701f9SAndroid Build Coastguard Worker<territoryCodes type="AA" numeric="958" alpha3="AAA" /> 392*912701f9SAndroid Build Coastguard Worker<territoryCodes type="AD" numeric="020" alpha3="AND" fips10="AN" /> 393*912701f9SAndroid Build Coastguard Worker<territoryCodes type="AE" numeric="784" alpha3="ARE" /> 394*912701f9SAndroid Build Coastguard Worker... 395*912701f9SAndroid Build Coastguard Worker<territoryCodes type="GB" numeric="826" alpha3="GBR" fips10="UK" /> 396*912701f9SAndroid Build Coastguard Worker... 397*912701f9SAndroid Build Coastguard Worker<territoryCodes type="QU" numeric="967" alpha3="QUU" internet="EU" /> 398*912701f9SAndroid Build Coastguard Worker... 399*912701f9SAndroid Build Coastguard Worker<territoryCodes type="XK" numeric="983" alpha3="XKK" /> 400*912701f9SAndroid Build Coastguard Worker... 401*912701f9SAndroid Build Coastguard Worker``` 402*912701f9SAndroid Build Coastguard Worker 403*912701f9SAndroid Build Coastguard WorkerWhere there is no corresponding code, sometimes private use codes are used, such as the numeric code for XK. 404*912701f9SAndroid Build Coastguard Worker 405*912701f9SAndroid Build Coastguard WorkerThe currencyCodes are mappings from three letter currency codes to numeric values (ISO 4217, see [Current currency & funds code list](https://www.six-group.com/en/products-services/financial-information/data-standards.html#scrollTo=maintenance-agency)). The mapping currently covers only current codes and does not include historic currencies. For example: 406*912701f9SAndroid Build Coastguard Worker 407*912701f9SAndroid Build Coastguard Worker```xml 408*912701f9SAndroid Build Coastguard Worker<currencyCodes type="AED" numeric="784" /> 409*912701f9SAndroid Build Coastguard Worker<currencyCodes type="AFN" numeric="971" /> 410*912701f9SAndroid Build Coastguard Worker... 411*912701f9SAndroid Build Coastguard Worker<currencyCodes type="EUR" numeric="978" /> 412*912701f9SAndroid Build Coastguard Worker... 413*912701f9SAndroid Build Coastguard Worker<currencyCodes type="ZAR" numeric="710" /> 414*912701f9SAndroid Build Coastguard Worker<currencyCodes type="ZMW" numeric="967" /> 415*912701f9SAndroid Build Coastguard Worker``` 416*912701f9SAndroid Build Coastguard Worker 417*912701f9SAndroid Build Coastguard Worker## ~~<a name="Telephone_Code_Data" href="#Telephone_Code_Data">Telephone Code Data</a>~~ (Deprecated) 418*912701f9SAndroid Build Coastguard Worker 419*912701f9SAndroid Build Coastguard WorkerDeprecated in CLDR v34, and data removed. 420*912701f9SAndroid Build Coastguard WorkerThe data and structure for phone numbers changes quite often, so the recommended alternative is the open-source library [libphonenumber](https://github.com/google/libphonenumber#what-is-it). 421*912701f9SAndroid Build Coastguard Worker 422*912701f9SAndroid Build Coastguard Worker```xml 423*912701f9SAndroid Build Coastguard Worker<!ELEMENT telephoneCodeData ( codesByTerritory* ) > 424*912701f9SAndroid Build Coastguard Worker 425*912701f9SAndroid Build Coastguard Worker<!ELEMENT codesByTerritory ( telephoneCountryCode+ ) > 426*912701f9SAndroid Build Coastguard Worker<!ATTLIST codesByTerritory territory NMTOKEN #REQUIRED > 427*912701f9SAndroid Build Coastguard Worker 428*912701f9SAndroid Build Coastguard Worker<!ELEMENT telephoneCountryCode EMPTY > 429*912701f9SAndroid Build Coastguard Worker<!ATTLIST telephoneCountryCode code NMTOKEN #REQUIRED > 430*912701f9SAndroid Build Coastguard Worker<!ATTLIST telephoneCountryCode from NMTOKEN #IMPLIED > 431*912701f9SAndroid Build Coastguard Worker<!ATTLIST telephoneCountryCode to NMTOKEN #IMPLIED > 432*912701f9SAndroid Build Coastguard Worker``` 433*912701f9SAndroid Build Coastguard Worker 434*912701f9SAndroid Build Coastguard WorkerThis data specifies the mapping between ITU telephone country codes [[ITUE164](tr35.md#ITUE164)] and CLDR-style territory codes (ISO 3166 2-letter codes or non-corresponding UN M.49 [[UNM49](tr35.md#UNM49)] 3-digit codes). There are several things to note: 435*912701f9SAndroid Build Coastguard Worker 436*912701f9SAndroid Build Coastguard Worker* A given telephone country code may map to multiple CLDR territory codes; +1 (North America Numbering Plan) covers the US and Canada, as well as many islands in the Caribbean and some in the Pacific 437*912701f9SAndroid Build Coastguard Worker* Some telephone country codes are for global services (for example, some satellite services), and thus correspond to territory code 001. 438*912701f9SAndroid Build Coastguard Worker* The mappings change over time (territories move from one telephone code to another). These changes are usually planned several years in advance, and there may be a period during which either telephone code can be used to reach the territory. While the CLDR telephone code data is not intended to include past changes, it is intended to incorporate known information on planned future changes, using `from` and `to` date attributes to indicate when mappings are valid. 439*912701f9SAndroid Build Coastguard Worker 440*912701f9SAndroid Build Coastguard WorkerA subset of the telephone code data might look like the following (showing a past mapping change to illustrate the from and to attributes): 441*912701f9SAndroid Build Coastguard Worker 442*912701f9SAndroid Build Coastguard Worker```xml 443*912701f9SAndroid Build Coastguard Worker<codesByTerritory territory="001"> 444*912701f9SAndroid Build Coastguard Worker <telephoneCountryCode code="800"/> <!-- International Freephone Service --> 445*912701f9SAndroid Build Coastguard Worker <telephoneCountryCode code="808"/> <!-- International Shared Cost Services (ISCS) --> 446*912701f9SAndroid Build Coastguard Worker <telephoneCountryCode code="870"/> <!-- Inmarsat Single Number Access Service (SNAC) --> 447*912701f9SAndroid Build Coastguard Worker</codesByTerritory> 448*912701f9SAndroid Build Coastguard Worker<codesByTerritory territory="AS"> <!-- American Samoa --> 449*912701f9SAndroid Build Coastguard Worker <telephoneCountryCode code="1" from="2004-10-02"/> <!-- +1 684 in North America Numbering Plan --> 450*912701f9SAndroid Build Coastguard Worker <telephoneCountryCode code="684" to="2005-04-02"/> <!-- +684 now a spare code --> 451*912701f9SAndroid Build Coastguard Worker</codesByTerritory> 452*912701f9SAndroid Build Coastguard Worker<codesByTerritory territory="CA"> 453*912701f9SAndroid Build Coastguard Worker <telephoneCountryCode code="1"/> <!-- North America Numbering Plan --> 454*912701f9SAndroid Build Coastguard Worker</codesByTerritory> 455*912701f9SAndroid Build Coastguard Worker``` 456*912701f9SAndroid Build Coastguard Worker 457*912701f9SAndroid Build Coastguard Worker## ~~<a name="Postal_Code_Validation" href="#Postal_Code_Validation">Postal Code Validation (Deprecated)</a>~~ 458*912701f9SAndroid Build Coastguard Worker 459*912701f9SAndroid Build Coastguard WorkerDeprecated in v27. Please see other services that are kept up to date, such as <https://github.com/google/libaddressinput> 460*912701f9SAndroid Build Coastguard Worker 461*912701f9SAndroid Build Coastguard Worker```xml 462*912701f9SAndroid Build Coastguard Worker<!ELEMENT postalCodeData (postCodeRegex*) > 463*912701f9SAndroid Build Coastguard Worker<!ELEMENT postCodeRegex (#PCDATA) > 464*912701f9SAndroid Build Coastguard Worker<!ATTLIST postCodeRegex territoryId NMTOKEN #REQUIRED > 465*912701f9SAndroid Build Coastguard Worker``` 466*912701f9SAndroid Build Coastguard Worker 467*912701f9SAndroid Build Coastguard WorkerThe Postal Code regex information can be used to validate postal codes used in different countries. In some cases, the regex is quite simple, such as for Germany: 468*912701f9SAndroid Build Coastguard Worker 469*912701f9SAndroid Build Coastguard Worker```xml 470*912701f9SAndroid Build Coastguard Worker<postCodeRegex territoryId="DE" >\d{5}</postCodeRegex> 471*912701f9SAndroid Build Coastguard Worker``` 472*912701f9SAndroid Build Coastguard Worker 473*912701f9SAndroid Build Coastguard WorkerThe US code is slightly more complicated, since there is an optional portion: 474*912701f9SAndroid Build Coastguard Worker 475*912701f9SAndroid Build Coastguard Worker```xml 476*912701f9SAndroid Build Coastguard Worker<postCodeRegex territoryId="US" >\d{5}([ \-]\d{4})?</postCodeRegex> 477*912701f9SAndroid Build Coastguard Worker``` 478*912701f9SAndroid Build Coastguard Worker 479*912701f9SAndroid Build Coastguard WorkerThe most complicated currently is the UK. 480*912701f9SAndroid Build Coastguard Worker 481*912701f9SAndroid Build Coastguard Worker## <a name="Supplemental_Character_Fallback_Data" href="#Supplemental_Character_Fallback_Data">Supplemental Character Fallback Data</a> 482*912701f9SAndroid Build Coastguard Worker 483*912701f9SAndroid Build Coastguard Worker```xml 484*912701f9SAndroid Build Coastguard Worker<!ELEMENT characters ( character-fallback*) > 485*912701f9SAndroid Build Coastguard Worker 486*912701f9SAndroid Build Coastguard Worker<!ELEMENT character-fallback ( character* ) > 487*912701f9SAndroid Build Coastguard Worker<!ELEMENT character (substitute*) > 488*912701f9SAndroid Build Coastguard Worker<!ATTLIST character value CDATA #REQUIRED > 489*912701f9SAndroid Build Coastguard Worker 490*912701f9SAndroid Build Coastguard Worker<!ELEMENT substitute (#PCDATA) > 491*912701f9SAndroid Build Coastguard Worker``` 492*912701f9SAndroid Build Coastguard Worker 493*912701f9SAndroid Build Coastguard WorkerThe `characters` element provides a way for non-Unicode systems, or systems that only support a subset of Unicode characters, to transform CLDR data. It gives a list of characters with alternative values that can be used if the main value is not available. For example: 494*912701f9SAndroid Build Coastguard Worker 495*912701f9SAndroid Build Coastguard Worker```xml 496*912701f9SAndroid Build Coastguard Worker<characters> 497*912701f9SAndroid Build Coastguard Worker <character-fallback> 498*912701f9SAndroid Build Coastguard Worker <character value="ß"> 499*912701f9SAndroid Build Coastguard Worker <substitute>ss</substitute> 500*912701f9SAndroid Build Coastguard Worker </character> 501*912701f9SAndroid Build Coastguard Worker <character value="Ø"> 502*912701f9SAndroid Build Coastguard Worker <substitute>Ö</substitute> 503*912701f9SAndroid Build Coastguard Worker <substitute>O</substitute> 504*912701f9SAndroid Build Coastguard Worker </character> 505*912701f9SAndroid Build Coastguard Worker <character value="₧"> 506*912701f9SAndroid Build Coastguard Worker <substitute>Pts</substitute> 507*912701f9SAndroid Build Coastguard Worker </character> 508*912701f9SAndroid Build Coastguard Worker <character value="₣"> 509*912701f9SAndroid Build Coastguard Worker <substitute>Fr.</substitute> 510*912701f9SAndroid Build Coastguard Worker </character> 511*912701f9SAndroid Build Coastguard Worker </character-fallback> 512*912701f9SAndroid Build Coastguard Worker</characters> 513*912701f9SAndroid Build Coastguard Worker``` 514*912701f9SAndroid Build Coastguard Worker 515*912701f9SAndroid Build Coastguard WorkerThe ordering of the `substitute` elements indicates the preference among them. 516*912701f9SAndroid Build Coastguard Worker 517*912701f9SAndroid Build Coastguard WorkerThat is, this data provides recommended fallbacks for use when a charset or supported repertoire does not contain a desired character. There is more than one possible fallback: the recommended usage is that when a character _value_ is not in the desired repertoire the following process is used, whereby the first value that is wholly in the desired repertoire is used. 518*912701f9SAndroid Build Coastguard Worker 519*912701f9SAndroid Build Coastguard Worker* `toNFC`(_value_) 520*912701f9SAndroid Build Coastguard Worker* other canonically equivalent sequences, if there are any 521*912701f9SAndroid Build Coastguard Worker* the explicit _substitutes_ value (in order) 522*912701f9SAndroid Build Coastguard Worker* `toNFKC`(_value_) 523*912701f9SAndroid Build Coastguard Worker 524*912701f9SAndroid Build Coastguard Worker## <a name="Coverage_Levels" href="#Coverage_Levels">Coverage Levels</a> 525*912701f9SAndroid Build Coastguard Worker 526*912701f9SAndroid Build Coastguard WorkerThe following describes the structure used to set coverage levels used for CLDR. 527*912701f9SAndroid Build Coastguard WorkerThat structure is used in CLDR tooling, and can also be used by consumers of CLDR data, such as described in [Data Size Reduction](tr35.md#Data_Size). 528*912701f9SAndroid Build Coastguard Worker 529*912701f9SAndroid Build Coastguard WorkerThe following lists the coverage levels. The qualifications for each level may change between releases of CLDR, and more detailed information for each level is on [Coverage Levels](https://cldr.unicode.org/index/cldr-spec/coverage-levels). Each level adds to what is in the lower level, so Basic includes all of Core, Moderate all of Basic, and so on. 530*912701f9SAndroid Build Coastguard Worker 531*912701f9SAndroid Build Coastguard Worker| Code | Level | Description | 532*912701f9SAndroid Build Coastguard Worker| ----: | ------------- | -------------- | 533*912701f9SAndroid Build Coastguard Worker| 0 | undetermined | Does not meet any of the following levels. | 534*912701f9SAndroid Build Coastguard Worker| 10 | core | Core Locale — Has minimal data about the language and writing system that is required before other information can be added using the CLDR survey tool. | 535*912701f9SAndroid Build Coastguard Worker| 40 | basic | Selectable Locale — Minimal locale data necessary for a "selectable" locale in a platform UI. Very basic number and datetime formatting, etc. | 536*912701f9SAndroid Build Coastguard Worker| 60 | moderate | Document Content Locale — Minimal locale data for applications such as spreadsheets and word processors to support general document content internationalization: formatting number, datetime, currencies, sorting, plural handling, and so on. | 537*912701f9SAndroid Build Coastguard Worker| 80 | modern | UI Locale — Contains all fields in normal modern use, including all CLDR locale names, country names, timezone names, currencies in use, and so on. | 538*912701f9SAndroid Build Coastguard Worker| 100 | comprehensive | Above modern level; typically more data than is needed in most implementations. | 539*912701f9SAndroid Build Coastguard Worker 540*912701f9SAndroid Build Coastguard WorkerThe Basic through Modern levels are based on the definitions and specifications listed below. 541*912701f9SAndroid Build Coastguard Worker 542*912701f9SAndroid Build Coastguard Worker```xml 543*912701f9SAndroid Build Coastguard Worker<!ELEMENT coverageLevels ( approvalRequirements, coverageVariable*, coverageLevel* ) > 544*912701f9SAndroid Build Coastguard Worker<!ELEMENT coverageLevel EMPTY > 545*912701f9SAndroid Build Coastguard Worker<!ATTLIST coverageLevel inLanguage CDATA #IMPLIED > 546*912701f9SAndroid Build Coastguard Worker<!ATTLIST coverageLevel inScript CDATA #IMPLIED > 547*912701f9SAndroid Build Coastguard Worker<!ATTLIST coverageLevel inTerritory CDATA #IMPLIED > 548*912701f9SAndroid Build Coastguard Worker<!ATTLIST coverageLevel value CDATA #REQUIRED > 549*912701f9SAndroid Build Coastguard Worker<!ATTLIST coverageLevel match CDATA #REQUIRED > 550*912701f9SAndroid Build Coastguard Worker``` 551*912701f9SAndroid Build Coastguard Worker 552*912701f9SAndroid Build Coastguard WorkerFor example, here is an example coverageLevel line. 553*912701f9SAndroid Build Coastguard Worker 554*912701f9SAndroid Build Coastguard Worker```xml 555*912701f9SAndroid Build Coastguard Worker<coverageLevel 556*912701f9SAndroid Build Coastguard Worker value="30" 557*912701f9SAndroid Build Coastguard Worker inLanguage="(de|fi)" 558*912701f9SAndroid Build Coastguard Worker match="localeDisplayNames/types/type[@type='phonebook'][@key='collation']"/> 559*912701f9SAndroid Build Coastguard Worker``` 560*912701f9SAndroid Build Coastguard Worker 561*912701f9SAndroid Build Coastguard WorkerThe `coverageLevel` elements are read in order, and the first match results in a coverage level value. The element matches based on the `inLanguage`, `inScript`, `inTerritory`, and `match` attribute values, which are regular expressions. For example, in the above example, a match occurs if the language is de or fi, and if the path is a locale display name for `collation=phonebook`. 562*912701f9SAndroid Build Coastguard Worker 563*912701f9SAndroid Build Coastguard WorkerThe `match` attribute value logically has `//ldml/` prefixed before it is applied. In addition, the `[@` is automatically quoted. Otherwise standard Perl/Java style regular expression syntax is used. 564*912701f9SAndroid Build Coastguard Worker 565*912701f9SAndroid Build Coastguard Worker```xml 566*912701f9SAndroid Build Coastguard Worker<!ELEMENT coverageVariable EMPTY > 567*912701f9SAndroid Build Coastguard Worker<!ATTLIST coverageVariable key CDATA #REQUIRED > 568*912701f9SAndroid Build Coastguard Worker<!ATTLIST coverageVariable value CDATA #REQUIRED > 569*912701f9SAndroid Build Coastguard Worker``` 570*912701f9SAndroid Build Coastguard Worker 571*912701f9SAndroid Build Coastguard WorkerThe `coverageVariable` element allows us to create variables for certain regular expressions that are used frequently in the coverageLevel definitions above. Each coverage variable must contain a `key` / `value` pair of attributes, which can then be used to be substituted into a coverageLevel definition above. 572*912701f9SAndroid Build Coastguard Worker 573*912701f9SAndroid Build Coastguard WorkerFor example, here is an example coverageLevel line using coverageVariable substitution. 574*912701f9SAndroid Build Coastguard Worker 575*912701f9SAndroid Build Coastguard Worker```xml 576*912701f9SAndroid Build Coastguard Worker<coverageVariable key="%dayTypes" value="(sun|mon|tue|wed|thu|fri|sat)"> 577*912701f9SAndroid Build Coastguard Worker<coverageVariable key="%wideAbbr" value="(wide|abbreviated)"> 578*912701f9SAndroid Build Coastguard Worker<coverageLevel value="20" match="dates/calendars/calendar[@type='gregorian']/days/dayContext[@type='format']/dayWidth[@type='%wideAbbr']/day[@type='%dayTypes']"/> 579*912701f9SAndroid Build Coastguard Worker``` 580*912701f9SAndroid Build Coastguard Worker 581*912701f9SAndroid Build Coastguard WorkerIn this example, the coverge variables %dayTypes and %wideAbbr are used to substitute their respective values into the match expression. This allows us to reuse the same variable for other coverageLevel matches that use the same regular expression fragment. 582*912701f9SAndroid Build Coastguard Worker 583*912701f9SAndroid Build Coastguard Worker```xml 584*912701f9SAndroid Build Coastguard Worker<!ELEMENT approvalRequirements ( approvalRequirement* ) > 585*912701f9SAndroid Build Coastguard Worker<!ELEMENT approvalRequirement EMPTY > 586*912701f9SAndroid Build Coastguard Worker<!ATTLIST approvalRequirement votes CDATA #REQUIRED > 587*912701f9SAndroid Build Coastguard Worker<!ATTLIST approvalRequirement locales CDATA #REQUIRED > 588*912701f9SAndroid Build Coastguard Worker<!ATTLIST approvalRequirement paths CDATA #REQUIRED > 589*912701f9SAndroid Build Coastguard Worker``` 590*912701f9SAndroid Build Coastguard Worker 591*912701f9SAndroid Build Coastguard WorkerThe approvalRequirements allows to specify the number of survey tool votes required for approval, either based on locale, or path, or both. Certain locales require a higher voting threshold (usually 8 votes instead of 4), in order to promote greater stability in the data. Furthermore, certain fields that are very high visibility fields, such as number formats, require a CLDR TC committee member's vote for approval. 592*912701f9SAndroid Build Coastguard Worker 593*912701f9SAndroid Build Coastguard Worker`votes=` can be a numeric value, or it can be of the form `=vetter` where `vetter` is one of the `VoteResolver.Level` enumerated values. 594*912701f9SAndroid Build Coastguard WorkerIt can also be `=LOWER_BAR` (8) or `=HIGH_BAR` (same as `=tc`) referring to the `VoteResolver` constants of the same names. 595*912701f9SAndroid Build Coastguard Worker 596*912701f9SAndroid Build Coastguard WorkerHere is an example of the approvalRequirements section. 597*912701f9SAndroid Build Coastguard Worker 598*912701f9SAndroid Build Coastguard Worker```xml 599*912701f9SAndroid Build Coastguard Worker<approvalRequirements> 600*912701f9SAndroid Build Coastguard Worker <!-- "high bar" items --> 601*912701f9SAndroid Build Coastguard Worker <approvalRequirement votes="=HIGH_BAR" locales="*" paths="//ldml/numbers/symbols[^/]++/(decimal|group)"/> 602*912701f9SAndroid Build Coastguard Worker <!-- established locales - https://cldr.unicode.org/index/process#h.rm00w9v03ia8 --> 603*912701f9SAndroid Build Coastguard Worker <approvalRequirement votes="=LOWER_BAR" locales="ar ca cs da de el es fi fr he hi hr hu it ja ko nb nl pl pt pt_PT ro ru sk sl sr sv th tr uk vi zh zh_Hant" paths=""/> 604*912701f9SAndroid Build Coastguard Worker <!-- all other items --> 605*912701f9SAndroid Build Coastguard Worker <approvalRequirement votes="=vetter" locales="*" paths=""/> 606*912701f9SAndroid Build Coastguard Worker</approvalRequirements> 607*912701f9SAndroid Build Coastguard Worker``` 608*912701f9SAndroid Build Coastguard Worker 609*912701f9SAndroid Build Coastguard WorkerThis section specifies that a TC vote (20 votes) is required for decimal and grouping separators. Furthermore it specifies that any field in the established locales list (i.e. ar, ca, cs, etc.) requires 8 votes, and that all other locales require 4 votes only. 610*912701f9SAndroid Build Coastguard Worker 611*912701f9SAndroid Build Coastguard WorkerFor more information on the CLDR Voting process, see [https://cldr.unicode.org/index/process](https://cldr.unicode.org/index/process) 612*912701f9SAndroid Build Coastguard Worker 613*912701f9SAndroid Build Coastguard Worker### <a name="Coverage_Level_Definitions" href="#Coverage_Level_Definitions">Definitions</a> 614*912701f9SAndroid Build Coastguard WorkerThis is a snapshot of the contents of certain variables. The actual definitions in the coverageLevels.xml file may vary from these descriptions. 615*912701f9SAndroid Build Coastguard Worker 616*912701f9SAndroid Build Coastguard Worker* _Target-Language_ is the language under consideration. 617*912701f9SAndroid Build Coastguard Worker* _Target-Territories_ is the list of territories found by looking up _Target-Language_ in the `<languageData>` elements in [Supplemental Language Data](tr35-info.md#Supplemental_Language_Data). 618*912701f9SAndroid Build Coastguard Worker* _Language-List_ is _Target-Language_, plus 619*912701f9SAndroid Build Coastguard Worker * **moderate:** Chinese, English, French, German, Italian, Japanese, Portuguese, Russian, Spanish, Unknown; Arabic, Hindi, Korean, Indonesian, Dutch, Bengali, Turkish, Thai, Polish (de, en, es, fr, it, ja, pt, ru, zh, und, ar, hi, ko, in, nl, bn, tr, th, pl). If an EU language, add the remaining official EU languages. 620*912701f9SAndroid Build Coastguard Worker * **modern:** all languages that are official or major commercial languages of modern territories 621*912701f9SAndroid Build Coastguard Worker* _Target-Scripts_ is the list of scripts in which _Target-Language_ can be customarily written (found by looking up _Target-Language_ in the `<languageData>` elements in [Supplemental Language Data](tr35-info.md#Supplemental_Language_Data))_,_ plus Unknown (Zzzz)_._ 622*912701f9SAndroid Build Coastguard Worker* _Script-List_ is the _Target-Scripts_ plus the major scripts used for multiple languages 623*912701f9SAndroid Build Coastguard Worker * Latin, Simplified Chinese, Traditional Chinese, Cyrillic, Arabic (Latn, Hans, Hant, Cyrl, Arab) 624*912701f9SAndroid Build Coastguard Worker* _Territory-List_ is the list of territories formed by taking the _Target-Territories_ and adding: 625*912701f9SAndroid Build Coastguard Worker * **moderate:** Brazil, China, France, Germany, India, Italy, Japan, Russia, United Kingdom, United States, Unknown; Spain, Canada, Korea, Mexico, Australia, Netherlands, Switzerland, Belgium, Sweden, Turkey, Austria, Indonesia, Saudi Arabia, Norway, Denmark, Poland, South Africa, Greece, Finland, Ireland, Portugal, Thailand, Hong Kong SAR China, Taiwan (BR, CN, DE, GB, FR, IN, IT, JP, RU, US, ZZ, ES, BE, SE, TR, AT, ID, SA, NO, DK, PL, ZA, GR, FI, IE, PT, TH, HK, TW). If an EU language, add the remaining member EU countries. 626*912701f9SAndroid Build Coastguard Worker * **modern:** all current ISO 3166 territories, plus the UN M.49 [[UNM49](tr35.md#UNM49)] regions in [Supplemental Territory Containment](tr35-info.md#Supplemental_Territory_Containment). 627*912701f9SAndroid Build Coastguard Worker* _Currency-List_ is the list of current official currencies used in any of the territories in _Territory-List_, found by looking at the `region` elements in [Supplemental Territory Containment](tr35-info.md#Supplemental_Territory_Containment), plus Unknown (XXX). 628*912701f9SAndroid Build Coastguard Worker* _Calendar-List_ is the set of calendars in customary use in any of _Target-Territories_, plus Gregorian. 629*912701f9SAndroid Build Coastguard Worker* _Number-System-List_ is the set of number systems in customary use in the language. 630*912701f9SAndroid Build Coastguard Worker 631*912701f9SAndroid Build Coastguard Worker### <a name="Coverage_Level_Data_Requirements" href="#Coverage_Level_Data_Requirements">Data Requirements</a> 632*912701f9SAndroid Build Coastguard Worker 633*912701f9SAndroid Build Coastguard WorkerThe required data to qualify for each level based on these definitions is then the following. 634*912701f9SAndroid Build Coastguard Worker 635*912701f9SAndroid Build Coastguard Worker1. localeDisplayNames 636*912701f9SAndroid Build Coastguard Worker 1. _languages:_ localized names for all languages in _Language-List._ 637*912701f9SAndroid Build Coastguard Worker 2. _scripts:_ localized names for all scripts in _Script-List_. 638*912701f9SAndroid Build Coastguard Worker 3. _territories:_ localized names for all territories in _Territory-List_. 639*912701f9SAndroid Build Coastguard Worker 4. _variants, keys, types:_ localized names for any in use in _Target-Territories_; for example, a translation for PHONEBOOK in a German locale. 640*912701f9SAndroid Build Coastguard Worker 641*912701f9SAndroid Build Coastguard Worker2. dates: all of the following for each calendar in _Calendar-List_. 642*912701f9SAndroid Build Coastguard Worker 1. calendars: localized names 643*912701f9SAndroid Build Coastguard Worker 2. month names, day names, era names, and quarter names 644*912701f9SAndroid Build Coastguard Worker * context=format and width=narrow, wide, & abbreviated 645*912701f9SAndroid Build Coastguard Worker * plus context=standAlone and width=narrow, wide, & abbreviated, _if the grammatical forms of these are different than for context=format._ 646*912701f9SAndroid Build Coastguard Worker 3. week: minDays, firstDay, weekendStart, weekendEnd 647*912701f9SAndroid Build Coastguard Worker * if some of these vary in territories in _Territory-List_, include territory locales for those that do. 648*912701f9SAndroid Build Coastguard Worker 4. am, pm, eraNames, eraAbbr 649*912701f9SAndroid Build Coastguard Worker 5. dateFormat, timeFormat: full, long, medium, short 650*912701f9SAndroid Build Coastguard Worker 6. intervalFormatFallback 651*912701f9SAndroid Build Coastguard Worker 652*912701f9SAndroid Build Coastguard Worker3. numbers: symbols, decimalFormats, scientificFormats, percentFormats, currencyFormats for each number system in _Number-System-List_. 653*912701f9SAndroid Build Coastguard Worker4. currencies: displayNames and symbol for all currencies in _Currency-List_, for all plural forms 654*912701f9SAndroid Build Coastguard Worker5. transforms: (moderate and above) transliteration between Latin and each other script in _Target-Scripts._ 655*912701f9SAndroid Build Coastguard Worker 656*912701f9SAndroid Build Coastguard Worker### <a name="Coverage_Level_Default_Values" href="#Coverage_Level_Default_Values">Default Values</a> 657*912701f9SAndroid Build Coastguard Worker 658*912701f9SAndroid Build Coastguard WorkerItems should _only_ be included if they are not the same as the default, which is: 659*912701f9SAndroid Build Coastguard Worker 660*912701f9SAndroid Build Coastguard Worker* what is in root, if there is something defined there. 661*912701f9SAndroid Build Coastguard Worker* for timezone IDs: the name computed according to _[Appendix J: Time Zone Display Names](tr35.md#Time_Zone_Fallback)_ 662*912701f9SAndroid Build Coastguard Worker* for collation sequence, the UCA DUCET (Default Unicode Collation Element Table), as modified by CLDR. 663*912701f9SAndroid Build Coastguard Worker * however, in that case the locale must be added to the validSubLocale list in [collation/root.xml](https://github.com/unicode-org/cldr/blob/main/common/collation/root.xml). 664*912701f9SAndroid Build Coastguard Worker* for currency symbol, language, territory, script names, variants, keys, types, the internal code identifiers, for example, 665*912701f9SAndroid Build Coastguard Worker * currencies: EUR, USD, JPY, ... 666*912701f9SAndroid Build Coastguard Worker * languages: en, ja, ru, ... 667*912701f9SAndroid Build Coastguard Worker * territories: GB, JP, FR, ... 668*912701f9SAndroid Build Coastguard Worker * scripts: Latn, Thai, ... 669*912701f9SAndroid Build Coastguard Worker * variants: PHONEBOOK, ... 670*912701f9SAndroid Build Coastguard Worker 671*912701f9SAndroid Build Coastguard Worker## <a name="Appendix_Supplemental_Metadata" href="#Appendix_Supplemental_Metadata">Supplemental Metadata</a> 672*912701f9SAndroid Build Coastguard Worker 673*912701f9SAndroid Build Coastguard WorkerNote that this section discusses the `<metadata>` element within the `<supplementalData>` element. For the per-locale metadata used in tests and the Survey Tool, see [10: Locale Metadata Element](#Metadata_Elements). 674*912701f9SAndroid Build Coastguard Worker 675*912701f9SAndroid Build Coastguard WorkerThe supplemental metadata contains information about the CLDR file itself, used to test validity and provide information for locale inheritance. A number of these elements are described in 676*912701f9SAndroid Build Coastguard Worker 677*912701f9SAndroid Build Coastguard Worker* Appendix I: [Inheritance and Validity](tr35.md#Inheritance_and_Validity) 678*912701f9SAndroid Build Coastguard Worker* Appendix K: [Valid Attribute Values](tr35.md#Valid_Attribute_Values) 679*912701f9SAndroid Build Coastguard Worker* Appendix L: [Canonical Form](tr35.md#Canonical_Form) 680*912701f9SAndroid Build Coastguard Worker* Appendix M: [Coverage Levels](#Coverage_Levels) 681*912701f9SAndroid Build Coastguard Worker 682*912701f9SAndroid Build Coastguard Worker### <a name="Supplemental_Alias_Information" href="#Supplemental_Alias_Information">Supplemental Alias Information</a> 683*912701f9SAndroid Build Coastguard Worker 684*912701f9SAndroid Build Coastguard Worker```xml 685*912701f9SAndroid Build Coastguard Worker<!ELEMENT alias (languageAlias*,scriptAlias*,territoryAlias*,subdivisionAlias*,variantAlias*,zoneAlias*) > 686*912701f9SAndroid Build Coastguard Worker``` 687*912701f9SAndroid Build Coastguard Worker 688*912701f9SAndroid Build Coastguard Worker_The following are common attributes for subelements of `<alias>`:_ 689*912701f9SAndroid Build Coastguard Worker 690*912701f9SAndroid Build Coastguard Worker```xml 691*912701f9SAndroid Build Coastguard Worker<!ELEMENT *Alias EMPTY > 692*912701f9SAndroid Build Coastguard Worker<!ATTLIST *Alias type NMTOKEN #IMPLIED > 693*912701f9SAndroid Build Coastguard Worker<!ATTLIST *Alias replacement NMTOKEN #IMPLIED > 694*912701f9SAndroid Build Coastguard Worker<!ATTLIST *Alias reason ( deprecated | overlong ) #IMPLIED > 695*912701f9SAndroid Build Coastguard Worker``` 696*912701f9SAndroid Build Coastguard Worker 697*912701f9SAndroid Build Coastguard Worker_The `languageAlias` has additional reasons_ 698*912701f9SAndroid Build Coastguard Worker 699*912701f9SAndroid Build Coastguard Worker```xml 700*912701f9SAndroid Build Coastguard Worker<!ATTLIST languageAlias reason ( deprecated | overlong | macrolanguage | legacy | bibliographic ) #IMPLIED > 701*912701f9SAndroid Build Coastguard Worker``` 702*912701f9SAndroid Build Coastguard Worker 703*912701f9SAndroid Build Coastguard WorkerThis element provides information as to parts of locale IDs that should be substituted when accessing CLDR data. This logical substitution should be done to both the locale id, and to any lookup for display names of languages, territories, and so on. The replacement for the language and territory types is more complicated: see _Part 1: [Core](tr35.md#Contents), [BCP 47 Language Tag Conversion](tr35.md#BCP_47_Language_Tag_Conversion)_ for details. 704*912701f9SAndroid Build Coastguard Worker 705*912701f9SAndroid Build Coastguard Worker```xml 706*912701f9SAndroid Build Coastguard Worker<alias> 707*912701f9SAndroid Build Coastguard Worker <languageAlias type="in" replacement="id"> 708*912701f9SAndroid Build Coastguard Worker <languageAlias type="sh" replacement="sr"> 709*912701f9SAndroid Build Coastguard Worker <languageAlias type="sh_YU" replacement="sr_Latn_YU"> 710*912701f9SAndroid Build Coastguard Worker ... 711*912701f9SAndroid Build Coastguard Worker <territoryAlias type="BU" replacement="MM"> 712*912701f9SAndroid Build Coastguard Worker ... 713*912701f9SAndroid Build Coastguard Worker</alias> 714*912701f9SAndroid Build Coastguard Worker``` 715*912701f9SAndroid Build Coastguard Worker 716*912701f9SAndroid Build Coastguard WorkerAttribute values for the \*Alias values include the following: 717*912701f9SAndroid Build Coastguard Worker 718*912701f9SAndroid Build Coastguard Worker###### Table: <a name="Alias_Attribute_Values" href="#Alias_Attribute_Values">Alias Attribute Values</a> 719*912701f9SAndroid Build Coastguard Worker 720*912701f9SAndroid Build Coastguard Worker| Attribute | Value | Description | 721*912701f9SAndroid Build Coastguard Worker| ----------- | ------------- | ----------- | 722*912701f9SAndroid Build Coastguard Worker| type | NMTOKEN | The code to be replaced | 723*912701f9SAndroid Build Coastguard Worker| replacement | NMTOKEN | The code(s) to replace it, space-delimited. | 724*912701f9SAndroid Build Coastguard Worker| reason | deprecated | The code in type is deprecated, such as 'iw' by 'he', or 'CS' by 'RS ME'. | 725*912701f9SAndroid Build Coastguard Worker| | overlong | The code in type is too long, such as 'eng' by 'en' or 'USA' or '840' by 'US' | 726*912701f9SAndroid Build Coastguard Worker| | macrolanguage | The code in type is an encompassed language that is replaced by a macrolanguage, such as '[arb'](https://iso639-3.sil.org/code/arb) by 'ar'. | 727*912701f9SAndroid Build Coastguard Worker| | legacy | The code in type is a legacy code that is replaced by another code for compatibility with established legacy usage, such as 'sh' by 'sr_Latn' | 728*912701f9SAndroid Build Coastguard Worker| | bibliographic | The code in type is a [bibliographic code](https://www.loc.gov/standards/iso639-2/langhome.html), which is replaced by a terminology code, such as 'alb' by 'sq'. | 729*912701f9SAndroid Build Coastguard Worker 730*912701f9SAndroid Build Coastguard Worker### ~~<a name="Supplemental_Deprecated_Information" href="#Supplemental_Deprecated_Information">Supplemental Deprecated Information (Deprecated)</a>~~ 731*912701f9SAndroid Build Coastguard Worker 732*912701f9SAndroid Build Coastguard Worker```xml 733*912701f9SAndroid Build Coastguard Worker<!ELEMENT deprecated ( deprecatedItems* ) > 734*912701f9SAndroid Build Coastguard Worker<!ATTLIST deprecated draft ( approved | contributed | provisional | unconfirmed | true | false ) #IMPLIED > <!-- true and false are deprecated. --> 735*912701f9SAndroid Build Coastguard Worker 736*912701f9SAndroid Build Coastguard Worker<!ELEMENT deprecatedItems EMPTY > 737*912701f9SAndroid Build Coastguard Worker<!ATTLIST deprecatedItems type ( standard | supplemental | ldml | supplementalData | ldmlBCP47 ) #IMPLIED > <!-- standard | supplemental are deprecated --> 738*912701f9SAndroid Build Coastguard Worker<!ATTLIST deprecatedItems elements NMTOKENS #IMPLIED > 739*912701f9SAndroid Build Coastguard Worker<!ATTLIST deprecatedItems attributes NMTOKENS #IMPLIED > 740*912701f9SAndroid Build Coastguard Worker<!ATTLIST deprecatedItems values CDATA #IMPLIED > 741*912701f9SAndroid Build Coastguard Worker``` 742*912701f9SAndroid Build Coastguard Worker 743*912701f9SAndroid Build Coastguard WorkerThe `deprecatedItems` element was used to indicate elements, attributes, and attribute values that are deprecated. This means that the items are valid, but that their usage is strongly discouraged. This element and its subelements have been deprecated in favor of [DTD Annotations](tr35.md#DTD_Annotations). 744*912701f9SAndroid Build Coastguard Worker 745*912701f9SAndroid Build Coastguard WorkerWhere particular values are deprecated (such as territory codes like SU for Soviet Union), the names for such codes may be removed from the common/main translated data after some period of time. However, typically supplemental information for deprecated codes is retained, such as containment, likely subtags, older currency codes usage, etc. The English name may also be retained, for debugging purposes. 746*912701f9SAndroid Build Coastguard Worker 747*912701f9SAndroid Build Coastguard Worker### <a name="Default_Content" href="#Default_Content">Default Content</a> 748*912701f9SAndroid Build Coastguard Worker 749*912701f9SAndroid Build Coastguard Worker```xml 750*912701f9SAndroid Build Coastguard Worker<!ELEMENT defaultContent EMPTY > 751*912701f9SAndroid Build Coastguard Worker<!ATTLIST defaultContent locales NMTOKENS #IMPLIED > 752*912701f9SAndroid Build Coastguard Worker``` 753*912701f9SAndroid Build Coastguard Worker 754*912701f9SAndroid Build Coastguard WorkerIn CLDR, locales without territory information (or where needed, script information) provide data appropriate for what is called the _default content locale_. For example, the _en_ locale contains data appropriate for _en-US_, while the _zh_ locale contains content for _zh-Hans-CN_, and the _zh-Hant_ locale contains content for _zh-Hant-TW_. The default content locales themselves thus inherit all of their contents, and are empty. 755*912701f9SAndroid Build Coastguard Worker 756*912701f9SAndroid Build Coastguard WorkerThe choice of content is typically based on the largest literate population of the possible choices. Thus if an implementation only provides the base language (such as _en_), it will still get a complete and consistent set of data appropriate for a locale which is reasonably likely to be the one meant. Where other information is available, such as independent country information, that information can always be used to pick a different locale (such as _en-CA_ for a website targeted at Canadian users). 757*912701f9SAndroid Build Coastguard Worker 758*912701f9SAndroid Build Coastguard WorkerIf an implementation is to use a different default locale, then the data needs to be _pivoted_; all of the data from the CLDR for the current default locale pushed out to the locales that inherit from it, then the new default content locale's data moved into the base. There are tools in CLDR to perform this operation. 759*912701f9SAndroid Build Coastguard Worker 760*912701f9SAndroid Build Coastguard WorkerFor the relationship between Inheritance, DefaultContent, LikelySubtags, and LocaleMatching, see **_[Inheritance vs Related Information](tr35.md#Inheritance_vs_Related)_**. 761*912701f9SAndroid Build Coastguard Worker 762*912701f9SAndroid Build Coastguard Worker## <a name="Metadata_Elements" href="#Metadata_Elements">Locale Metadata Elements</a> 763*912701f9SAndroid Build Coastguard Worker 764*912701f9SAndroid Build Coastguard WorkerNote: This section refers to the per-locale `<metadata>` element, containing metadata about a particular locale. This is in contrast to the [_Supplemental_ Metadata](#Appendix_Supplemental_Metadata), which is in the supplemental tree and is not specific to a locale. 765*912701f9SAndroid Build Coastguard Worker 766*912701f9SAndroid Build Coastguard Worker```xml 767*912701f9SAndroid Build Coastguard Worker<!ELEMENT metadata ( alias | ( casingData?, special* ) ) > 768*912701f9SAndroid Build Coastguard Worker<!ELEMENT casingData ( alias | ( casingItem*, special* ) ) > 769*912701f9SAndroid Build Coastguard Worker<!ELEMENT casingItem ( #PCDATA ) > 770*912701f9SAndroid Build Coastguard Worker<!ATTLIST casingItem type CDATA #REQUIRED > 771*912701f9SAndroid Build Coastguard Worker<!ATTLIST casingItem override (true | false) #IMPLIED > 772*912701f9SAndroid Build Coastguard Worker<!ATTLIST casingItem forceError (true | false) #IMPLIED > 773*912701f9SAndroid Build Coastguard Worker``` 774*912701f9SAndroid Build Coastguard Worker 775*912701f9SAndroid Build Coastguard WorkerThe `<metadata>` element contains metadata about the locale for use by the Survey Tool or other tools in checking locale data; this data is not intended for export as part of the locale itself. 776*912701f9SAndroid Build Coastguard Worker 777*912701f9SAndroid Build Coastguard WorkerThe `<casingItem>` element specifies the capitalization intended for the majority of the data in a given category with the locale. The purpose is so that warnings can be issued to translators that anything deviating from that capitalization should be carefully reviewed. Its `type` attribute has one of the values used for the `<contextTransformUsage>` element above, with the exception of the special value "all"; its value is one of the following: 778*912701f9SAndroid Build Coastguard Worker 779*912701f9SAndroid Build Coastguard Worker* lowercase 780*912701f9SAndroid Build Coastguard Worker* titlecase 781*912701f9SAndroid Build Coastguard Worker 782*912701f9SAndroid Build Coastguard WorkerThe `<casingItem>` data is generated by a tool based on the data available in CLDR. In cases where the generated casing information is incorrect and needs to be manually edited, the `override` attribute is set to `true` so that the tool will not override the manual edits. When the casing information is known to be both correct and something that should apply to all elements of the specified type in a given locale, the `forceErr` attribute may be set to `true` to force an error instead of a warning for items that do not match the casing information. 783*912701f9SAndroid Build Coastguard Worker 784*912701f9SAndroid Build Coastguard Worker## <a name="Version_Information" href="#Version_Information">Version Information</a> 785*912701f9SAndroid Build Coastguard Worker 786*912701f9SAndroid Build Coastguard Worker```xml 787*912701f9SAndroid Build Coastguard Worker<!ELEMENT version EMPTY > 788*912701f9SAndroid Build Coastguard Worker<!ATTLIST version cldrVersion CDATA #FIXED "27" > 789*912701f9SAndroid Build Coastguard Worker<!ATTLIST version unicodeVersion CDATA #FIXED "7.0.0" > 790*912701f9SAndroid Build Coastguard Worker``` 791*912701f9SAndroid Build Coastguard Worker 792*912701f9SAndroid Build Coastguard WorkerThe `cldrVersion` attribute defines the CLDR version for this data, as published on [CLDR Releases/Downloads](https://cldr.unicode.org/index/downloads). 793*912701f9SAndroid Build Coastguard Worker 794*912701f9SAndroid Build Coastguard WorkerThe `unicodeVersion` attribute defines the version of the Unicode standard that is used to interpret data. Specifically, some data elements such as exemplar characters are expressed in terms of UnicodeSets. Since UnicodeSets can be expressed in terms of Unicode properties, their meaning depends on the Unicode version from which property values are derived. 795*912701f9SAndroid Build Coastguard Worker 796*912701f9SAndroid Build Coastguard Worker## <a name="Parent_Locales" href="#Parent_Locales">Parent Locales</a> 797*912701f9SAndroid Build Coastguard Worker 798*912701f9SAndroid Build Coastguard WorkerThe parentLocales data is supplemental data, but is described in detail in the [core specification section 4.1.3.](tr35.md#Parent_Locales) 799*912701f9SAndroid Build Coastguard Worker 800*912701f9SAndroid Build Coastguard Worker## <a name="Unit_Conversion" href="#Unit_Conversion">Unit Conversion</a> 801*912701f9SAndroid Build Coastguard Worker 802*912701f9SAndroid Build Coastguard WorkerThe unit conversion data ([units.xml](https://github.com/unicode-org/cldr/blob/main/common/supplemental/units.xml)) provides the data for converting all of the cldr unit identifiers to base units, and back. That allows conversion between any two convertible units, such as two units of length. For any two convertible units (such as acre and dunum) the first can be converted to the base unit (square-meter), then that base unit can be converted to the second unit. 803*912701f9SAndroid Build Coastguard Worker 804*912701f9SAndroid Build Coastguard Worker### Unit Parsing Data 805*912701f9SAndroid Build Coastguard Worker 806*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitIdComponents ( unitIdComponent* ) > 807*912701f9SAndroid Build Coastguard Worker 808*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitIdComponent EMPTY > 809*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitIdComponent type NMTOKEN #REQUIRED > 810*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitIdComponent values NMTOKENS #REQUIRED > 811*912701f9SAndroid Build Coastguard Worker 812*912701f9SAndroid Build Coastguard WorkerThese elements provide support for parsing unit identifiers, as described in [Unit Elements](tr35-general.md#Unit_Elements). 813*912701f9SAndroid Build Coastguard WorkerEach of the values has tokens with specific functions, identified by the type. 814*912701f9SAndroid Build Coastguard WorkerFor example the following values can be suffixes in a simple_unit identifier such as `quart-imperial`. 815*912701f9SAndroid Build Coastguard Worker 816*912701f9SAndroid Build Coastguard Worker``` 817*912701f9SAndroid Build Coastguard Worker<unitIdComponent type="suffix" values="force imperial luminosity mass metric person radius scandinavian troy unit us"/> 818*912701f9SAndroid Build Coastguard Worker```` 819*912701f9SAndroid Build Coastguard Worker 820*912701f9SAndroid Build Coastguard Worker### Unit Prefixes 821*912701f9SAndroid Build Coastguard Worker```xml 822*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitPrefixes ( unitPrefix* ) > 823*912701f9SAndroid Build Coastguard Worker 824*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitPrefix EMPTY > 825*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPrefix type NMTOKEN #REQUIRED > 826*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPrefix symbol NMTOKEN #REQUIRED > 827*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPrefix power10 NMTOKEN #IMPLIED > 828*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPrefix power2 NMTOKEN #IMPLIED > 829*912701f9SAndroid Build Coastguard Worker``` 830*912701f9SAndroid Build Coastguard Worker 831*912701f9SAndroid Build Coastguard WorkerThis data lists the SI prefixes that can be applied to units (typically limited to prefixable units), 832*912701f9SAndroid Build Coastguard Workersuch as the following: 833*912701f9SAndroid Build Coastguard Worker```xml 834*912701f9SAndroid Build Coastguard Worker<unitPrefixes> 835*912701f9SAndroid Build Coastguard Worker <unitPrefix type='quecto' symbol='q' power10='-30'/> 836*912701f9SAndroid Build Coastguard Worker... 837*912701f9SAndroid Build Coastguard Worker <unitPrefix type='micro' symbol='μ' power10='-6'/> 838*912701f9SAndroid Build Coastguard Worker... 839*912701f9SAndroid Build Coastguard Worker <unitPrefix type='giga' symbol='G' power10='9'/> 840*912701f9SAndroid Build Coastguard Worker... 841*912701f9SAndroid Build Coastguard Worker <unitPrefix type='quetta' symbol='Q' power10='30'/> 842*912701f9SAndroid Build Coastguard Worker <unitPrefix type='kibi' symbol='Ki' power2='10'/> 843*912701f9SAndroid Build Coastguard Worker... 844*912701f9SAndroid Build Coastguard Worker <unitPrefix type='yobi' symbol='Yi' power2='80'/> 845*912701f9SAndroid Build Coastguard Worker</unitPrefixes> 846*912701f9SAndroid Build Coastguard Worker``` 847*912701f9SAndroid Build Coastguard WorkerThe information includes the SI prefix and symbol, and the power of 10 or power of 2 848*912701f9SAndroid Build Coastguard Worker(for binary prefixes, intended for use with digital units). 849*912701f9SAndroid Build Coastguard Worker 850*912701f9SAndroid Build Coastguard WorkerNote that the translated short form of a unit prefix is not the same as the localized symbol. 851*912701f9SAndroid Build Coastguard WorkerThe localized symbol may be the same for most Latin-script languages, 852*912701f9SAndroid Build Coastguard Workerbut depending on the customary use in a language they can be in a different script 853*912701f9SAndroid Build Coastguard Workeror use different letters even in Latin-script languages. They are, however, the same in the root locale. 854*912701f9SAndroid Build Coastguard Worker 855*912701f9SAndroid Build Coastguard WorkerThe newer prefixes (quecto-, ronto-, -ronna, -quetta) are not yet being translated, 856*912701f9SAndroid Build Coastguard Workerbecause the appropriate translated versions have not yet been well established across languages. 857*912701f9SAndroid Build Coastguard Worker 858*912701f9SAndroid Build Coastguard Worker### Constants 859*912701f9SAndroid Build Coastguard Worker 860*912701f9SAndroid Build Coastguard Worker 861*912701f9SAndroid Build Coastguard Worker```xml 862*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitConstants ( unitConstant* ) > 863*912701f9SAndroid Build Coastguard Worker 864*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitConstant EMPTY > 865*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitConstant constant NMTOKEN #REQUIRED > 866*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitConstant value CDATA #REQUIRED > 867*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitConstant status NMTOKEN #IMPLIED > 868*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitConstant description CDATA #IMPLIED > 869*912701f9SAndroid Build Coastguard Worker``` 870*912701f9SAndroid Build Coastguard Worker 871*912701f9SAndroid Build Coastguard WorkerMany of the elements allow for a common @description attribute, to disambiguate the main attribute value or to explain the choice of other values. For example: 872*912701f9SAndroid Build Coastguard Worker```xml 873*912701f9SAndroid Build Coastguard Worker<unitConstant constant="glucose_molar_mass" value="180.1557" 874*912701f9SAndroid Build Coastguard Worker description="derivation from the mean atomic weights according to STANDARD ATOMIC WEIGHTS 2019 on https://ciaaw.org/atomic-weights.htm"/> 875*912701f9SAndroid Build Coastguard Worker``` 876*912701f9SAndroid Build Coastguard Worker 877*912701f9SAndroid Build Coastguard WorkerThe data uses a small set of constants for readability, such as: 878*912701f9SAndroid Build Coastguard Worker 879*912701f9SAndroid Build Coastguard Worker```xml 880*912701f9SAndroid Build Coastguard Worker<unitConstant constant="ft_to_m" value="0.3048" /> 881*912701f9SAndroid Build Coastguard Worker<unitConstant constant="ft2_to_m2" value="ft_to_m*ft_to_m" /> 882*912701f9SAndroid Build Coastguard Worker``` 883*912701f9SAndroid Build Coastguard WorkerThe order of the elements in the file is significant. 884*912701f9SAndroid Build Coastguard Worker 885*912701f9SAndroid Build Coastguard WorkerEach constant can have a value based on simple expressions using numbers, previous constants, plus the operators * and /. Parentheses are not allowed. The operator * binds more tightly than /, which may be unexpected. Thus a * b / c * d is interpreted as (a * b) / (c * d). A consequence of that is that a * b / c * d = a * b / c / d. In the value, the numbers represent rational values. So 0.3048 is interpreted as exactly 3048 / 10000. 886*912701f9SAndroid Build Coastguard Worker 887*912701f9SAndroid Build Coastguard WorkerIn the above case, ft2-to-m2 is a conversion constant for going from square feet to square meters. The expression evaluates to 0.09290304. Where the constants cannot be expressed as rationals, or where their interpretation is fluid, that is marked with a status value: 888*912701f9SAndroid Build Coastguard Worker 889*912701f9SAndroid Build Coastguard Worker```xml 890*912701f9SAndroid Build Coastguard Worker<unitConstant constant="PI" value="411557987 / 131002976" status='approximate' /> 891*912701f9SAndroid Build Coastguard Worker``` 892*912701f9SAndroid Build Coastguard Worker 893*912701f9SAndroid Build Coastguard WorkerIn such cases, software may decide to use different values for accuracy. 894*912701f9SAndroid Build Coastguard Worker 895*912701f9SAndroid Build Coastguard WorkerAn implementation need not use rationals directly for conversion; it could use doubles, for example, if only double accuracy is needed. 896*912701f9SAndroid Build Coastguard Worker 897*912701f9SAndroid Build Coastguard Worker### Conversion Data 898*912701f9SAndroid Build Coastguard Worker 899*912701f9SAndroid Build Coastguard Worker```xml 900*912701f9SAndroid Build Coastguard Worker<!ELEMENT convertUnits ( convertUnit* ) > 901*912701f9SAndroid Build Coastguard Worker 902*912701f9SAndroid Build Coastguard Worker<!ELEMENT convertUnit EMPTY > 903*912701f9SAndroid Build Coastguard Worker 904*912701f9SAndroid Build Coastguard Worker<!ATTLIST convertUnit source NMTOKEN #REQUIRED > 905*912701f9SAndroid Build Coastguard Worker 906*912701f9SAndroid Build Coastguard Worker<!ATTLIST convertUnit baseUnit NMTOKEN #REQUIRED > 907*912701f9SAndroid Build Coastguard Worker 908*912701f9SAndroid Build Coastguard Worker<!ATTLIST convertUnit factor CDATA #IMPLIED > 909*912701f9SAndroid Build Coastguard Worker 910*912701f9SAndroid Build Coastguard Worker<!ATTLIST convertUnit offset CDATA #IMPLIED > 911*912701f9SAndroid Build Coastguard Worker 912*912701f9SAndroid Build Coastguard Worker<!ATTLIST convertUnit special NMTOKEN #IMPLIED > 913*912701f9SAndroid Build Coastguard Worker 914*912701f9SAndroid Build Coastguard Worker<!ATTLIST convertUnit systems NMTOKENS #IMPLIED > 915*912701f9SAndroid Build Coastguard Worker 916*912701f9SAndroid Build Coastguard Worker<!ATTLIST convertUnit description CDATA #IMPLIED > 917*912701f9SAndroid Build Coastguard Worker``` 918*912701f9SAndroid Build Coastguard Worker 919*912701f9SAndroid Build Coastguard WorkerThe conversion data provides the data for converting all of the cldr unit identifiers to base units, and back. That allows conversion between any two convertible units, such as two units of length. For any two convertible units (such as acre and dunum) the first can be converted to the base unit (square-meter), then that base unit can be converted to the second unit. 920*912701f9SAndroid Build Coastguard Worker 921*912701f9SAndroid Build Coastguard WorkerThe data is expressed as conversions to the base unit from the source unit. The information can also be used for the conversion back. 922*912701f9SAndroid Build Coastguard Worker 923*912701f9SAndroid Build Coastguard WorkerExamples: 924*912701f9SAndroid Build Coastguard Worker 925*912701f9SAndroid Build Coastguard Worker```xml 926*912701f9SAndroid Build Coastguard Worker<convertUnit source='carat' baseUnit='kilogram' factor='0.0002'/> 927*912701f9SAndroid Build Coastguard Worker 928*912701f9SAndroid Build Coastguard Worker<convertUnit source='gram' baseUnit='kilogram' factor='0.001'/> 929*912701f9SAndroid Build Coastguard Worker 930*912701f9SAndroid Build Coastguard Worker<convertUnit source='ounce' baseUnit='kilogram' factor='lb_to_kg/16' systems="ussystem uksystem"/> 931*912701f9SAndroid Build Coastguard Worker 932*912701f9SAndroid Build Coastguard Worker<convertUnit source='fahrenheit' baseUnit='kelvin' factor='5/9' offset='2298.35/9' systems="ussystem uksystem"/> 933*912701f9SAndroid Build Coastguard Worker``` 934*912701f9SAndroid Build Coastguard Worker 935*912701f9SAndroid Build Coastguard WorkerFor example, to convert from 3 carats to kilograms, the factor 0.0002 is used, resulting in 0.0006. To convert between carats and ounces, first the carets are converted to kilograms, then the kilograms to ounces (by reversing the mapping). 936*912701f9SAndroid Build Coastguard Worker 937*912701f9SAndroid Build Coastguard WorkerThe factor and offset use the same structure as in the value in unitConstant; in particular, * binds more tightly than /. 938*912701f9SAndroid Build Coastguard Worker 939*912701f9SAndroid Build Coastguard WorkerThe conversion may also require an offset, such as the following: 940*912701f9SAndroid Build Coastguard Worker 941*912701f9SAndroid Build Coastguard Worker```xml 942*912701f9SAndroid Build Coastguard Worker<convertUnit source='fahrenheit' baseUnit='kelvin' factor='5/9' offset='2298.35/9' systems="ussystem uksystem"/> 943*912701f9SAndroid Build Coastguard Worker``` 944*912701f9SAndroid Build Coastguard Worker 945*912701f9SAndroid Build Coastguard WorkerThe factor and offset can be simple expressions, just like the values in the unitConstants. 946*912701f9SAndroid Build Coastguard Worker 947*912701f9SAndroid Build Coastguard WorkerWhere a factor is not present, the value is 1; where an offset is not present, the value is 0. 948*912701f9SAndroid Build Coastguard Worker 949*912701f9SAndroid Build Coastguard WorkerInstead of using `factor` and possibly `offset`, the `convertUnit` element can specify a `special` conversion that cannot be described by factor and offset (and this attribute cannot be used in conunction with factor and offset). For example: 950*912701f9SAndroid Build Coastguard Worker 951*912701f9SAndroid Build Coastguard Worker```xml 952*912701f9SAndroid Build Coastguard Worker<convertUnit source='beaufort' baseUnit='meter-per-second' special='beaufort' systems="metric_adjacent"/> 953*912701f9SAndroid Build Coastguard Worker``` 954*912701f9SAndroid Build Coastguard Worker 955*912701f9SAndroid Build Coastguard WorkerThe only `special` conversion currently supported is for beaufort. 956*912701f9SAndroid Build Coastguard Worker 957*912701f9SAndroid Build Coastguard WorkerThe `systems` attribute indicates the measurement system(s) or other characteristics of a set of unts. Multiple values may be given; for example, a unit could be marked as systems="`si_acceptable` `metric_adjacent` `prefixable`". 958*912701f9SAndroid Build Coastguard Worker 959*912701f9SAndroid Build Coastguard WorkerThe allowed attributes are the following: 960*912701f9SAndroid Build Coastguard Worker 961*912701f9SAndroid Build Coastguard WorkerAttribute Value | Description 962*912701f9SAndroid Build Coastguard Worker------------ | ------------- 963*912701f9SAndroid Build Coastguard Worker`si` | The _International System of Units (SI)_ See [NIST Guide to the SI, Chapter 4: The Two Classes of SI Units and the SI Prefixes](https://www.nist.gov/pml/special-publication-811/nist-guide-si-chapter-4-two-classes-si-units-and-si-prefixes). Examples: meter, ampere. 964*912701f9SAndroid Build Coastguard Worker`si_acceptable` | Units acceptable for use with the SI. See [NIST Guide to the SI, Chapter 5: Units Outside the SI](https://www.nist.gov/pml/special-publication-811/nist-guide-si-chapter-5-units-outside-si). Examples: hour, liter, knot, hectare. 965*912701f9SAndroid Build Coastguard Worker`metric` | A superset of the _si_ units 966*912701f9SAndroid Build Coastguard Worker`metric_adjacent` | Units commonly accepted in some countries that follow the metric system. Examples: month, arc-second, pound-metric (= ½ kilogram), mile-scandinavian. 967*912701f9SAndroid Build Coastguard Worker`ussystem` | The inch-pound system as used in the US, also called _US Customary Units_. 968*912701f9SAndroid Build Coastguard Worker`uksystem` | The inch-pound system as used in the UK, also called _British Imperial Units_, differing mostly in units of volume 969*912701f9SAndroid Build Coastguard Worker`jpsystem` | Traditional units used in Japan. For examples, see [Japanese units of measurement](https://en.wikipedia.org/wiki/Japanese_units_of_measurement). 970*912701f9SAndroid Build Coastguard Worker`astronomical` | Additional units used in astronomy. Examples: parsec, light-year, earth-mass 971*912701f9SAndroid Build Coastguard Worker`person_age` | Special units used for people’s ages in some languages. Except for translation, they have the same system as the associated regular units. 972*912701f9SAndroid Build Coastguard Worker`currency` | Currency units. These are constructed algorithmically from the Unicode currency identifiers, and do not occur in the child elements of `convertUnits`. Examples: curr-usd (US dollar), curr-eur (Euro). 973*912701f9SAndroid Build Coastguard Worker`prefixable` | Those units that typically use SI prefixes or the [IEC binary prefixes](https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-d-bibliography#05). This can include measures like `parsec` that are not SI units. It allows implementations to group those units together, and to do sanity checks on the prefix+unit combinations, if they choose. However, implementations may choose to allow prefixes on other units, especially since there is a significant variance in usage: even a term like `megafoot` might be acceptable in some contexts. 974*912701f9SAndroid Build Coastguard Worker 975*912701f9SAndroid Build Coastguard WorkerOver time, additional systems may be added, and the systems for a particular unit may be refined. 976*912701f9SAndroid Build Coastguard Worker 977*912701f9SAndroid Build Coastguard Worker#### Derived Unit System 978*912701f9SAndroid Build Coastguard Worker 979*912701f9SAndroid Build Coastguard WorkerThe systems attributes also apply to compound units, and are computed in the following way. 980*912701f9SAndroid Build Coastguard Worker 981*912701f9SAndroid Build Coastguard Worker1. The `prefixable` system is only applicable to base_components, and is thus removed 982*912701f9SAndroid Build Coastguard Worker2. The `number_prefixes`, `dimensionality_prefix`, `si_prefix`, and `binary_prefix` are ignored 983*912701f9SAndroid Build Coastguard Worker * Example: systems(square-kilometer) = systems(meter) 984*912701f9SAndroid Build Coastguard Worker3. Currency units have the `currency` system 985*912701f9SAndroid Build Coastguard Worker * Example: systems(curr-usd) = {currency} 986*912701f9SAndroid Build Coastguard Worker4. Units linked by `-and-`, `-per-`, and *adjacency* are resolved using a modified intersection, where: 987*912701f9SAndroid Build Coastguard Worker 1. The intersection of {… si …} and {… si_acceptable … } is {… si_acceptable …} 988*912701f9SAndroid Build Coastguard Worker 2. The intersection of {… metric …} and {… metric_adjacent … } is {… metric_adjacent …} 989*912701f9SAndroid Build Coastguard Worker 990*912701f9SAndroid Build Coastguard WorkerExamples: 991*912701f9SAndroid Build Coastguard Worker``` 992*912701f9SAndroid Build Coastguard Workersystems(liter-per-hectare) 993*912701f9SAndroid Build Coastguard Worker = {si_acceptable metric} ∪ {si_acceptable metric} 994*912701f9SAndroid Build Coastguard Worker = {si_acceptable metric} 995*912701f9SAndroid Build Coastguard Workersystems(meter-per-hectare) 996*912701f9SAndroid Build Coastguard Worker = {si metric} ∩ {si_acceptable metric} 997*912701f9SAndroid Build Coastguard Worker = {si_acceptable metric} 998*912701f9SAndroid Build Coastguard Workersystems(mile-scandinavian-per-hour) 999*912701f9SAndroid Build Coastguard Worker = {metric_adjacent} ∩ {si_acceptable metric_adjacent} 1000*912701f9SAndroid Build Coastguard Worker = {metric_adjacent} 1001*912701f9SAndroid Build Coastguard Worker``` 1002*912701f9SAndroid Build Coastguard Worker 1003*912701f9SAndroid Build Coastguard Worker#### Conversion Mechanisms 1004*912701f9SAndroid Build Coastguard Worker 1005*912701f9SAndroid Build Coastguard WorkerCLDR follows conversion values where possible from: 1006*912701f9SAndroid Build Coastguard Worker* [NIST Special Publication 1038](https://www.govinfo.gov/content/pkg/GOVPUB-C13-f10c2ff9e7af2091314396a2d53213e4/pdf/GOVPUB-C13-f10c2ff9e7af2091314396a2d53213e4.pdf) 1007*912701f9SAndroid Build Coastguard Worker* [International Astronomical Union General Assembly](https://arxiv.org/pdf/1510.07674.pdf) 1008*912701f9SAndroid Build Coastguard Worker 1009*912701f9SAndroid Build Coastguard WorkerSee also [NIST Guide to the SI, Chapter 4: The Two Classes of SI Units and the SI Prefixes](https://www.nist.gov/pml/special-publication-811/nist-guide-si-chapter-4-two-classes-si-units-and-si-prefixes) 1010*912701f9SAndroid Build Coastguard Worker 1011*912701f9SAndroid Build Coastguard WorkerFor complex units, such as _pound-force-per-square-inch_, the conversions are computed by combining the conversions of each of the simple units: _pound-force_ and _inch_. Because the conversions in convertUnit are reversible, the computation can go from complex source unit to complex base unit to complex target units. 1012*912701f9SAndroid Build Coastguard Worker 1013*912701f9SAndroid Build Coastguard WorkerHere is an example: 1014*912701f9SAndroid Build Coastguard Worker 1015*912701f9SAndroid Build Coastguard Worker> **50 foot-per-minute ⟹ X mile-per-hour** 1016*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 foot 1017*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 381 / 1250 = 0.3048 meter 1018*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 minute 1019*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 60 second 1020*912701f9SAndroid Build Coastguard Worker> ⟹ intermediate: 127 / 500 = 0.254 meter-per-second 1021*912701f9SAndroid Build Coastguard Worker> ⟹ mile-per-hour 1022*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 mile 1023*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 201168 / 125 = 1609.344 meter 1024*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 hour 1025*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 3600 second 1026*912701f9SAndroid Build Coastguard Worker> ⟹ target: 25 / 44 ≅ 0.5681818 mile-per-hour 1027*912701f9SAndroid Build Coastguard Worker 1028*912701f9SAndroid Build Coastguard Worker**Reciprocals.** When you convert a complex unit to another complex unit, you typically convert the source to a complex base unit (like _meter-per-cubic-meter_), then convert the latter backwards to the desired target. However, there may not be a matching conversion from that complex base unit to the desired target unit. That is the case for converting from _mile-per-gallon_ (used in the US) to _liter-per-100-kilometer_ (used in Europe and elsewhere). When that happens, the reciprocal of the complex base unit is used, as in the following example: 1029*912701f9SAndroid Build Coastguard Worker 1030*912701f9SAndroid Build Coastguard Worker> **50 mile-per-gallon ⟹ X liter-per-100-kilometer** 1031*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 mile 1032*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 201168 / 125 = 1609.344 meter 1033*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 gallon 1034*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 473176473 / 125000000000 ≅ 0.003785412 cubic-meter 1035*912701f9SAndroid Build Coastguard Worker> ⟹ intermediate: 2400000000000 / 112903 ≅ 2.125719E7 meter-per-cubic-meter 1036*912701f9SAndroid Build Coastguard Worker> ⟹ liter-per-100-kilometer 1037*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 liter 1038*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 1 / 1000 = 0.001 cubic-meter 1039*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 100-kilometer 1040*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 100000 meter 1041*912701f9SAndroid Build Coastguard Worker> **⟹ 1/intermediate: 112903 / 2400000000000 ≅ 4.704292E-8 cubic-meter-per-meter** 1042*912701f9SAndroid Build Coastguard Worker> ⟹ target: 112903 / 24000 ≅ 4.704292 liter-per-100-kilometer 1043*912701f9SAndroid Build Coastguard Worker 1044*912701f9SAndroid Build Coastguard WorkerThis applies to more than just these cases: one can convert from any unit to related reciprocals as in the following example: 1045*912701f9SAndroid Build Coastguard Worker 1046*912701f9SAndroid Build Coastguard Worker> **50 foot-per-minute ⟹ X hour-per-mile** 1047*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 foot 1048*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 381 / 1250 = 0.3048 meter 1049*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 minute 1050*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 60 second 1051*912701f9SAndroid Build Coastguard Worker> ⟹ intermediate: 127 / 500 = 0.254 meter-per-second 1052*912701f9SAndroid Build Coastguard Worker> ⟹ hour-per-mile 1053*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 hour 1054*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 3600 second 1055*912701f9SAndroid Build Coastguard Worker> ⟹ source: 1 mile 1056*912701f9SAndroid Build Coastguard Worker> ⟹ factor: 201168 / 125 = 1609.344 meter 1057*912701f9SAndroid Build Coastguard Worker> **⟹ 1/intermediate: 500 / 127 ≅ 3.937008 second-per-meter** 1058*912701f9SAndroid Build Coastguard Worker> ⟹ target: 44 / 25 = 1.76 hour-per-mile 1059*912701f9SAndroid Build Coastguard Worker 1060*912701f9SAndroid Build Coastguard Worker#### Exceptional Cases 1061*912701f9SAndroid Build Coastguard Worker 1062*912701f9SAndroid Build Coastguard Worker##### Identities 1063*912701f9SAndroid Build Coastguard Worker 1064*912701f9SAndroid Build Coastguard WorkerFor completeness, identity mappings are also provided for the base units themselves, such as: 1065*912701f9SAndroid Build Coastguard Worker 1066*912701f9SAndroid Build Coastguard Worker```xml 1067*912701f9SAndroid Build Coastguard Worker<convertUnit source='meter' baseUnit='meter' /> 1068*912701f9SAndroid Build Coastguard Worker``` 1069*912701f9SAndroid Build Coastguard Worker 1070*912701f9SAndroid Build Coastguard Worker##### Aliases 1071*912701f9SAndroid Build Coastguard Worker 1072*912701f9SAndroid Build Coastguard WorkerIn a few instances the old identifiers are deprecated in favor of regular syntax. Implementations should handle both on input: 1073*912701f9SAndroid Build Coastguard Worker 1074*912701f9SAndroid Build Coastguard Worker```xml 1075*912701f9SAndroid Build Coastguard Worker<unitAlias type="meter-per-second-squared" replacement="meter-per-square-second" reason="deprecated"/> 1076*912701f9SAndroid Build Coastguard Worker<unitAlias type="liter-per-100kilometers" replacement="liter-per-100-kilometer" reason="deprecated"/> 1077*912701f9SAndroid Build Coastguard Worker<unitAlias type="pound-foot" replacement="pound-force-foot" reason="deprecated"/> 1078*912701f9SAndroid Build Coastguard Worker<unitAlias type="pound-per-square-inch" replacement="pound-force-per-square-inch" reason="deprecated"/> 1079*912701f9SAndroid Build Coastguard Worker``` 1080*912701f9SAndroid Build Coastguard Worker 1081*912701f9SAndroid Build Coastguard WorkerThese use the standard alias elements in XML, and are also included in the [units.xml](https://github.com/unicode-org/cldr/blob/main/common/supplemental/units.xml) file. 1082*912701f9SAndroid Build Coastguard Worker 1083*912701f9SAndroid Build Coastguard Worker##### “Duplicate” Units 1084*912701f9SAndroid Build Coastguard Worker 1085*912701f9SAndroid Build Coastguard WorkerSome CLDR units are provided simply because they have different names in some languages. For example, year and year-person, or foodcalorie and kilocalorie. One CLDR unit is not convertible (temperature-generic), it is only used for the translation (where the exact unit would be understood by context). 1086*912701f9SAndroid Build Coastguard Worker 1087*912701f9SAndroid Build Coastguard Worker##### Discarding Offsets 1088*912701f9SAndroid Build Coastguard Worker 1089*912701f9SAndroid Build Coastguard WorkerThe temperature units are special. When they represent a scale, they have an offset. But where they represent an amount, such as in complex units, they do not. So celsius-per-second is the same as kelvin-per-second. 1090*912701f9SAndroid Build Coastguard Worker 1091*912701f9SAndroid Build Coastguard Worker#### Unresolved Units 1092*912701f9SAndroid Build Coastguard Worker 1093*912701f9SAndroid Build Coastguard WorkerSome SI units contain the same units in the numerator and denominator, so those cannot be resolved. For example, if cubic-meter-per-meter were always resolved, then _consumption_ (like “liter-per-kilometer”) could not be distinguished from _area_ (square-meter). 1094*912701f9SAndroid Build Coastguard Worker 1095*912701f9SAndroid Build Coastguard WorkerHowever, in conversion, it may be necessary to resolve them in order to find a match. For example, kilowatt-hour maps to the base unit kilogram-square-meter-second-per-cubic-second, but that needs to be resolved to kilogram-square-meter-per-square-second in order matched against an _energy._ 1096*912701f9SAndroid Build Coastguard Worker 1097*912701f9SAndroid Build Coastguard Worker## Quantities and Base Units 1098*912701f9SAndroid Build Coastguard Worker 1099*912701f9SAndroid Build Coastguard Worker```xml 1100*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitQuantities ( unitQuantity* ) > 1101*912701f9SAndroid Build Coastguard Worker 1102*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitQuantity EMPTY > 1103*912701f9SAndroid Build Coastguard Worker 1104*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitQuantity baseUnit NMTOKEN #REQUIRED > 1105*912701f9SAndroid Build Coastguard Worker 1106*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitQuantity quantity NMTOKENS #REQUIRED > 1107*912701f9SAndroid Build Coastguard Worker 1108*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitQuantity status NMTOKEN #IMPLIED > 1109*912701f9SAndroid Build Coastguard Worker 1110*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitQuantity description CDATA #IMPLIED > 1111*912701f9SAndroid Build Coastguard Worker``` 1112*912701f9SAndroid Build Coastguard Worker 1113*912701f9SAndroid Build Coastguard WorkerConversion is supported between comparable units. Those can be simple units, such as length, or more complex ‘derived’ units that are built up from _base units_. The `<unitQuantities>` element provides information on the base units used for conversion. It also supplies information about their _quantity_: mass, length, time, etc., and whether they are simple or not. 1114*912701f9SAndroid Build Coastguard Worker 1115*912701f9SAndroid Build Coastguard WorkerExamples: 1116*912701f9SAndroid Build Coastguard Worker 1117*912701f9SAndroid Build Coastguard Worker```xml 1118*912701f9SAndroid Build Coastguard Worker<unitQuantity baseUnit='kilogram' quantity='mass' status='simple'/> 1119*912701f9SAndroid Build Coastguard Worker<unitQuantity baseUnit='meter-per-second' quantity='speed'/> 1120*912701f9SAndroid Build Coastguard Worker``` 1121*912701f9SAndroid Build Coastguard Worker 1122*912701f9SAndroid Build Coastguard WorkerThe order of the elements in the file is significant, since it is used in [Unit_Identifier_Normalization](#Unit_Identifier_Normalization). 1123*912701f9SAndroid Build Coastguard Worker 1124*912701f9SAndroid Build Coastguard WorkerThe quantity values themselves are informative. For example, _force per area_ can be referenced as either _pressure_ or _stress_. The quantity for a complex unit that has a reciprocal is formed by prepending “inverse-” to the quantity, such as _inverse-consumption._ 1125*912701f9SAndroid Build Coastguard Worker 1126*912701f9SAndroid Build Coastguard WorkerThe base units for the quantities and the quantities themselves are based on [NIST Special Publication 811](https://www.nist.gov/pml/special-publication-811) and the earlier [NIST Special Publication 1038](https://www.govinfo.gov/content/pkg/GOVPUB-C13-f10c2ff9e7af2091314396a2d53213e4/pdf/GOVPUB-C13-f10c2ff9e7af2091314396a2d53213e4.pdf). In some cases, a different unit is chosen for the base. For example, a _revolution_ (360°) is chosen for the base unit for angles instead of the SI _radian_, and _item_ instead of the SI _mole_. Additional base units are added where necessary, such as _bit_ and _pixel_. 1127*912701f9SAndroid Build Coastguard Worker 1128*912701f9SAndroid Build Coastguard WorkerThis data is not necessary for conversion, but is needed for [Unit_Identifier_Normalization](#Unit_Identifier_Normalization). Some of the `unitQuantity` elements are not needed to convert CLDR units, but are included for completeness. Example: 1129*912701f9SAndroid Build Coastguard Worker 1130*912701f9SAndroid Build Coastguard Worker```xml 1131*912701f9SAndroid Build Coastguard Worker<unitQuantity baseUnit='ampere-per-square-meter' quantity='current-density'/> 1132*912701f9SAndroid Build Coastguard Worker``` 1133*912701f9SAndroid Build Coastguard Worker 1134*912701f9SAndroid Build Coastguard Worker### UnitType vs Quantity 1135*912701f9SAndroid Build Coastguard Worker 1136*912701f9SAndroid Build Coastguard WorkerThe unitType (as in “length-meter”) is not the same as the quantity. It is often broader: for example, the unitType _electric_ corresponds to the quantities _electric-current, electric-resistance,_ and _voltage_. The unitType itself is also informative, and can be dropped from a long unit identifier to get a still-unique short unit identifier. 1137*912701f9SAndroid Build Coastguard Worker 1138*912701f9SAndroid Build Coastguard Worker### <a name="Unit_Identifier_Normalization" href="#Unit_Identifier_Normalization">Unit Identifier Normalization</a> 1139*912701f9SAndroid Build Coastguard Worker 1140*912701f9SAndroid Build Coastguard WorkerThere are many possible ways to construct complex units. For comparison of unit identifiers, an implementation can normalize in the following way: 1141*912701f9SAndroid Build Coastguard Worker 1142*912701f9SAndroid Build Coastguard Worker1. Convert all but the first -per- to simple multiplication. The result then has the format of /numerator ( -per- denominator)?/ 1143*912701f9SAndroid Build Coastguard Worker * foot-per-second-per-second ⇒ foot-per-second-second 1144*912701f9SAndroid Build Coastguard Worker2. Within each of the numerator and denominator: 1145*912701f9SAndroid Build Coastguard Worker3. Convert multiple instances of a unit into the appropriate power. 1146*912701f9SAndroid Build Coastguard Worker * foot-per-second-second ⇒ foot-per-square-second 1147*912701f9SAndroid Build Coastguard Worker * kilogram-meter-kilogram ⇒ meter-square-kilogram 1148*912701f9SAndroid Build Coastguard Worker4. For each single unit, disregarding prefixes and powers, get the order of the _simple_ unit among the `unitQuantity` elements in the [units.xml](https://github.com/unicode-org/cldr/blob/main/common/supplemental/units.xml). Sort the single units by that order, using a stable sort. If there are private-use single units, sort them after all the non-private use single units. 1149*912701f9SAndroid Build Coastguard Worker * meter-square-kilogram => square-kilogram-meter 1150*912701f9SAndroid Build Coastguard Worker * meter-square-gram ⇒ square-gram-meter 1151*912701f9SAndroid Build Coastguard Worker5. As an edge case, there could be two adjacent single units with the same _simple_ unit but different prefixes, such as _meter-kilometer_. In that case, sort the larger prefixes first, such as _kilometer-meter_ or _kibibyte-kilobyte_. 1152*912701f9SAndroid Build Coastguard Worker6. Within private-use single units, sort by the simple unit alphabetically. 1153*912701f9SAndroid Build Coastguard Worker 1154*912701f9SAndroid Build Coastguard WorkerThe examples in #4 are due to the following ordering of the `unitQuantity` elements: 1155*912701f9SAndroid Build Coastguard Worker 1156*912701f9SAndroid Build Coastguard Worker```xml 1157*912701f9SAndroid Build Coastguard Worker1. <unitQuantity baseUnit='candela' quantity='luminous-intensity' status='simple'/> 1158*912701f9SAndroid Build Coastguard Worker2. <unitQuantity baseUnit='kilogram' quantity='mass' status='simple'/> 1159*912701f9SAndroid Build Coastguard Worker3. <unitQuantity baseUnit='meter' quantity='length' status='simple'/> 1160*912701f9SAndroid Build Coastguard Worker4. … 1161*912701f9SAndroid Build Coastguard Worker``` 1162*912701f9SAndroid Build Coastguard Worker 1163*912701f9SAndroid Build Coastguard Worker## Mixed Units 1164*912701f9SAndroid Build Coastguard Worker 1165*912701f9SAndroid Build Coastguard WorkerMixed units, or unit sequences, are units with the same base unit which are listed in sequence. 1166*912701f9SAndroid Build Coastguard WorkerCommon examples are feet and inches; meters and centimeters; hours, minutes, and seconds; degrees, minutes, and seconds. 1167*912701f9SAndroid Build Coastguard WorkerMixed unit identifiers are expressed using the "-and-" infix, as in "foot-and-inch", "meter-and-centimeter", "hour-and-minute-and-second", "degree-and-arc-minute-and-arc-second." 1168*912701f9SAndroid Build Coastguard Worker 1169*912701f9SAndroid Build Coastguard WorkerScalar values for mixed units are expressed in the largest unit, according to the sort order discussed above in "Normalization". 1170*912701f9SAndroid Build Coastguard WorkerFor example, numbers for "foot-and-inch" are expressed in feet. 1171*912701f9SAndroid Build Coastguard Worker 1172*912701f9SAndroid Build Coastguard WorkerMixed unit identifiers should be from highest to lowest (eg foot-and-inch instead of inch-and-foot), and that is reflected in the display. 1173*912701f9SAndroid Build Coastguard WorkerIf it turns out that some locales present certain mixed units in a different order, additional structure will be needed in CLDR. 1174*912701f9SAndroid Build Coastguard Worker 1175*912701f9SAndroid Build Coastguard WorkerOnly the lowest unit can have decimal fractions; the higher units will be integers, so no "3.5 feet 3 inches". 1176*912701f9SAndroid Build Coastguard WorkerIf a number is negative, then only the highest unit shows the minus sign: eg, "-3 hours 27 minutes". 1177*912701f9SAndroid Build Coastguard WorkerIf one of the units is zero, then it is normally omitted: eg, "3 feet" instead of "3 feet 0 inches". 1178*912701f9SAndroid Build Coastguard WorkerHowever, when all of the units would be omitted, then the highest unit is shown with zero: eg "0 feet". 1179*912701f9SAndroid Build Coastguard Worker 1180*912701f9SAndroid Build Coastguard WorkerImplementations may offer mechanisms to control the precision of the formatted mixed unit. Examples include, but are not limited to: 1181*912701f9SAndroid Build Coastguard Worker* An implementation could apply the precision of a number formatter to the final unit. 1182*912701f9SAndroid Build Coastguard Worker However, this mechanisim has a couple of disadvantages, such as matching precision across user preferences. For example, suppose the input amount is 1.5254 and the precision is 2 decimals. 1183*912701f9SAndroid Build Coastguard Worker * Locale A uses decimal degrees and gets 1.53°. 1184*912701f9SAndroid Build Coastguard Worker * Locale B uses degrees, minutes, seconds, and gets 1° 31′ 31.44″ 1185*912701f9SAndroid Build Coastguard Worker * Locale B has an unnecessarily precise result: the equivalent of 1.52540 in precision. 1186*912701f9SAndroid Build Coastguard Worker* An implementation could allow a percentage precision; 1187*912701f9SAndroid Build Coastguard Worker thus 1612 meters with ±1% precision would be represented by **1 mile** rather than **1 mile 9 feet**. 1188*912701f9SAndroid Build Coastguard Worker 1189*912701f9SAndroid Build Coastguard WorkerThe default behavior is to round the lowest unit to the nearest integer. 1190*912701f9SAndroid Build Coastguard WorkerThus 1.99959 degree-and-arc-minute-and-arc-second would be (before rounding) **1 degree 59 minutes 58.524 seconds**. 1191*912701f9SAndroid Build Coastguard WorkerAfter rounding it would be **1 degree 59 minutes 59 seconds**. 1192*912701f9SAndroid Build Coastguard Worker 1193*912701f9SAndroid Build Coastguard WorkerIf the lowest unit would round to zero, or round up to the size of the next higher unit, then the next higher unit is rounded instead, recursively. 1194*912701f9SAndroid Build Coastguard WorkerThus 1.999862 degree-and-arc-minute-and-arc-second would be (before rounding) **1 degree 59 minutes 59.5032 degrees**. 1195*912701f9SAndroid Build Coastguard WorkerAfter rounding the last unit it would be **1 degree 59 minutes 60 seconds**, which rounds up to **1 degree 60 minutes**, which rounds up to **2 degrees**. 1196*912701f9SAndroid Build Coastguard WorkerThis behavior can be determined before having to compute the lower units: 1197*912701f9SAndroid Build Coastguard Workerfor example, where rounding to the second, if the remainder in degrees is below 1/120 degrees or above 119/120 degrees, then the degrees can be rounded without computing the minutes or seconds. 1198*912701f9SAndroid Build Coastguard Worker 1199*912701f9SAndroid Build Coastguard Worker## Testing 1200*912701f9SAndroid Build Coastguard Worker 1201*912701f9SAndroid Build Coastguard WorkerThe files in the directory [cldr/common/testData/units/](https://github.com/unicode-org/cldr/tree/main/common/testData/units) are provided for testing implementations. 1202*912701f9SAndroid Build Coastguard Worker1. The [unitsTest.txt](https://github.com/unicode-org/cldr/blob/main/common/testData/units/unitsTest.txt) file supplies a list of all the CLDR units with conversions 1203*912701f9SAndroid Build Coastguard Worker2. The [unitPreferencesTest.txt](https://github.com/unicode-org/cldr/blob/main/common/testData/units/unitPreferencesTest.txt) file supplied tests for user preferences 1204*912701f9SAndroid Build Coastguard Worker3. The [unitLocalePreferencesTest.txt](https://github.com/unicode-org/cldr/blob/main/common/testData/units/unitLocalePreferencesTest.txt) file provides examples for testing the interactions between locale identifiers and unit preferences. 1205*912701f9SAndroid Build Coastguard Worker 1206*912701f9SAndroid Build Coastguard WorkerInstructions for use are supplied in the header of the file. 1207*912701f9SAndroid Build Coastguard Worker 1208*912701f9SAndroid Build Coastguard Worker## <a name="Unit_Preferences" href="#Unit_Preferences">Unit Preferences</a> 1209*912701f9SAndroid Build Coastguard Worker 1210*912701f9SAndroid Build Coastguard WorkerDifferent 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. 1211*912701f9SAndroid Build Coastguard Worker 1212*912701f9SAndroid Build Coastguard Worker### <a name="Unit_Preferences_Overrides" href="#Unit_Preferences_Overrides">Unit Preferences Overrides</a> 1213*912701f9SAndroid Build Coastguard Worker 1214*912701f9SAndroid Build Coastguard WorkerThe determination of preferred units uses the user preference data together with **input unit**, the **input usage**, and the **input locale identifer**. 1215*912701f9SAndroid Build Coastguard WorkerWithin the locale identifier, the subtags that can affect the result are: 1216*912701f9SAndroid Build Coastguard Worker * the value of the keys mu, ms, and rg 1217*912701f9SAndroid Build Coastguard Worker * the region in the locale identifier (if there is one) 1218*912701f9SAndroid Build Coastguard Worker * and otherwise the likely region subtag for the locale identifier 1219*912701f9SAndroid Build Coastguard Worker 1220*912701f9SAndroid Build Coastguard WorkerThe strongest priority is the mu key, then the ms key, then the rg key. 1221*912701f9SAndroid Build Coastguard WorkerBeyond that the region of the locale identifer is used, and if not present, the likely-subtag region. 1222*912701f9SAndroid Build Coastguard WorkerFor example: 1223*912701f9SAndroid Build Coastguard Worker 1224*912701f9SAndroid Build Coastguard Worker| | Locale | Result | Comment | 1225*912701f9SAndroid Build Coastguard Worker|---|---------------------------------------|------------|--------------------------------------------------------------------| 1226*912701f9SAndroid Build Coastguard Worker| 1 | en-u-rg-uszzzz-ms-ussystem-mu-celsius | Celsius | despite the rg and ms settings for US, and the likely region of US | 1227*912701f9SAndroid Build Coastguard Worker| 2 | en-u-rg-uszzzz-ms-metric | Celsius | despite the rg setting for US, and the likely region of US | 1228*912701f9SAndroid Build Coastguard Worker| 3 | en-u-rg-dezzzz. | Celsius | despite the likely region of US | 1229*912701f9SAndroid Build Coastguard Worker| 4 | en-DE | Celsius | because explicit region is DE | 1230*912701f9SAndroid Build Coastguard Worker| 5 | en | Fahrenheit | because the likely region for en with no region is US | 1231*912701f9SAndroid Build Coastguard Worker 1232*912701f9SAndroid Build Coastguard WorkerIf any key-values are invalid, then they are ignored. Thus the following constructs are ignored: 1233*912701f9SAndroid Build Coastguard Worker 1234*912701f9SAndroid Build Coastguard Worker| subtags | reason | 1235*912701f9SAndroid Build Coastguard Worker| --- | --- | 1236*912701f9SAndroid Build Coastguard Worker| -mu-smoot | invalid unit | 1237*912701f9SAndroid Build Coastguard Worker| -ms-stanford | invalid unit system | 1238*912701f9SAndroid Build Coastguard Worker| -rg-aazzzz | invalid region 'AA' ‡| 1239*912701f9SAndroid Build Coastguard Worker| -AA | invalid region 'AA'| 1240*912701f9SAndroid Build Coastguard Worker 1241*912701f9SAndroid Build Coastguard Worker‡ Only the region portion is currently used, so in -rg-usabcdef the "abcdef" is ignored, whether or not it is valid. 1242*912701f9SAndroid Build Coastguard Worker 1243*912701f9SAndroid Build Coastguard WorkerThe following algorithm is used to compute the override units, regions, and category. 1244*912701f9SAndroid Build Coastguard WorkerThe latter two items are used in the [Unit Preferences Data](#Unit_Preferences_Data). 1245*912701f9SAndroid Build Coastguard Worker 1246*912701f9SAndroid Build Coastguard Worker#### Compute override units 1247*912701f9SAndroid Build Coastguard WorkerIf there is a valid -mu value then let the **output unit** be the that value, and return it. 1248*912701f9SAndroid Build Coastguard WorkerThis terminates the algorithm; there is no need to use the unit preferences information. 1249*912701f9SAndroid Build Coastguard Worker 1250*912701f9SAndroid Build Coastguard Worker#### Compute regions 1251*912701f9SAndroid Build Coastguard WorkerIf there is no valid -mu value, the following steps are used to determine a region R from the **input locale identifer**. 1252*912701f9SAndroid Build Coastguard Worker(and optionally a Unit Systems Match (USM)): 1253*912701f9SAndroid Build Coastguard Worker 1254*912701f9SAndroid Build Coastguard Worker1. If there is a valid -ms value then let USM be the corresponding value in column 2 of the table below. 1255*912701f9SAndroid Build Coastguard WorkerOtherwise FR is not used. In either case continue with step 2. 1256*912701f9SAndroid Build Coastguard Worker2. If there is a valid -rg region, let R be that region, and go to Compute the category. 1257*912701f9SAndroid Build Coastguard Worker3. If there is a valid region in the locale, let R be that region, and go to Compute the category. 1258*912701f9SAndroid Build Coastguard Worker4. Otherwise, compute the likely subtags for the locale. 1259*912701f9SAndroid Build Coastguard Worker 1. If there is a likely region, then let R be that region, and go to Compute the category. 1260*912701f9SAndroid Build Coastguard Worker 2. Otherwise, let R be 001, and go to Compute the category 1261*912701f9SAndroid Build Coastguard Worker 1262*912701f9SAndroid Build Coastguard Worker| Key-Value | Unit Systems Match | Fallback Region for Unit Preferences | 1263*912701f9SAndroid Build Coastguard Worker|-------------|-----------------------------|--------------------------------------| 1264*912701f9SAndroid Build Coastguard Worker| ms-metric | metric OR metric_adjacent | 001 | 1265*912701f9SAndroid Build Coastguard Worker| ms-ussystem | ussystem | US | 1266*912701f9SAndroid Build Coastguard Worker| ms-uksystem | uksystem | UK | 1267*912701f9SAndroid Build Coastguard Worker 1268*912701f9SAndroid Build Coastguard Worker#### Compute the category 1269*912701f9SAndroid Build Coastguard Worker 1270*912701f9SAndroid Build Coastguard WorkerA **category** is determined as follows from the input unit: 1271*912701f9SAndroid Build Coastguard Worker 1272*912701f9SAndroid Build Coastguard Worker1. From the input unit, use the conversion data in [baseUnit](tr35-info.md#Unit_Conversion) and let the **input base unit** be the baseUnit attribute value. 1273*912701f9SAndroid Build Coastguard Worker * eg, for `pound-force` the baseUnit is `kilogram-meter-per-square-second`. 1274*912701f9SAndroid Build Coastguard Worker2. If there is no such base unit (such as for a an unusual unit like `ampere-pound-per-foot-square-minute`), 1275*912701f9SAndroid Build Coastguard Worker convert the input unit to a combination of base units, reduce to lowest terms, and normalize. 1276*912701f9SAndroid Build Coastguard Worker Let the **input base unit** be that value. 1277*912701f9SAndroid Build Coastguard Worker * eg, `ampere-pound-per-foot-square-minute` ⇒ `kilogram-ampere-per-meter-square-second` 1278*912701f9SAndroid Build Coastguard Worker3. If the **input base unit** has a unitQuantity element, then let the **category** be the quantity attribute value. 1279*912701f9SAndroid Build Coastguard Worker * eg, `force` from `<unitQuantity baseUnit='kilogram-meter-per-square-second' quantity='force'/>` 1280*912701f9SAndroid Build Coastguard Worker4. If the **input base unit** does not have a unitQuantity, let the output unit be the input base unit. 1281*912701f9SAndroid Build Coastguard Worker An implementation may also set it to an equivalent metric/SI unit, as in the example below. 1282*912701f9SAndroid Build Coastguard Worker This terminates the algorithm; there is no need to use the unit preferences information. 1283*912701f9SAndroid Build Coastguard Worker * For example, for `ampere-pound-per-foot-square-minute` an implementation could return `kilogram-ampere-per-meter-square-second` or `pascal-ampere`. 1284*912701f9SAndroid Build Coastguard Worker * That is, an implementation can use shorter metric/SI units as long as long as the combination is equivalent in value. 1285*912701f9SAndroid Build Coastguard Worker 1286*912701f9SAndroid Build Coastguard Worker### <a name="Unit_Preferences_Data" href="#Unit_Preferences_Data">Unit Preferences Data</a> 1287*912701f9SAndroid Build Coastguard Worker 1288*912701f9SAndroid Build Coastguard WorkerThe CLDR data is intended to map from a particular usage — e.g. measuring the height of a person or the fuel consumption of an automobile — to the unit or combination of units typically used for that usage in a given region. Considerations for such a mapping include: 1289*912701f9SAndroid Build Coastguard Worker 1290*912701f9SAndroid Build Coastguard Worker* The list of possible usages is large and open-ended, and will be extended in the future. 1291*912701f9SAndroid Build Coastguard Worker* Even for a given usage such a measuring a road distance, there are different choices of units based on the particular distance. 1292*912701f9SAndroid Build Coastguard Worker For example, one set of units may be used for indicating the distance to the next city (kilometers or miles), while another may be used for indicating the distance to the next exit (meters, yards, or feet). 1293*912701f9SAndroid Build Coastguard Worker* There are also differences between more formal usage (official signage, medical records) and more informal usage (conversation, texting). 1294*912701f9SAndroid Build Coastguard Worker* For some usages, the measurement may be expressed using a sequence of units, such as “1 meter, 78 centimeters” or “12 stone, 2 pounds”. 1295*912701f9SAndroid Build Coastguard Worker 1296*912701f9SAndroid Build Coastguard WorkerThe DTD structure is as follows: 1297*912701f9SAndroid Build Coastguard Worker 1298*912701f9SAndroid Build Coastguard Worker```xml 1299*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitPreferenceData ( unitPreferences* ) > 1300*912701f9SAndroid Build Coastguard Worker 1301*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitPreferences ( unitPreference* ) > 1302*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPreferences category NMTOKEN #REQUIRED > 1303*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPreferences usage NMTOKENS #REQUIRED > 1304*912701f9SAndroid Build Coastguard Worker 1305*912701f9SAndroid Build Coastguard Worker<!ELEMENT unitPreference ( #PCDATA ) > 1306*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPreference regions NMTOKENS #REQUIRED > 1307*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPreference geq NMTOKEN #IMPLIED > 1308*912701f9SAndroid Build Coastguard Worker<!ATTLIST unitPreference skeleton CDATA #IMPLIED > 1309*912701f9SAndroid Build Coastguard Worker``` 1310*912701f9SAndroid Build Coastguard Worker 1311*912701f9SAndroid Build Coastguard Worker| Term | Description | 1312*912701f9SAndroid Build Coastguard Worker|---|---| 1313*912701f9SAndroid Build Coastguard Worker| category | A unit quantity, such as “area” or “length”. See [Unit Conversion](#Unit_Conversion) | 1314*912701f9SAndroid Build Coastguard Worker| usage | A type of usage, such as person-height. | 1315*912701f9SAndroid Build Coastguard Worker| regions | One or more region identifiers (macroregions or regions), such as 001, US. (Note that this field may be extended in the future to also include subdivision identifiers and/or language identifiers, such as usca, and de-CH.) | 1316*912701f9SAndroid Build Coastguard Worker| geq | A threshold value, in a unit determined by the unitPreference element value. The unitPreference element is only used for values higher than this value (and lower than any higher value).<br/>The value must be non-negative. For picking negative units (-3 meters), use the absolute value to pick the unit. | 1317*912701f9SAndroid Build Coastguard Worker| skeleton | A skeleton in the ICU number format syntax, that is to be used to format the output unit amount. | 1318*912701f9SAndroid Build Coastguard Worker 1319*912701f9SAndroid Build Coastguard Worker 1320*912701f9SAndroid Build Coastguard WorkerLogically, the unit preferences data is a map from categories to a map of usages to a map of regions to a list of ranked units and optional formats. 1321*912701f9SAndroid Build Coastguard Worker 1322*912701f9SAndroid Build Coastguard Worker**Note:** As of CLDR 37, the `<unitPreference>` `geq` attribute replaces the now-deprecated `<unitPreferences>` `scope` attribute. 1323*912701f9SAndroid Build Coastguard Worker 1324*912701f9SAndroid Build Coastguard Worker#### Examples: 1325*912701f9SAndroid Build Coastguard Worker 1326*912701f9SAndroid Build Coastguard Worker```xml 1327*912701f9SAndroid Build Coastguard Worker<unitPreferences category="length" usage="default"> 1328*912701f9SAndroid Build Coastguard Worker <unitPreference regions="001">kilometer</unitPreference> 1329*912701f9SAndroid Build Coastguard Worker <unitPreference regions="001">meter</unitPreference> 1330*912701f9SAndroid Build Coastguard Worker <unitPreference regions="001">centimeter</unitPreference> 1331*912701f9SAndroid Build Coastguard Worker <unitPreference regions="US GB">mile</unitPreference> 1332*912701f9SAndroid Build Coastguard Worker <unitPreference regions="US GB">foot</unitPreference> 1333*912701f9SAndroid Build Coastguard Worker <unitPreference regions="US GB">inch</unitPreference> 1334*912701f9SAndroid Build Coastguard Worker</unitPreferences> 1335*912701f9SAndroid Build Coastguard Worker``` 1336*912701f9SAndroid Build Coastguard Worker 1337*912701f9SAndroid Build Coastguard WorkerThe above information says that for default usage, in the US people use mile, foot, and inch, where people in the rest of the world (001) use kilometer, meter, and centimeter. Take another example: 1338*912701f9SAndroid Build Coastguard Worker 1339*912701f9SAndroid Build Coastguard Worker```xml 1340*912701f9SAndroid Build Coastguard Worker<unitPreferences category="length" usage="road"> 1341*912701f9SAndroid Build Coastguard Worker <unitPreference regions="001" geq="0.9">kilometer</unitPreference> 1342*912701f9SAndroid Build Coastguard Worker <unitPreference regions="001" geq="300.0" skeleton="precision-increment/50">meter</unitPreference> 1343*912701f9SAndroid Build Coastguard Worker <unitPreference regions="001" skeleton="precision-increment/10">meter</unitPreference> 1344*912701f9SAndroid Build Coastguard Worker <unitPreference regions="001">meter</unitPreference> 1345*912701f9SAndroid Build Coastguard Worker <unitPreference regions="US" geq="0.5">mile</unitPreference> 1346*912701f9SAndroid Build Coastguard Worker <unitPreference regions="US" geq="100.0" skeleton="precision-increment/50">foot</unitPreference> 1347*912701f9SAndroid Build Coastguard Worker <unitPreference regions="US" skeleton="precision-increment/10">foot</unitPreference> 1348*912701f9SAndroid Build Coastguard Worker <unitPreference regions="GB" geq="0.5">mile</unitPreference> 1349*912701f9SAndroid Build Coastguard Worker <unitPreference regions="GB" geq="100.0" skeleton="precision-increment/50">yard</unitPreference> 1350*912701f9SAndroid Build Coastguard Worker <unitPreference regions="GB">yard</unitPreference> 1351*912701f9SAndroid Build Coastguard Worker <unitPreference regions="SE" geq="0.1">mile-scandinavian</unitPreference> 1352*912701f9SAndroid Build Coastguard Worker</unitPreferences> 1353*912701f9SAndroid Build Coastguard Worker``` 1354*912701f9SAndroid Build Coastguard Worker 1355*912701f9SAndroid Build Coastguard WorkerThe following is the algorithm for computing the preferred output unit from the category, usage, region, and USM. 1356*912701f9SAndroid Build Coastguard Worker 1357*912701f9SAndroid Build Coastguard Worker#### Compute the preferred output unit 1358*912701f9SAndroid Build Coastguard Worker 1359*912701f9SAndroid Build Coastguard Worker1. Let category preferences be the result of a lookup of **category** in the unit preferences. 1360*912701f9SAndroid Build Coastguard Worker 1. If the lookup fails, let the **output unit** be the input base unit or an equivalent metric/SI unit, and return. This terminates the algorithm. 1361*912701f9SAndroid Build Coastguard Worker2. Let category-usage preferences be the result of a lookup of **input usage** in the category preferences. 1362*912701f9SAndroid Build Coastguard Worker 1. If the lookup fails, let the **input usage** be its containing usage, and repeat. (This will always terminate is always a 'default' usage for each category.) 1363*912701f9SAndroid Build Coastguard Worker 2. The containing usage is the result of truncating the last '-' and following text, if there is a '-', and other wise 'default' 1364*912701f9SAndroid Build Coastguard Worker * For example, land-agriculture-grain ⊂ land-agriculture ⊂ land ⊂ default 1365*912701f9SAndroid Build Coastguard Worker3. Let ranked units be the result of a lookup of R in the category-usage preferences. There may be both region values and [containment regions](https://www.unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html). 1366*912701f9SAndroid Build Coastguard Worker 1. If the lookup of R fails, set R to its containing region and repeat. (This will always terminate because 001 is always present.) 1367*912701f9SAndroid Build Coastguard Worker * For example, CH (Switzerland) ⊂ 155 (Western Europe) ⊂ 150 (Europe) ⊂ 001 (World). 1368*912701f9SAndroid Build Coastguard Worker * This loop can be optimized to only include containing regions that occur in the data (eg, only 001 in LDML 45). 1369*912701f9SAndroid Build Coastguard Worker4. If there is a USM, and the corresponding Fallback Region is different than R, and any of the units in the ranked list don't match the USM, then let the ranked units be the result of a lookup of the Fallback Region in the category-usage preferences. 1370*912701f9SAndroid Build Coastguard Worker 1371*912701f9SAndroid Build Coastguard Worker#### Search the ranked units 1372*912701f9SAndroid Build Coastguard Worker 1373*912701f9SAndroid Build Coastguard WorkerThe ranked units will be of the following form: 1374*912701f9SAndroid Build Coastguard Worker ```xml 1375*912701f9SAndroid Build Coastguard Worker <unitPreference regions="GB" geq="0.5">mile</unitPreference> 1376*912701f9SAndroid Build Coastguard Worker <unitPreference regions="GB" geq="100.0" skeleton="precision-increment/50">yard</unitPreference> 1377*912701f9SAndroid Build Coastguard Worker <unitPreference regions="GB">yard</unitPreference> 1378*912701f9SAndroid Build Coastguard Worker ``` 1379*912701f9SAndroid Build Coastguard Worker 1380*912701f9SAndroid Build Coastguard Worker* The geq item gives the value for the unit in the element value (or for the largest unit for mixed units). For example, 1381*912701f9SAndroid Build Coastguard Worker * `...geq="0.5">mile<...` is ≥ 0.5 miles 1382*912701f9SAndroid Build Coastguard Worker * `...geq="100.0">foot-and-inch<...` is ≥ 100 feet 1383*912701f9SAndroid Build Coastguard Worker* If there is no `geq` attribute, then the implicit value is 1.0. 1384*912701f9SAndroid Build Coastguard Worker* Implementations will probably convert the values into the base units, so that the comparison is fast. Thus the above would be converted internally to something like: 1385*912701f9SAndroid Build Coastguard Worker * ≥ 804.672 meters ⇒ mile 1386*912701f9SAndroid Build Coastguard Worker * ≥ 30.48 meters ⇒ foot-and-inch 1387*912701f9SAndroid Build Coastguard Worker 1388*912701f9SAndroid Build Coastguard Worker1. Search for the first matching unitPreference for the absolute value of the input measure. If there is no match (eg < 100 feet in the above example), take the last unitPreference. That is, the last unitPreference is effectively geq="0". In the above example, `<unitPreference regions="GB">yard</unitPreference>` is equivalent to `<unitPreference geq="0" regions="GB">yard</unitPreference>` 1389*912701f9SAndroid Build Coastguard Worker 1390*912701f9SAndroid Build Coastguard WorkerFor completeness, when comparing doubles to the geq values: 1391*912701f9SAndroid Build Coastguard Worker* Negative numbers are treated as if they were positive, so in the above example -804.672 meters will format as "-0.5 mile". 1392*912701f9SAndroid Build Coastguard Worker* _infinity_, NaN, and -_infinity_ match the largest possible value. Thus -∞ meters will format as "-∞ miles", not "-∞ yards". 1393*912701f9SAndroid Build Coastguard Worker 1394*912701f9SAndroid Build Coastguard Worker2. Once a matching `unitPreference` element is found: 1395*912701f9SAndroid Build Coastguard Worker 1396*912701f9SAndroid Build Coastguard Worker* The unit is the element value 1397*912701f9SAndroid Build Coastguard Worker* The skeleton (if there is one) supplies formatting information for the unit. API settings may allow that to be overridden. 1398*912701f9SAndroid Build Coastguard Worker * The syntax and semantics for the skeleton value are defined by the [ICU Number Skeletons](https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html) document. 1399*912701f9SAndroid Build Coastguard Worker* If the skeleton is missing, the default is skeleton="**precision-integer/@@\***". However, the client can also override or tune the number formatting. 1400*912701f9SAndroid Build Coastguard Worker* If the unit is mixed (eg foot-and-inch) the skeleton applies to the final subunit; the higher subunits are formatted as integers. 1401*912701f9SAndroid Build Coastguard Worker 1402*912701f9SAndroid Build Coastguard Worker### Constraints 1403*912701f9SAndroid Build Coastguard Worker 1404*912701f9SAndroid Build Coastguard Worker* For a given category, there is always a “default” usage. 1405*912701f9SAndroid Build Coastguard Worker* For a given category and usage: 1406*912701f9SAndroid Build Coastguard Worker * There is always a 001 region. 1407*912701f9SAndroid Build Coastguard Worker * None of the sets of regions can overlap. That is, you can’t have “US” on one line and “US GB” on another. You _can_ have two lines with “US”, for different sizes of units. 1408*912701f9SAndroid Build Coastguard Worker* For a given category, usage, and region-set 1409*912701f9SAndroid Build Coastguard Worker * The unitPreferences are in descending order. 1410*912701f9SAndroid Build Coastguard Worker 1411*912701f9SAndroid Build Coastguard Worker#### Examples 1412*912701f9SAndroid Build Coastguard Worker 1413*912701f9SAndroid Build Coastguard Worker**Example A: xx-SE-u-ms-metric, length, road** 1414*912701f9SAndroid Build Coastguard Worker1. Fetch the data from `<unitPreferences category="length" usage="road">` for xx-SE 1415*912701f9SAndroid Build Coastguard Worker``` 1416*912701f9SAndroid Build Coastguard Worker<unitPreference regions="SE">mile-scandinavian</unitPreference> 1417*912701f9SAndroid Build Coastguard Worker<unitPreference regions="SE">kilometer</unitPreference> 1418*912701f9SAndroid Build Coastguard Worker<unitPreference regions="SE" geq="300.0" skeleton="precision-increment/50">meter</unitPreference> 1419*912701f9SAndroid Build Coastguard Worker<unitPreference regions="SE" geq="10" skeleton="precision-increment/10">meter</unitPreference> 1420*912701f9SAndroid Build Coastguard Worker<unitPreference regions="SE" skeleton="precision-increment/1">meter</unitPreference> 1421*912701f9SAndroid Build Coastguard Worker``` 1422*912701f9SAndroid Build Coastguard Worker2. Meter is **metric**, mile-scandinavian is **metric_adjacent** so they both match the key-value ms-**metric**, so no change is made. 1423*912701f9SAndroid Build Coastguard Worker 1424*912701f9SAndroid Build Coastguard Worker**Example B: xx-GB-u-ms-ussystem, volume, fluid** 1425*912701f9SAndroid Build Coastguard Worker1. Fetch the data from `<unitPreferences category="volume" usage="fluid">` for xx-GB 1426*912701f9SAndroid Build Coastguard Worker``` 1427*912701f9SAndroid Build Coastguard Worker<unitPreference regions="GB">gallon-imperial</unitPreference> 1428*912701f9SAndroid Build Coastguard Worker<unitPreference regions="GB">fluid-ounce-imperial</unitPreference> 1429*912701f9SAndroid Build Coastguard Worker``` 1430*912701f9SAndroid Build Coastguard Worker2. At least one of {gallon-imperial, fluid-ounce-imperial} does not match ms-**ussystem** so the locale is shifted to xx-**US**, and uses the following: 1431*912701f9SAndroid Build Coastguard Worker``` 1432*912701f9SAndroid Build Coastguard Worker<unitPreference regions="US">gallon</unitPreference> 1433*912701f9SAndroid Build Coastguard Worker<unitPreference regions="US">quart</unitPreference> 1434*912701f9SAndroid Build Coastguard Worker<unitPreference regions="US">pint</unitPreference> 1435*912701f9SAndroid Build Coastguard Worker<unitPreference regions="US">cup</unitPreference> 1436*912701f9SAndroid Build Coastguard Worker<unitPreference regions="US">fluid-ounce</unitPreference> 1437*912701f9SAndroid Build Coastguard Worker<unitPreference regions="US">tablespoon</unitPreference> 1438*912701f9SAndroid Build Coastguard Worker<unitPreference regions="US">teaspoon</unitPreference> 1439*912701f9SAndroid Build Coastguard Worker``` 1440*912701f9SAndroid Build Coastguard Worker 1441*912701f9SAndroid Build Coastguard Worker## Unit APIs 1442*912701f9SAndroid Build Coastguard WorkerAPIs should clearly allow for both the use of unit preferences with the above process, and for the _invariant use_ of a unit measure. 1443*912701f9SAndroid Build Coastguard WorkerThat is, while an application will usually want to obey the preferences for the locale or in the locale ID, there will definitely be instances where it will want to not use them. 1444*912701f9SAndroid Build Coastguard WorkerFor example, in showing the weather, an application may want to show: 1445*912701f9SAndroid Build Coastguard Worker 1446*912701f9SAndroid Build Coastguard WorkerHigh today: 68°F (20°C) 1447*912701f9SAndroid Build Coastguard Worker 1448*912701f9SAndroid Build Coastguard WorkerTo do that, the application needs to show the first value with the locale information, and then (a) query what the alternative is, and show the temperature in that. 1449*912701f9SAndroid Build Coastguard WorkerAs an example, ICU only uses the unit preferences (with rg, ms, and/or mu and the likely region) in formatting units when a **usage** parameter is set. 1450*912701f9SAndroid Build Coastguard Worker 1451*912701f9SAndroid Build Coastguard Worker* * * 1452*912701f9SAndroid Build Coastguard Worker 1453*912701f9SAndroid Build Coastguard WorkerCopyright © 2001–2024 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 [Terms of Use](https://www.unicode.org/copyright.html) apply. 1454*912701f9SAndroid Build Coastguard Worker 1455*912701f9SAndroid Build Coastguard WorkerUnicode and the Unicode logo are trademarks of Unicode, Inc., and are registered in some jurisdictions. 1456