[Unicode]  Technical Reports
 

Unicode Technical Standard #35

Unicode Locale Data Markup Language (LDML)
Part 2: General

Version 34
Editors Yoshito Umaoka (yoshito_umaoka@us.ibm.com) and other CLDR committee members

For the full header, summary, and status, see Part 1: Core

Summary

This 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.

This is a partial document, describing general parts of the LDML: display names & transforms, etc. For the other parts of the LDML see the main LDML document and the links above.

Status

This document has been reviewed by Unicode members and other interested parties, and has been approved for publication by the Unicode Consortium. This is a stable document and may be used as reference material or cited as a normative reference by other specifications.

A Unicode Technical Standard (UTS) is an independent specification. Conformance to the Unicode Standard does not imply conformance to any UTS.

Please submit corrigenda and other comments with the CLDR bug reporting form [Bugs]. Related information that is useful in understanding this document is found in the References. For the latest version of the Unicode Standard see [Unicode]. For a list of current Unicode Technical Reports see [Reports]. For more information about versions of the Unicode Standard, see [Versions].

Parts

The LDML specification is divided into the following parts:

Contents of Part 2, General

1 Display Name Elements

<!ELEMENT localeDisplayNames ( alias | ( localeDisplayPattern?, languages?, scripts?, territories?, subdivisions?, variants?, keys?, types?, transformNames?, measurementSystemNames?, codePatterns?, special* ) )>

Display names for scripts, languages, countries, currencies, and variants in this locale are supplied by this element. They supply localized names for these items for use in user-interfaces for various purposes such as displaying menu lists, displaying a language name in a dialog, and so on. Capitalization should follow the conventions used in the middle of running text; the <contextTransforms> element may be used to specify the appropriate capitalization for other contexts (see Section 12 ContextTransform Elements ). Examples are given below.

Note: The "en" locale may contain translated names for deprecated codes for debugging purposes. Translation of deprecated codes into other languages is discouraged.

Where present, the display names must be unique; that is, two distinct code would not get the same display name. (There is one exception to this: in time zones, where parsing results would give the same GMT offset, the standard and daylight display names can be the same across different time zone IDs.)

Any translations should follow customary practice for the locale in question. For more information, see [Data Formats].

<localeDisplayPattern>

<!ELEMENT localeDisplayPattern ( alias | (localePattern*, localeSeparator*, localeKeyTypePattern*, special*) ) >

For compound language (locale) IDs such as "pt_BR" which contain additional subtags beyond the initial language code: When the <languages> data does not explicitly specify a display name such as "Brazilian Portuguese" for a given compound language ID, "Portuguese (Brazil)" from the display names of the subtags.

It includes three sub-elements:

For example, for the locale identifier zh_Hant_CN_co_pinyin_cu_USD, the display would be "Chinese (Traditional, China, Pinyin Sort Order, Currency: USD)". The key-type for co_pinyin doesn't use the localeKeyTypePattern because there is a translation for the key-type in English:

<type type="pinyin" key="collation">Pinyin Sort Order</type>

<languages>

This contains a list of elements that provide the user-translated names for language codes, as described in Section 3, Unicode Language and Locale Identifiers.

<language type="ab">Abkhazian</language>
<language type="aa">Afar</language>
<language type="af">Afrikaans</language>
<language type="sq">Albanian</language>

There should be no expectation that the list of languages with translated names be complete: there are thousands of languages that could have translated names. For debugging purposes or comparison, when a language display name is missing, the Description field of the language subtag registry can be used to supply a fallback English user-readable name.

The type can actually be any locale ID as specified above. The set of which locale IDs is not fixed, and depends on the locale. For example, in one language one could translate the following locale IDs, and in another, fall back on the normal composition.

type translation composition
nl_BE Flemish Dutch (Belgium)
zh_Hans Simplified Chinese Chinese (Simplified)
en_GB British English English (United Kingdom)

Thus when a complete locale ID is formed by composition, the longest match in the language type is used, and the remaining fields (if any) added using composition.

Alternate short forms may be provided for some languages (and for territories and other display names), for example.

<language type="az">Azerbaijani</language>
<language type="az" alt="short">Azeri</language>
<language type="en_GB">British English</language>
<language type="en_GB" alt="short">U.K. English</language>
<language type="en_US">American English</language>
<language type="en_US" alt="short">U.S. English</language>

<scripts>

This element can contain an number of script elements. Each script element provides the localized name for a script code, as described in Section 3, Unicode Language and Locale Identifiers (see also UAX #24: Script Names [UAX24]). For example, in the language of this locale, the name for the Latin script might be "Romana", and for the Cyrillic script is "Kyrillica". That would be expressed with the following.

<script type="Latn">Romana</script>
<script type="Cyrl">Kyrillica</script>

The script names are most commonly used in conjunction with a language name, using the <localePattern> combining pattern, and the default form of the script name should be suitable for such use. When a script name requires a different form for stand-alone use, this can be specified using the "stand-alone" alternate:

<script type="Hans">Simplified</script>
<script type="Hans" alt="stand-alone">Simplified Han</script>
<script type="Hant">Traditional</script>
<script type="Hant" alt="stand-alone">Traditional Han</script>

This will produce results such as the following:

<territories>

This contains a list of elements that provide the user-translated names for territory codes, as described in Section 3, Unicode Language and Locale Identifiers.

<territory type="AD">Andorra</territory>
<territory type="AF">Afghanistan</territory>
<territory type="AL">Albania</territory>
<territory type="AO">Angola</territory>
<territory type="DZ">Algeria</territory>
<territory type="GB">United Kingdom</territory>
<territory type="GB" alt="short">U.K.</territory>
<territory type="US">United States</territory>
<territory type="US" alt="short">U.S.</territory>

<variants>

This contains a list of elements that provide the user-translated names for the variant_code values described in Section 3, Unicode Language and Locale Identifiers .

<variant type="nynorsk">Nynorsk</variant>

<keys>

This contains a list of elements that provide the user-translated names for the key values described in Section 3, Unicode Language and Locale Identifiers.

<key type="collation">Sortierung</key>

<types>

This contains a list of elements that provide the user-translated names  for the type values described in Section 3, Unicode Language and Locale Identifiers . Since the translation of an option name may depend on the key it is used with, the latter is optionally supplied.

<type type="phonebook" key="collation">Telefonbuch</type>

<measurementSystemNames>

This contains a list of elements that provide the user-translated names for systems of measurement. The types currently supported are "US", "metric", and "UK".

<measurementSystemName type="US">U.S.</type>

Note: In the future, we may need to add display names for the particular measurement units (millimeter versus millimetre versus whatever the Greek, Russian, etc are), and a message format for positioning those with respect to numbers. For example, "{number} {unitName}" in some languages, but "{unitName} {number}" in others.

<transformNames>

 

<transformName type="Numeric">Numeric</type>

<codePatterns>

<codePattern type="language">Language: {0}</type>

<!ELEMENT subdivisions ( alias | ( subdivision | special )* ) >
<!ELEMENT subdivision ( #PCDATA )>

Note that the subdivision names are in separate files, in the subdivisions/ directory. The type values are the fully qualified subdivsion names. For example:

<subdivision type="AL-04">Fier County</subdivision>
<subdivision type="AL-FR">Fier</subdivision> <!-- in AL-04 : Fier County -->
<subdivision type="AL-LU">Lushnjë</subdivision> <!-- in AL-04 : Fier County -->
<subdivision type="AL-MK">Mallakastër</subdivision> <!-- in AL-04 : Fier County -->

See also Part 6 Section 2.1.1 Subdivision Containment.

2 Layout Elements

<!ELEMENT layout ( alias | (orientation*, inList*, inText*, special*) ) >

This top-level element specifies general layout features. It currently only has one possible element (other than <special>, which is always permitted).

<!ELEMENT orientation ( characterOrder*, lineOrder*, special* ) >
<!ELEMENT characterOrder ( #PCDATA ) >
<!ELEMENT lineOrder ( #PCDATA ) >

The lineOrder and characterOrder elements specify the default general ordering of lines within a page, and characters within a line. The possible values are:

Direction Value
Vertical top-to-bottom
bottom-to-top
Horizontal left-to-right
right-to-left

If the value of lineOrder is one of the vertical values, then the value of characterOrder must be one of the horizontal values, and vice versa. For example, for English the lines are top-to-bottom, and the characters are left-to-right. For Mongolian (in the Mongolian Script) the lines are right-to-left, and the characters are top to bottom. This does not override the ordering behavior of bidirectional text; it does, however, supply the paragraph direction for that text (for more information, see UAX #9: The Bidirectional Algorithm [UAX9]).

For dates, times, and other data to appear in the right order, the display for them should be set to the orientation of the locale.

<inList> (deprecated)

The <inList> element is deprecated and has been superseded by the <contextTransforms> element; see Section 12 ContextTransform Elements .

This element controls whether display names (language, territory, etc) are title cased in GUI menu lists and the like. It is only used in languages where the normal display is lower case, but title case is used in lists. There are two options:

<inList casing="titlecase-words">
<inList casing="titlecase-firstword">

In both cases, the title case operation is the default title case function defined by Chapter 3 of [Unicode] . In the second case, only the first word (using the word boundaries for that locale) will be title cased. The results can be fine-tuned by using alt="list" on any element where titlecasing as defined by the Unicode Standard will produce the wrong value. For example, suppose that "turc de Crimée" is a value, and the title case should be "Turc de Crimée". Then that can be expressed using the alt="list" value.

<inText> (deprecated)

The <inList> element is deprecated and has been superseded by the <contextTransforms> element; see Section 12 ContextTransform Elements .

This element indicates the casing of the data in the category identified by the inText type attribute, when that data is written in text or how it would appear in a dictionary. For example :

<inText type="languages">lowercase-words</inText>

indicates that language names embedded in text are normally written in lower case. The possible values and their meanings are :

3 Character Elements

<!ELEMENT characters ( alias | ( exemplarCharacters*, ellipsis*, moreInformation*, stopwords*, indexLabels*, mapping*, parseLenients*, special* ) ) >

The <characters> element provides optional information about characters that are in common use in the locale, and information that can be helpful in picking resources or data appropriate for the locale, such as when choosing among character encodings that are typically used to transmit data in the language of the locale. It may also be used to help reduce confusability issues: see [UTR39]. It typically only occurs in a language locale, not in a language/territory locale. The stopwords are an experimental feature, and should not be used.

3.1 Exemplars

Exemplars are characters used by a language, separated into different categories. The following table provides a summary, with more details below.

Type Description Examples
main / standard Main letters used in the language a-z å æ ø
auxiliary Additional characters for common foreign words, technical usage á à ă â å ä ã ā æ ç é è ĕ ê ë ē í ì ĭ î ï ī ñ ó ò ŏ ô ö ø ō œ ú ù ŭ û ü ū ÿ
index Characters for the header of an index A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
punctuation Common punctuation - ‐ – — , ; \: ! ? . … “ ” ‘ ’ ( ) [ ] § @ * / & # † ‡ ′ ″
numbers The characters needed to display the common number formats: decimal, percent, and currency. [\u061C\u200E \- , ٫ ٬ . % ٪ ‰ ؉ + 0٠ 1١ 2٢ 3٣ 4٤ 5٥ 6٦ 7٧ 8٨ 9٩]

The basic exemplar character sets (main and auxiliary) contain the commonly used letters for a given modern form of a language, which can be for testing and for determining the appropriate repertoire of letters for charset conversion or collation. ("Letter" is interpreted broadly, as anything having the property Alphabetic in the [UAX44], which also includes syllabaries and ideographs.) It is not a complete set of letters used for a language, nor should it be considered to apply to multiple languages in a particular country. Punctuation and other symbols should not be included in the main and auxiliary sets. In particular, format characters like CGJ are not included.

There are five sets altogether: main, auxiliary, punctuation, numbers, and index. The main set should contain the minimal set required for users of the language, while the auxiliary exemplar set is designed to encompass additional characters: those non-native or historical characters that would customarily occur in common publications, dictionaries, and so on. Major style guidelines are good references for the auxiliary set. So, for example, if Irish newspapers and magazines would commonly have Danish names using å, for example, then it would be appropriate to include å in the auxiliary exemplar characters; just not in the main exemplar set. Thus English has the following:

<exemplarCharacters>[a b c d e f g h i j k l m n o p q r s t u v w x y z]</exemplarCharacters>
<exemplarCharacters type="auxiliary">[á à ă â å ä ã ā æ ç é è ĕ ê ë ē í ì ĭ î ï ī ñ ó ò ŏ ô ö ø ō œ ú ù ŭ û ü ū ÿ]</exemplarCharacters>

For a given language, there are a few factors that help for determining whether a character belongs in the auxiliary set, instead of the main set:

For example, the exemplar character set for en (English) is the set [a-z]. This set does not contain the accented letters that are sometimes seen in words like "résumé" or "naïve", because it is acceptable in common practice to spell those words without the accents. The exemplar character set for fr (French), on the other hand, must contain those characters: [a-z é è ù ç à â ê î ô û æ œ ë ï ÿ]. The main set typically includes those letters commonly "alphabet".

The punctuation set consists of common punctuation characters that are used with the language (corresponding to main and auxiliary). Symbols may also be included where they are common in plain text, such as ©. It does not include characters with narrow technical usage, such as dictionary punctuation/symbols or copy-edit symbols. For example, English would have something like the following:

- ‐ – —
, ; : ! ? . …
' ‘ ’ " “ ” ′ ″
( ) [ ] { } ⟨ ⟩
© ® ™ @ & ° ‧ ·/ # % ¶ § * † ‡
+ − ± × ÷ < ≤ = ≅ ≥ > √

The numbers exemplars does not currently include lesser-used characters: exponential notation (3.1 × 10²³, ∞, NAN). Nor does it contain the units or currency symbols such as $, ¥, ₹,… It does contain %, because that occurs in the percent format. It may contain some special formatting characters like the RLM. A full list of the currency symbols used with that locale are in the <currencies> element, while the units can be gotten from the <units> element (both using inheritance, of course).The digits used in each numbering system are accessed in numberingSystems.xml. For more information, see Part 3: Numbers , Section 2 Number Elements.

Examples for zh.xml:

Type Description
defaultNumberingSystem latn
otherNumberingSystems/native hanidec
otherNumberingSystems/traditional hans
otherNumberingSystems/finance hansfin

When determining the character repertoire needed to support a language, a reasonable initial set would include at least the characters in the main and punctuation exemplar sets, along with the digits and common symbols associated with the numberSystems supported for the locale (see Numbering Systems).

The index characters are a set of characters for use as a UI "index", that is, a list of clickable characters (or character sequences) that allow the user to see a segment of a larger "target" list. For details see the Unicode LDML: Collation document. The index set may only contain characters whose lowercase versions are in the main and auxiliary exemplar sets, though for cased languages the index exemplars are typically in uppercase. Characters from the auxiliary exemplar set may be necessary in the index set if it needs to properly handle items such as names which may require characters not included in the main exemplar set.

Here is a sample of the XML structure:

<exemplarCharacters type="index">[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]</exemplarCharacters>

The display of the index characters can be modified with the Index labels elements, discussed in Section 5.6.4.

3.1.1 Exemplar Syntax

In all of the exemplar characters, the list of characters is in the Unicode Set format, which normally allows boolean combinations of sets of letters and Unicode properties.

Sequences of characters that act like a single letter in the language — especially in collation — are included within braces, such as [a-z á é í ó ú ö ü ő ű {cs} {dz} {dzs} {gy} ...]. The characters should be in normalized form (NFC). Where combining marks are used generatively, and apply to a large number of base characters (such as in Indic scripts), the individual combining marks should be included. Where they are used with only a few base characters, the specific combinations should be included. Wherever there is not a precomposed character (for example, single codepoint) for a given combination, that must be included within braces. For example, to include sequences from the Where is my Character? page on the Unicode site, one would write: [{ch} {tʰ} {x̣} {ƛ̓} {ą́} {i̇́} {ト゚}], but for French one would just write [a-z é è ù ...]. When in doubt use braces, since it does no harm to include them around single code points: for example, [a-z {é} {è} {ù} ...].

If the letter 'z' were only ever used in the combination 'tz', then we might have [a-y {tz}] in the main set. (The language would probably have plain 'z' in the auxiliary set, for use in foreign words.) If combining characters can be used productively in combination with a large number of others (such as say Indic matras), then they are not listed in all the possible combinations, but separately, such as:

[‌ ‍ ॐ ०-९ ऄ-ऋ ॠ ऌ ॡ ऍ-क क़ ख ख़ ग ग़ घ-ज ज़ झ-ड ड़ ढ ढ़ ण-फ फ़ ब-य य़ र-ह ़ ँ-ः ॑-॔ ऽ ् ॽ ा-ॄ ॢ ॣ ॅ-ौ]

The exemplar character set for Han characters is composed somewhat differently. It is even harder to draw a clear line for Han characters, since usage is more like a frequency curve that slowly trails off to the right in terms of decreasing frequency. So for this case, the exemplar characters simply contain a set of reasonably frequent characters for the language.

The ordering of the characters in the set is irrelevant, but for readability in the XML file the characters should be in sorted order according to the locale's conventions. The main and auxiliary sets should only contain lower case characters (except for the special case of Turkish and similar languages, where the dotted capital I should be included); the upper case letters are to be mechanically added when the set is used. For more information on casing, see the discussion of Special Casing in the Unicode Character Database.

3.1.2 Restrictions

  1. The main, auxiliary and index sets are normally restricted to those letters with a specific Script character property (that is, not the values Common or Inherited) or required Default_Ignorable_Code_Point characters (such as a non-joiner), or combining marks, or the Word_Break properties Katakana, ALetter, or MidLetter.
  2. The auxiliary set should not overlap with the main set. There is one exception to this: Hangul Syllables and CJK Ideographs can overlap between the sets.
  3. Any Default_Ignorable_Code_Points should be in the auxiliary set , or, if they are only needed for currency formatting, in the currency set. These can include characters such as U+200E LEFT-TO-RIGHT MARK and U+200F RIGHT-TO-LEFT MARK which may be needed in bidirectional text in order for date, currency or other formats to display correctly.
  4. For exemplar characters the Unicode Set format is restricted so as to not use properties or boolean combinations .

3.2 Mapping

This element has been deprecated. For information on its structure and how it was intended to specify locale-specific preferred encodings for various purposes (e-mail, web), see the Mapping section from the CLDR 27 version of the LDML Specification.

3.3 Index Labels

This element and its subelements have been deprecated. For information on its structure and how it was intended to provide data for a compressed display of index exemplar characters where space is limited, see the Index Labels section from the CLDR 27 version of the LDML Specification.

<!ELEMENT indexLabels (indexSeparator*, compressedIndexSeparator*, indexRangePattern*, indexLabelBefore*, indexLabelAfter*, indexLabel*) >

3.4 Ellipsis

<!ELEMENT ellipsis ( #PCDATA ) >
<!ATTLIST ellipsis type ( initial | medial | final | word-initial | word-medial | word-final ) #IMPLIED >

The ellipsis element provides patterns for use when truncating strings. There are three versions: initial for removing an initial part of the string (leaving final characters); medial for removing from the center of the string (leaving initial and final characters), and final for removing a final part of the string (leaving initial characters). For example, the following uses the ellipsis character in all three cases (although some languages may have different characters for different positions).

<ellipsis type="initial">…{0}</ellipsis>
<ellipsis type="medial">{0}…{1}</ellipsis>
<ellipsis type="final">{0}…</ellipsis>

There are alternatives for cases where the breaks are on a word boundary, where some languages include a space. For example, such as case would be:

<ellipsis type="word-initial">… {0}</ellipsis>

3.5 More Information

The moreInformation string is one that can be displayed in an interface to indicate that more information is available. For example:

<moreInformation>?</moreInformation>

3.6 Parse Lenient

<!ELEMENT parseLenients ( alias | ( parseLenient*, special* ) ) >
<!ATTLIST parseLenients scope (general | number | date) #REQUIRED >
<!ATTLIST parseLenients level (lenient | stricter) #REQUIRED >

<!ELEMENT parseLenient ( #PCDATA ) >
<!ATTLIST parseLenient sample CDATA #REQUIRED >
<!ATTLIST parseLenient alt NMTOKENS #IMPLIED >
<!ATTLIST parseLenient draft (approved | contributed | provisional | unconfirmed) #IMPLIED >

Example:

<parseLenients scope="date" level="lenient">
    <parseLenient sample="-">[\-./]</parseLenient>
    <parseLenient sample=":">[\:∶]</parseLenient>
</parseLenients>

The parseLenient elements are used to indicate that characters within a particular UnicodeSet are normally to be treated as equivalent when doing a lenient parse. The scope attribute value defines where the lenient sets are intended for use. The level attribute value is included for future expansion; currently the only value is "lenient".

The sample attribute value is a paradigm element of that UnicodeSet, but the only reason for pulling it out separately is so that different classes of characters are separated, and to enable inheritance overriding. The first version of this data is populated with the data used for lenient parsing from ICU.

4 Delimiter Elements

<!ELEMENT delimiters (alias | (quotationStart*, quotationEnd*, alternateQuotationStart*, alternateQuotationEnd*, special*)) >

The delimiters supply common delimiters for bracketing quotations. The quotation marks are used with simple quoted text, such as:

He said, “Don’t be absurd!”

When quotations are nested, the quotation marks and alternate marks are used in an alternating fashion:

He said, “Remember what the Mad Hatter said: ‘Not the same thing a bit! Why you might just as well say that “I see what I eat” is the same thing as “I eat what I see”!’”

<quotationStart> </quotationStart>
<quotationEnd> </quotationEnd>
<alternateQuotationStart> </alternateQuotationStart>
<alternateQuotationEnd> </alternateQuotationEnd>

5 Measurement System Data

<!ELEMENT measurementData ( measurementSystem*, paperSize* ) >

<!ELEMENT measurementSystem EMPTY >
<!ATTLIST measurementSystem type ( metric | US | UK ) #REQUIRED >
<!ATTLIST measurementSystem category ( temperature ) #IMPLIED >
<!ATTLIST measurementSystem territories NMTOKENS #REQUIRED >

<!ELEMENT paperSize EMPTY >
<!ATTLIST paperSize type ( A4 | US-Letter ) #REQUIRED >
<!ATTLIST paperSize territories NMTOKENS #REQUIRED >

The measurement system is the normal measurement system in common everyday use (except for date/time). For example:

<measurementData>
 <measurementSystem type="metric"  territories="001"/>
 <measurementSystem type="US"  territories="LR MM US"/>
 <measurementSystem type="metric" category="temperature" territories="LR MM"/>
 <measurementSystem type="US" category="temperature" territories="BS BZ KY PR PW"/>
 <measurementSystem type="UK"  territories="GB"/>
 <paperSize type="A4"  territories="001"/>
 <paperSize type="US-Letter"  territories="BZ CA CL CO CR GT MX NI PA PH PR SV US VE"/>
</measurementData>

The values are "metric", "US", or "UK"; others may be added over time.

In some cases, it may be common to use different measurement systems for different categories of measurements. For example, the following indicates that for the category of temperature, in the regions LR and MM, it is more common to use metric units than US units.

			<measurementSystem type="metric" category="temperature" territories="LR MM"/>
		

The paperSize attribute gives the height and width of paper used for normal business letters. The values are "A4" and "US-Letter".

For both measurementSystem entries and paperSize entries, later entries for specific territories such as "US" will override the value assigned to that territory by earlier entries for more inclusive territories such as "001".

The measurement information was formerly in the main LDML file, and had a somewhat different format.

Again, for finer-grained detail about specific units for various usages, see Part 6: Supplemental: Section 2.4.1 Preferred Units for Specific Usages.

5.1 Measurement Elements (deprecated)

<!ELEMENT measurement (alias | (measurementSystem?, paperSize?, special*)) >

The measurement element is deprecated in the main LDML files, because the data is more appropriately organized as connected to territories, not to linguistic data. Instead, the measurementData element in the supplemental data file should be used.

6 Unit Elements

<!ELEMENT units (alias | (unit*, unitLength*, durationUnit*, special*) ) >

<!ELEMENT unitLength (alias | (compoundUnit*, unit*, coordinateUnit*, special*) ) >
<!ATTLIST unitLength type (long | short | narrow) #REQUIRED >

<!ELEMENT compoundUnit (alias | (compoundUnitPattern*, special*) ) >
<!ATTLIST compoundUnit type NMTOKEN #REQUIRED >

<!ELEMENT unit (alias | (displayName*, unitPattern*, perUnitPattern*, special*) ) >
<!ATTLIST unit type NMTOKEN #REQUIRED >

<!ELEMENT durationUnit (alias | (durationUnitPattern*, special*) ) >
<!ATTLIST durationUnit type NMTOKEN #REQUIRED >

<!ELEMENT unitPattern ( #PCDATA ) >
<!ATTLIST unitPattern count (0 | 1 | zero | one | two | few | many | other) #REQUIRED >

<!ELEMENT compoundUnitPattern ( #PCDATA ) >

<!ELEMENT coordinateUnit ( alias | ( displayName*, coordinateUnitPattern*, special* ) ) >
<!ELEMENT coordinateUnitPattern ( #PCDATA ) >
<!ATTLIST coordinateUnitPattern type (north | east | south | west) #REQUIRED >

<!ELEMENT durationUnitPattern ( #PCDATA ) >

These elements specify the localized way of formatting quantities of units such as years, months, days, hours, minutes and seconds— for example, in English, "1 day" or "3 days". The English rules that produce this example are as follows ({0} indicates the position of the formatted numeric value):

<unit type="duration-day">
  <displayName>days</displayName>
  <unitPattern count="one">{0} day</unitName>
  <unitPattern count="other">{0} days</unitName>
</unit>

In addition to supporting language-specific plural cases such as “one” and “other”, unitPatterns support the language-independent explicit cases “0” and “1” for special handling of numeric values that are exactly 0 or 1; see Explicit 0 and 1 rules.

Units, like other values with a count attribute, use a special inheritance. See Part 1: Core: Section 4.1 Multiple Inheritance .

The displayName is used for labels, such as in a UI. It is typically lowercased and as neutral a plural form as possible, and then uses the casing context for the proper display. For example, for English in a UI it would appear as titlecase:

Duration:

Days enter the vacation length

 

The value of the type attribute are unit identifiers. Syntactically, they have the following structure:

unit_identifier := type "-" unit

type := [a-z]+

unit := [a-z]+([-][a-z]+)*

Example:

<unit type="acceleration-g-force">

Examples of these include but are not limited to the following. The units in CLDR are not comprehensive; it is anticipated that more will be added over time. The complete list of supported units is in the validity data: see Section 3.11 Validity Data.

Type Unit Sample Format
acceleration g-force {0} G
acceleration meter-per-second-squared {0} m/s²
angle revolution {0} rev
angle radian {0} rad
angle degree {0}°
angle arc-minute {0}′
angle arc-second {0}″
area square-kilometer {0} km²
area hectare {0} ha
area square-meter {0} m²
area square-centimeter {0} cm²
area square-mile {0} mi²
area acre {0} ac
area square-yard {0} yd²
area square-foot {0} ft²
area square-inch {0} in²
concentr karat {0} kt dimensionless
concentr milligram-per-deciliter {0} mg/dL
concentr millimole-per-liter {0} mmol/L
concentr part-per-million {0} ppm dimensionless
concentr percent {0}% dimensionless
concentr permille {0}‰ dimensionless
consumption liter-per-kilometer {0} L/km
consumption liter-per-100kilometers {0} L/100km
consumption mile-per-gallon (US) {0} mpg
consumption mile-per-gallon-imperial {0} mpg Imp.
digital petabyte {0} PB
digital terabyte {0} TB
digital terabit {0} Tb
digital gigabyte {0} GB
digital gigabit {0} Gb
digital megabyte {0} MB
digital megabit {0} Mb
digital kilobyte {0} kB
digital kilobit {0} kb
digital byte {0} byte
digital bit {0} bit
duration century {0} c
duration year {0} y
duration year-person {0} y
duration month {0} m
duration month-person {0} m
duration week {0} w
duration week-person {0} w
duration day {0} d
duration day-person {0} d
duration hour {0} h
duration minute {0} min
duration second {0} s
duration millisecond {0} ms
duration microsecond {0} μs
duration nanosecond {0} ns
electric ampere {0} A
electric milliampere {0} mA
electric ohm {0} Ω
electric volt {0} V
energy kilocalorie {0} kcal
energy calorie {0} cal
energy foodcalorie {0} Cal
energy kilojoule {0} kJ
energy joule {0} J
energy kilowatt-hour {0} kWh
frequency gigahertz {0} GHz
frequency megahertz {0} MHz
frequency kilohertz {0} kHz
frequency hertz {0} Hz
length kilometer {0} km
length meter {0} m
length decimeter {0} dm
length centimeter {0} cm
length millimeter {0} mm
length micrometer {0} µm
length nanometer {0} nm
length picometer {0} pm
length mile {0} mi
length yard {0} yd
length foot {0} ft
length inch {0} in
length parsec {0} pc
length light-year {0} ly
length astronomical-unit {0} au
length furlong {0} fur
length fathom {0} fm
length nautical-mile {0} nmi
length mile-scandinavian {0} smi
length point {0} pt typographic point, 1/72 inch
light lux {0} lx
mass metric-ton {0} t
mass kilogram {0} kg
mass gram {0} g
mass milligram {0} mg
mass microgram {0} µg
mass ton {0} tn
mass stone {0} st
mass pound {0} lb
mass ounce {0} oz
mass ounce-troy {0} oz t
mass carat {0} CD
power gigawatt {0} GW
power megawatt {0} MW
power kilowatt {0} kW
power watt {0} W
power milliwatt {0} mW
power horsepower {0} hp
pressure hectopascal {0} hPa
pressure millimeter-of-mercury {0} mm Hg
pressure pound-per-square-inch {0} psi
pressure inch-hg {0} inHg
pressure millibar {0} mbar
pressure atmosphere {0} atm
speed kilometer-per-hour {0} km/h
speed meter-per-second {0} m/s
speed mile-per-hour {0} mi/h
speed knot {0} kn
temperature generic {0}°
temperature celsius {0}°C
temperature fahrenheit {0}°F
temperature kelvin {0} K
volume cubic-kilometer {0} km³
volume cubic-meter {0} m³
volume cubic-centimeter {0} cm³
volume cubic-mile {0} mi³
volume cubic-yard {0} yd³
volume cubic-foot {0} ft³
volume cubic-inch {0} in³
volume megaliter {0} ML
volume hectoliter {0} hL
volume liter {0} L
volume deciliter {0} dL
volume centiliter {0} cL
volume milliliter {0} mL
volume pint-metric {0} mpt
volume cup-metric {0} mc
volume acre-foot {0} ac ft
volume bushel {0} bu
volume gallon (US) {0} gal
volume gallon-imperial {0} gal Imp.
volume quart {0} qt
volume pint {0} pt
volume cup {0} c
volume fluid-ounce {0} fl oz
volume tablespoon {0} tbsp
volume teaspoon {0} tsp

There are three widths: long, short, and narrow. As usual, the narrow forms may not be unique: in English, 1′ could mean 1 minute of arc, or 1 foot. Thus narrow forms should only be used where the context makes the meaning clear.

Where the unit of measurement is one of the International System of Units (SI), the short and narrow forms will typically use the international symbols, such as “mm” for millimeter. They may, however, be different if that is customary for the language or locale. For example, in Russian it may be more typical to see the Cyrillic characters “мм”.

Units are included for translation even where they are not typically used in a particular locale, such as kilometers in the US, or inches in Germany. This is to account for use by travelers and specialized domains, such as the German “̌Fernseher von 32 bis 55 Zoll (80 bis 140 cm)” for TV screen size in inches and centimeters.

For temperature, there is a special unit <unit type="temperature-generic">, which is used when it is clear from context whether Celcius or Fahrenheit is implied.

For duration, there are special units such as <unit type="duration-year-person"> and <unit type="duration-year-week"> for indicating the age of a person, which requires special forms in some languages. For example, in "zh", references to a person being 3 days old or 30 years old would use the forms “他3天大” and “他30岁” respectively.

6.1 per Unit patterns

A common combination of units is X per Y, such as miles per hour or liters per second. Some units already have 'precomputed' forms, such as kilometer-per-hour; where such units exist, they should be used in preference. There are two other patterns that can be used to compose unit symbols or names.

compoundUnit — This is used to construct a pattern from two unit names. For example, a form such as "{0} per {1}" or "{0}/{1}" can be used to construct cases such as "2 feet per second" or "ft/s"

perUnitPattern — This is used as the denominator with another unit name. For example, a form such as "{0} per second" can be used to form "2 feet per second".

The difference between these is that in some inflected languages, the compoundUnit cannot be used to form grammatical phrases. This is typically because the "per" + "second" combine in a non-trivial way. For such languages, the compoundUnit should only be used as a fallback, when there is no other recourse.

When constructing a pattern for value=V, numeratorUnit=N, denominatorUnit=D, the following precess is used.

  1. If there is a compound form for N/D already available, use it.
  2. Otherwise, format the N pattern with the number using plural categories.
    • → "3 kilograms"
  3. See if there is a perUnitPattern for D.
    1. If so, then substitute the formatted numerator into the perUnitPattern
      • "3 kilograms" + "{0} per second" → "3 kilograms per second"
    2. If not, get the compoundUnit pattern, and substitute the formatted numerator for {0} and the singular form of the denominator for {1}, after stripping the {0} and trimming spaces.
      • "3 kilograms" + "{0} per {1}" + "{0} second" →
      • "3 kilograms" + "{0} per {1}" + "second" →
      • "3 kilograms per second"

The patterns can have different unit lengths, so the appropriate unit length should be used (with fallbacks if necessary).

6.2 Unit Sequences

Units may be used in composed sequences, such as 5° 30′ for 5 degrees 30 minutes, or 3 ft 2 in.For that purpose, the appropriate width of the unit listPattern can be used to compose the units in a sequence.

<listPattern type="unit"> (for the long form)
<listPattern type="unit-narrow">
<listPattern type="unit-short">

6.3 durationUnit

The durationUnit is a special type of unit used for composed time unit durations.

<durationUnit type="hms">
  <durationUnitPattern>h:mm:ss</durationUnitPattern> <!-- 33:04:59 -->
</durationUnit>   

The type contains a skeleton, where 'h' stands for hours, 'm' for minutes, and 's' for sections. These are the same symbols used in availableFormats, except that there is no need to distinguish different forms of the hour.

6.4 coordinateUnit

The coordinateUnitPattern is a special type of pattern used for composing degrees of latitude and longitude, with an indicator of the quadrant. There are exactly 4 type values, plus a displayName for the items in this category. An angle is composed using the appropriate combination of the angle-degrees, angle-arc-minute and angle-arc-second values. It is then substituted for the placeholder field {0} in the appropriate coordinateUnit pattern.

<displayName>direction</displayName>
<coordinateUnitPattern type="east">{0}E</coordinateUnitPattern>
<coordinateUnitPattern type="north">{0}N</coordinateUnitPattern>
<coordinateUnitPattern type="south">{0}S</coordinateUnitPattern>
<coordinateUnitPattern type="west">{0}W</coordinateUnitPattern>

6.5 Territory-Based Unit Preferences

Different locales have different preferences for which unit or combination of units is used for a particular usage, such as measuring a person’s height. This is more fine-grained than merely a preference for metric versus US or UK measurement systems. For example, one locale may use meters alone, while another may use centimeters alone or a combination of meters and centimeters; a third may use inches alone, or (informally) a combination of feet and inches.

The <unitPreferenceData> element, described in Preferred Units for Specific Usages, provides information on which unit or combination of units is used for various purposes in different locales, with options for the level of formality and the scale of the measurement (e.g measuring the height of an adult versus that of an infant).

7 POSIX Elements

<!ELEMENT posix (alias | (messages*, special*)) >
<!ELEMENT messages (alias | ( yesstr*, nostr*)) >

The following are included for compatibility with POSIX.

<posix>
    <posix:messages>
        <posix:yesstr>ja</posix:yesstr>
        <posix:nostr>nein</posix:nostr>
    </posix:messages>
<posix>

  1. The values for yesstr and nostr contain a colon-separated list of strings that would normally be recognized as "yes" and "no" responses. For cased languages, this shall include only the lower case version. POSIX locale generation tools must generate the upper case equivalents, and the abbreviated versions, and add the English words wherever they do not conflict. Examples:
    • ja → ja:Ja:j:J:yes:Yes:y:Y
    • ja → ja:Ja:j:J:yes:Yes // exclude y:Y if it conflicts with the native "no".
  2. The older elements yesexpr and noexpr are deprecated. They should instead be generated from yesstr and nostr so that they match all the responses.

So for English, the appropriate strings and expressions would be as follows:

yesstr "yes:y"
nostr "no:n"

The generated yesexpr and noexpr would be:

yesexpr "^([yY]([eE][sS])?)"
This would match y,Y,yes,yeS,yEs,yES,Yes,YeS,YEs,YES.

noexpr "^([nN][oO]?)"
This would match n,N,no,nO,No,NO.

8 Reference Element

(Use only in supplemental data; deprecated for ldml.dtd and locale data)

<!ELEMENT references ( reference* ) >
<!ELEMENT reference ( #PCDATA ) >
<!ATTLIST reference type NMTOKEN #REQUIRED>
<!ATTLIST reference standard ( true | false ) #IMPLIED >
<!ATTLIST reference uri CDATA #IMPLIED >

The references section supplies a central location for specifying references and standards. The uri should be supplied if at all possible. If not online, then a ISBN number should be supplied, such as in the following example:

<reference type="R2" uri="http://www.ur.se/nyhetsjournalistik/3lan.html">Landskoder på Internet</reference>
<reference type="R3" uri="URN:ISBN:91-47-04974-X">Svenska skrivregler</reference>

9 Segmentations

<!ELEMENT segmentations ( alias | segmentation*) >

<!ELEMENT segmentation ( alias | (variables?, segmentRules? , exceptions?, suppressions?) | special*) >
<!ATTLIST segmentation type NMTOKEN #REQUIRED >

<!ELEMENT variables ( alias | variable*) >

<!ELEMENT variable ( #PCDATA ) >
<!ATTLIST variable id CDATA #REQUIRED >

<!ELEMENT segmentRules ( alias | rule*) >

<!ELEMENT rule ( #PCDATA ) >
<!ATTLIST rule id NMTOKEN #REQUIRED >

<!ELEMENT suppressions ( suppression* ) >

<!ATTLIST suppressions type NMTOKEN "standard" >

<!ATTLIST suppressions draft ( approved | contributed | provisional | unconfirmed ) #IMPLIED >

<!ELEMENT suppression ( #PCDATA ) >

The segmentations element provides for segmentation of text into words, lines, or other segments. The structure is based on [UAX29] notation, but adapted to be machine-readable. It uses a list of variables (representing character classes) and a list of rules. Each must have an id attribute.

The rules in root implement the segmentations found in [UAX29] and [UAX14], for grapheme clusters, words, sentences, and lines. They can be overridden by rules in child locales.

Here is an example:

<segmentations>
  <segmentation type="GraphemeClusterBreak">
    <variables>
      <variable id="$CR">\p{Grapheme_Cluster_Break=CR}</variable>
      <variable id="$LF">\p{Grapheme_Cluster_Break=LF}</variable>
      <variable id="$Control">\p{Grapheme_Cluster_Break=Control}</variable>
      <variable id="$Extend">\p{Grapheme_Cluster_Break=Extend}</variable>
      <variable id="$L">\p{Grapheme_Cluster_Break=L}</variable>
      <variable id="$V">\p{Grapheme_Cluster_Break=V}</variable>
      <variable id="$T">\p{Grapheme_Cluster_Break=T}</variable>
      <variable id="$LV">\p{Grapheme_Cluster_Break=LV}</variable>
      <variable id="$LVT">\p{Grapheme_Cluster_Break=LVT}</variable>
    </variables>
    <segmentRules>
      <rule id="3"> $CR × $LF </rule>
      <rule id="4"> ( $Control | $CR | $LF ) ÷ </rule>
      <rule id="5"> ÷ ( $Control | $CR | $LF ) </rule>
      <rule id="6"> $L × ( $L | $V | $LV | $LVT ) </rule>
      <rule id="7"> ( $LV | $V ) × ( $V | $T ) </rule>
      <rule id="8"> ( $LVT | $T) × $T </rule>
      <rule id="9"> × $Extend </rule>
    </segmentRules>
  </segmentation>
...

Variables: All variable ids must start with a $, and otherwise be valid identifiers according to the Unicode definitions in [UAX31]. The contents of a variable is a regular expression using variables and UnicodeSets. The ordering of variables is important; they are evaluated in order from first to last (see Section 9.1 Segmentation Inheritance). It is an error to use a variable before it is defined.

Rules: The contents of a rule uses the syntax of [UAX29]. The rules are evaluated in numeric id order (which may not be the order in which the appear in the file). The first rule that matches determines the status of a boundary position, that is, whether it breaks or not. Thus ÷ means a break is allowed; × means a break is forbidden. It is an error if the rule does not contain exactly one of these characters (except where a rule has no contents at all, or if the rule uses a variable that has not been defined.

There are some implicit rules:

Note: A rule like X Format* -> X in [UAX29] and [UAX14] is not supported. Instead, this needs to be expressed as normal regular expressions. The normal way to support this is to modify the variables, such as in the following example:

<variable id="$Format">\p{Word_Break=Format}</variable>
<variable id="$Katakana">\p{Word_Break=Katakana}</variable>
...
<!-- In place of rule 3, add format and extend to everything -->
<variable id="$X">[$Format $Extend]*</variable>
<variable id="$Katakana">($Katakana $X)</variable>
<variable id="$ALetter">($ALetter $X)</variable>
...

9.1 Segmentation Inheritance

Variables and rules both inherit from the parent.

Variables: The child's variable list is logically appended to the parent's, and evaluated in that order. For example:

// in parent
<variable id="$AL">[:linebreak=AL:]</variable>
<variable id="$YY">[[:linebreak=XX:]$AL]</variable>
// adds $AL

// in child
<variable id="$AL">[$AL && [^a-z]]</variable> // changes $AL, does not affect $YY
<variable id="$ABC">[abc]</variable>
// adds new rule

Rules: The rules are also logically appended to the parent's. Because rules are evaluated in numeric id order, to insert a rule in between others just requires using an intermediate number. For example, to insert a rule after id="10.1" and before id="10.2", just use id="10.15". To delete a rule, use empty contents, such as:

<rule id="3"/> // deletes rule 3

9.2 Segmentation Suppressions

Note: As of CLDR 26, the <suppressions> data is to be considered a technology preview. Data currently in CLDR was extracted from the Unicode Localization Interoperability project, or ULI. See http://uli.unicode.org for more information on the ULI project.

The segmentation suppressions list provides a set of cases which, though otherwise identified as a segment by rules, should be skipped (suppressed) during segmentation.

For example, in the English phrase "Mr. Smith", CLDR segmentation rules would normally find a Sentence Break between "Mr" and "Smith". However, typically, "Mr." is just an abbreviation for "Mister", and not actually the end of a sentence.

Each suppression has a separate <suppression> element, whose contents are the break to be skipped.

Example:

    <segmentation type="SentenceBreak">
      <suppressions type="standard" draft="provisional">
        <suppression>Maj.</suppression>
        <suppression>Mr.</suppression>
        <suppression>Lt.Cdr.</suppression>
	. . .
      </suppressions>
    </segmentation>
                

Note: These elements were called <exceptions> and <exception> prior to CLDR 26, but those names are now deprecated.

10 Transforms

Transforms provide a set of rules for transforming text via a specialized set of context-sensitive matching rules. They are commonly used for transliterations or transcriptions, but also other transformations such as full-width to half-width (for katakana characters). The rules can be simple one-to-one relationships between characters, or involve more complicated mappings. Here is an example:

<transform source="Greek" target="Latin" variant="UNGEGN" direction="both">
...
  <comment>Useful variables</comment>
  <tRule>$gammaLike = [ΓΚΞΧγκξχϰ] ;</tRule>
  <tRule>$egammaLike = [GKXCgkxc] ;</tRule>
...
  <comment>Rules are predicated on running NFD first, and NFC afterwards</comment>
  <tRule>::NFD (NFC) ;</tRule>
...
  <tRule>λ ↔ l ;</tRule>
  <tRule>Λ ↔ L ;</tRule>
...
  <tRule>γ } $gammaLike ↔ n } $egammaLike ;</tRule>
  <tRule>γ ↔ g ;</tRule>
...
  <tRule>::NFC (NFD) ;</tRule>
...
</transform>

The source and target values are valid locale identifiers, where 'und' means an unspecified language, plus some additional extensions.

In version 29.0, BCP47 identifiers were added as aliases (while retaining the old identifiers). The following table shows the relationship between the old identifiers and the BCP47 format identifiers.

Old ID BCP47 ID Comments
es_FONIPA-es_419_FONIPA es-419-fonipa-t-es-fonipa The order reverses with -t-. That is, the language subtag part is what results.
hy_AREVMDA-hy_AREVMDA_FONIPA hy-arevmda-fonipa-t-hy-arevmda
Devanagari-Latin und-Latn-t-und-deva Scripts add und-
Latin-Devanagari und-Deva-t-und-latn
Greek-Latin/UNGEGN und-Latn-t-und-grek-m0-ungegn Variants use the -m0- key.
Russian-Latin/BGN ru-Latn-t-ru-m0-bgn Languages will have a script when it isn’t the default.
Any-Hex/xml und-t-d0-hex-m0-xml Any becomes und, and keys d0 (destination) and s0 (source) are used for non-locales.
Hex-Any/xml und-t-s0-hex-m0-xml
Any-Publishing und-t-d0-publish Non-locales are normally the lowercases of the old ID, but may change because of BCP47 length restrictions.
Publishing-Any und-t-s0-publish

Note that the script and region codes are cased iff they are in the main subtag, but are lowercase in extensions.

10.1 Inheritance

The CLDR transforms are built using the following locale inheritance. While this inheritance is not required of LDML implementations, the transforms supplied with CLDR may not otherwise behave as expected without some changes.

For either the source or the target, the fallback starts from the maximized locale ID (using the likely-subtags data). It also uses the country for lookup before the base language is reached, and root is never accessed: instead the script(s) associated with the language are used. Where there are multiple scripts, the maximized script is tried first, and then the other scripts associated with the language (from supplemental data).

For example, see the bolded items below in the fallback chain for az_IR.

  Locale ID Comments
1 az_Arab_IR The maximized locale for az_IR
2 az_Arab Normal fallback
3 az_IR Inserted country locale
4 az Normal fallback
5 Arab Maximized script
6 Cyrl Other associated script

The source, target, and variant use "laddered" fallback, where the source changes the most quickly (using the above rules), then the target (using the above rules), then the variant if any, is discarded. That is, in pseudo code:

For example, here is the fallback chain for ru_RU-el_GR/BGN.

source   target variant
ru_RU - el_GR /BGN
ru - el_GR /BGN
Cyrl - el_GR /BGN
ru_RU - el /BGN
ru - el /BGN
Cyrl - el /BGN
ru_RU - Grek /BGN
ru - Grek /BGN
Cyrl - Grek /BGN
ru_RU - el_GR
ru - el_GR
Cyrl - el_GR
ru_RU - el
ru - el
Cyrl - el
ru_RU - Grek
ru - Grek
Cyrl - Grek

Japanese and Korean are special, since they can be represented by combined script codes, such as ja_Jpan, ja_Hrkt, ja_Hira, or ja_Kana. These need to be considered in the above fallback chain as well.

10.1.1 Pivots

Transforms can also use pivots. These are used when there is no direct transform between a source and target, but there are transforms X-Y and Y-Z. In such a case, the transforms can be internally chained to get X-Y = X-Y;Y-Z. This is done explicitly with the Indic script transforms: to get Devanagari-Latin, internally it is done by transforming first from Devanagari to Interindic (an internal superset encoding for Indic scripts), then from Interindic to Latin. This allows there to be only N sets of transform rules for the Indic scripts: each one to and from Interindic. These pivots are explicitly represented in the CLDR transforms.

Note that the characters currently used by Interindic are private use characters. To prevent those from “leaking” out into text, transforms converting from Interindic must ensure that they convert all the possible values used in Interindic.

The pivots can also be produced automatically (implicitly), as a fallback. A particularly useful pivot is IPA, since that tends to preserve pronunciation. For example, Czech to IPA can be chained with IPA to Katakana to get Czech to Katakana.

CLDR often has special forms of IPA: not just "und-FONIPA" but "cs-FONIPA": specifically IPA that has come from Czech. These variants typically preserve some features of the source language — such as double consonants — that are indistinguishable from single consonants in that language, but that are often preserved in traditional transliterations. Thus when matching prospective pivots, FONIPA is treated specially. If there is an exact match, that match is used (such as cs-cs_FONIPA + cs_FONIPA-ko). Otherwise, the language is ignored, as for example in cs-cs_FONIPA + ru_FONIPA-ko.

The interaction of implicit pivots and inheritance may result in a longer inheritance chain lookup than desired, so implementers may consider having some sort of caching mechanism to increase performance.

10.2 Variants

Variants used in CLDR include UNGEGN and BGN, both indicating sources for transliterations. There is an additional attribute private="true" which is used to indicate that the transform is meant for internal use, and should not be displayed as a separate choice in a UI.

There are many different systems of transliteration. The goal for the "unqualified" script transliterations are

  1. to be lossless when going to Latin and back
  2. to be as lossless as possible when going to other scripts
  3. to abide by a common standard as much as possible (possibly supplemented to meet goals 1 and 2).

Language-to-language transliterations, and variant script-to-script transliterations are generally transcriptions, and not expected to be lossless.

Additional transliterations may also be defined, such as customized language-specific transliterations (such as between Russian and French), or those that match a particular transliteration standard, such as the following:

The rules for transforms are described in Section 10.3 Transform Rules Syntax. For more information on Transliteration, see Transliteration Guidelines.

10.3 Transform Rules Syntax

<!ELEMENT transforms ( transform*) >
<!ELEMENT transform ((comment | tRule)*) >
<!ATTLIST transform source CDATA #IMPLIED >
<!ATTLIST transform target CDATA #IMPLIED >
<!ATTLIST transform variant CDATA #IMPLIED >
<!ATTLIST transform direction ( forward | backward | both ) "both" >
<!ATTLIST transform alias CDATA #IMPLIED >
  <!--@VALUE-->
<!ATTLIST transform backwardAlias CDATA #IMPLIED >
  <!--@VALUE-->
<!ATTLIST transform visibility ( internal | external ) "external" >
<!ELEMENT comment (#PCDATA) >
<!ELEMENT tRule (#PCDATA) >

The transform attributes indicate the source, target, direction, and aliases. For example:

<transform
  source="ja_Hrkt"
  target="ja_Latn"
  variant="BGN"
  direction="forward"
  draft="provisional"
  alias="Katakana-Latin/BGN ja-Latn-t-ja-hrkt-m0-bgn">

The direction is either forward or both (backward is possible in theory, but not used). This indicates which directions the rules support.

If the direction is forward, then an ID is composed from target + "-" + source + "/" + variant. If the direction is both, then the inverse ID is also value: source + "-" + target + "/" + variant. The alias attribute contains a space-delimited list of alternant forward IDs, while the backwardAlias contains a space-delimited list of alternant backward IDs. The BCP47 versions of the IDs will be in the alias and/or backwardAlias attributes.

The visibility attribute indicates whether the IDs should be externally visible, or whether they are only used internally.

In previous versions, the rules were expressed as fine-grained XML. That was discarded in CLDR version 29, in favor of a simpler format where the separate rules are simply terminated with ";".

The transform rules are similar to regular-expression substitutions, but adapted to the specific domain of text transformations. The rules and comments in this discussion will be intermixed, with # marking the comments. The simplest rule is a conversion rule, which replaces one string of characters with another. The conversion rule takes the following form:

xy → z ;

This converts any substring "xy" into "z". Rules are executed in order; consider the following rules:

sch → sh ;
ss → z ;

This conversion rule transforms "bass school" into "baz shool". The transform walks through the string from start to finish. Thus given the rules above "bassch" will convert to "bazch", because the "ss" rule is found before the "sch" rule in the string (later, we'll see a way to override this behavior). If two rules can both apply at a given point in the string, then the transform applies the first rule in the list.

All of the ASCII characters except numbers and letters are reserved for use in the rule syntax, as are the characters →, ←, ↔. Normally, these characters do not need to be converted. However, to convert them use either a pair of single quotes or a slash. The pair of single quotes can be used to surround a whole string of text. The slash affects only the character immediately after it. For example, to convert from a U+2190 ( ← ) LEFTWARDS ARROW to the string "arrow sign" (with a space), use one of the following rules:

\←   →  arrow\ sign ;
'←'   →   'arrow sign' ;
'←'   →   arrow' 'sign ;

Spaces may be inserted anywhere without any effect on the rules. Use extra space to separate items out for clarity without worrying about the effects. This feature is particularly useful with combining marks; it is handy to put some spaces around it to separate it from the surrounding text. The following is an example:

 → i ; # an iota-subscript diacritic turns into an i.

For a real space in the rules, place quotes around it. For a real backslash, either double it \\, or quote it '\'. For a real single quote, double it '', or place a backslash before it \'.

Any text that starts with a hash mark and concludes a line is a comment. Comments help document how the rules work. The following shows a comment in a rule:

x → ks ; # change every x into ks

The “\u” and “\x” hex notations can be used instead of any letter. For instance, instead of using the Greek π, one could write either of the following:

\u03C0 → p ;
\x{3C0} → p ;

One can also define and use variables, such as:

$pi = \u03C0 ;
$pi → p ;

10.3.1 Dual Rules

Rules can also specify what happens when an inverse transform is formed. To do this, we reverse the direction of the "←" sign. Thus the above example becomes:

$pi ← p ;

With the inverse transform, "p" will convert to the Greek p. These two directions can be combined together into a dual conversion rule by using the "↔" operator, yielding:

$pi ↔ p ;

10.3.2 Context

Context can be used to have the results of a transformation be different depending on the characters before or after. The following rule removes hyphens, but only when they follow lowercase characters:

[:Lowercase:] { '-' → ;

Contexts can be before or after or both, such as in a rule to remove hyphens between lowercase and uppercase letters:

[:Lowercase:] { '-' } [:Uppercase:] → ;

Each context is optional and may be empty; the following two rules are equivalent:

$pi ↔ p ;
{$pi} ↔ {p} ;

The context itself ([: Lowercase :]) is unaffected by the replacement; only the text within braces is changed.

Character classes (UnicodeSets) in the contexts can contain the special symbol $, which means “off either end of the string”. It is roughly similar to $ and ^ in regex. Unlike normal regex, however, it can occur in character classes. Thus the following rule removes hyphens that are after lowercase characters, or are at the start of a string.

[[:Lowercase:]$] {'-' → ;

Thus the negation of a UnicodeSet will normally also match before or after the end of a string. The following will remove hyphens that are not after lowercase characters, including hyphens at the start of a string.

[^[:Lowercase:]] {'-' → ;

It will thus convert “-B A-B a-b” to “B AB a-b”.

10.3.3 Revisiting

If the resulting text contains a vertical bar "|", then that means that processing will proceed from that point and that the transform will revisit part of the resulting text. Thus the | marks a "cursor" position. For example, if we have the following, then the string "xa" will convert to "w".

x → y | z ;
z a → w;

First, "xa" is converted to "yza". Then the processing will continue from after the character "y", pick up the "za", and convert it. Had we not had the "|", the result would have been simply "yza". The '@' character can be used as filler character to place the revisiting point off the start or end of the string. Thus the following causes x to be replaced, and the cursor to be backed up by two characters.

x → |@@y;

10.3.4 Example

The following shows how these features are combined together in the Transliterator "Any-Publishing". This transform converts the ASCII typewriter conventions into text more suitable for desktop publishing (in English). It turns straight quotation marks or UNIX style quotation marks into curly quotation marks, fixes multiple spaces, and converts double-hyphens into a dash.

# Variables

$single = \' ;
$space = ' ' ;
$double = \" ;
$back = \` ;
$tab = '\u0008' ;

# the following is for spaces, line ends, (, [, {, ...
$makeRight = [[:separator:][:start punctuation:][:initial punctuation:]] ;

# fix UNIX quotes

$back $back → “ ; # generate right d.q.m. (double quotation mark)
$back → ‘ ;

# fix typewriter quotes, by context

$makeRight { $double ↔ “ ; # convert a double to right d.q.m. after certain chars
^ { $double → “ ; # convert a double at the start of the line.
$double ↔ ” ; # otherwise convert to a left q.m.

$makeRight {$single} ↔ ‘ ; # do the same for s.q.m.s
^ {$single} → ‘ ;
$single ↔ ’;

# fix multiple spaces and hyphens

$space {$space} → ; # collapse multiple spaces
'--' ↔ — ; # convert fake dash into real one

There is an online demo where the rules can be tested, at:

http://unicode.org/cldr/utility/transform.jsp

10.3.5 Rule Syntax

The following describes the full format of the list of rules used to create a transform. Each rule in the list is terminated by a semicolon. The list consists of the following:

The filter rule, if present, must appear at the beginning of the list, before any of the other rules.  The inverse filter rule, if present, must appear at the end of the list, after all of the other rules.  The other rules may occur in any order and be freely intermixed.

The rule list can also generate the inverse of the transform. In that case, the inverse of each of the rules is used, as described below.

10.3.6 Transform Rules

Each transform rule consists of two colons followed by a transform name, which is of the form source-target. For example:

:: NFD ;
:: und_Latn-und_Greek ;
:: Latin-Greek; # alternate form

If either the source or target is 'und', it can be omitted, thus 'und_NFC' is equivalent to 'NFC'. For compatibility, the English names for scripts can be used instead of the und_Latn locale name, and "Any" can be used instead of "und". Case is not significant.

The following transforms are defined not by rules, but by the operations in the Unicode Standard, and may be used in building any other transform:

Any-NFC, Any-NFD, Any-NFKD, Any-NFKC - the normalization forms defined by [UAX15].

Any-Lower, Any-Upper, Any-Title - full case transformations, defined by [Unicode] Chapter 3.

In addition, the following special cases are defined:

Any-Null - has no effect; that is, each character is left alone.
Any-Remove - maps each character to the empty string; this, removes each character.

The inverse of a transform rule uses parentheses to indicate what should be done when the inverse transform is used. For example:

:: lower () ; # only executed for the normal
:: (lower) ; # only executed for the inverse
:: lower ; # executed for both the normal and the inverse

10.3.7 Variable Definition Rules

Each variable definition is of the following form:

$variableName = contents ;

The variable name can contain letters and digits, but must start with a letter. More precisely, the variable names use Unicode identifiers as defined by [UAX31]. The identifier properties allow for the use of foreign letters and numbers.

The contents of a variable definition is any sequence of Unicode sets and characters or characters. For example:

$mac = M [aA] [cC] ;

Variables are only replaced within other variable definition rules and within conversion rules. They have no effect on transliteration rules.

10.3.8 Filter Rules

A filter rule consists of two colons followed by a UnicodeSet. This filter is global in that only the characters matching the filter will be affected by any transform rules or conversion rules. The inverse filter rule consists of two colons followed by a UnicodeSet in parentheses. This filter is also global for the inverse transform.

For example, the Hiragana-Latin transform can be implemented by "pivoting" through the Katakana converter, as follows:

:: [:^Katakana:] ; # do not touch any katakana that was in the text!
:: Hiragana-Katakana;
:: Katakana-Latin;
:: ([:^Katakana:]) ; # do not touch any katakana that was in the text
                     # for the inverse either!

The filters keep the transform from mistakenly converting any of the "pivot" characters. Note that this is a case where a rule list contains no conversion rules at all, just transform rules and filters.

10.3.9 Conversion Rules

Conversion rules can be forward, backward, or double. The complete conversion rule syntax is described below:

Forward

A forward conversion rule is of the following form:

before_context { text_to_replace } after_context → completed_result | result_to_revisit ;

If there is no before_context, then the "{" can be omitted. If there is no after_context, then the "}" can be omitted. If there is no result_to_revisit, then the "|" can be omitted. A forward conversion rule is only executed for the normal transform and is ignored when generating the inverse transform.

Backward

A backward conversion rule is of the following form:

completed_result | result_to_revisit ← before_context { text_to_replace } after_context ;

The same omission rules apply as in the case of forward conversion rules. A backward conversion rule is only executed for the inverse transform and is ignored when generating the normal transform.

Dual

A dual conversion rule combines a forward conversion rule and a backward conversion rule into one, as discussed above. It is of the form:

a { b | c } d ↔ e { f | g } h ;

When generating the normal transform and the inverse, the revisit mark "|" and the before and after contexts are ignored on the sides where they do not belong. Thus, the above is exactly equivalent to the sequence of the following two rules:

a { b c } d  →  f | g  ;
b | c  ←  e { f g } h ; 

10.3.10 Intermixing Transform Rules and Conversion Rules

Transform rules and conversion rules may be freely intermixed. Inserting a transform rule into the middle of a set of conversion rules has an important side effect.

Normally, conversion rules are considered together as a group.  The only time their order in the rule set is important is when more than one rule matches at the same point in the string.  In that case, the one that occurs earlier in the rule set wins.  In all other situations, when multiple rules match overlapping parts of the string, the one that matches earlier wins.

Transform rules apply to the whole string.  If you have several transform rules in a row, the first one is applied to the whole string, then the second one is applied to the whole string, and so on.  To reconcile this behavior with the behavior of conversion rules, transform rules have the side effect of breaking a surrounding set of conversion rules into two groups: First all of the conversion rules before the transform rule are applied as a group to the whole string in the usual way, then the transform rule is applied to the whole string, and then the conversion rules after the transform rule are applied as a group to the whole string.  For example, consider the following rules:

abc → xyz;
xyz → def;
::Upper;

If you apply these rules to “abcxyz”, you get “XYZDEF”.  If you move the “::Upper;” to the middle of the rule set and change the cases accordingly, then applying this to “abcxyz” produces “DEFDEF”.

abc → xyz;
::Upper;
XYZ → DEF;

This is because “::Upper;” causes the transliterator to reset to the beginning of the string. The first rule turns the string into “xyzxyz”, the second rule upper cases the whole thing to “XYZXYZ”, and the third rule turns this into “DEFDEF”.

This can be useful when a transform naturally occurs in multiple “passes.”  Consider this rule set:

[:Separator:]* → ' ';
'high school' → 'H.S.';
'middle school' → 'M.S.';
'elementary school' → 'E.S.';

If you apply this rule to “high school”, you get “H.S.”, but if you apply it to “high  school” (with two spaces), you just get “high school” (with one space). To have “high  school” (with two spaces) turn into “H.S.”, you'd either have to have the first rule back up some arbitrary distance (far enough to see “elementary”, if you want all the rules to work), or you have to include the whole left-hand side of the first rule in the other rules, which can make them hard to read and maintain:

$space = [:Separator:]*;
high $space school → 'H.S.';
middle $space school → 'M.S.';
elementary $space school → 'E.S.';

Instead, you can simply insert “ ::Null; ” in order to get things to work right:

[:Separator:]* → ' ';
::Null;
'high school' → 'H.S.';
'middle school' → 'M.S.';
'elementary school' → 'E.S.';

The “::Null;” has no effect of its own (the null transform, by definition, does not do anything), but it splits the other rules into two “passes”: The first rule is applied to the whole string, normalizing all runs of white space into single spaces, and then we start over at the beginning of the string to look for the phrases. “high    school” (with four spaces) gets correctly converted to “H.S.”.

This can also sometimes be useful with rules that have overlapping domains.  Consider this rule set from before:

sch → sh ;
ss → z ;

Apply this rule to “bassch” results in “bazch” because “ss” matches earlier in the string than “sch”. If you really wanted “bassh”—that is, if you wanted the first rule to win even when the second rule matches earlier in the string, you'd either have to add another rule for this special case...

sch → sh ;
ssch → ssh;
ss → z ;

...or you could use a transform rule to apply the conversions in two passes:

sch → sh ;
::Null;
ss → z ;

10.3.11 Inverse Summary

The following table shows how the same rule list generates two different transforms, where the inverse is restated in terms of forward rules (this is a contrived example, simply to show the reordering):

Original Rules Forward Inverse
:: [:Uppercase Letter:] ;
:: latin-greek ;
:: greek-japanese ;
x ↔ y ;
z → w ;
r ← m ;
:: upper;
a → b ;
c ↔ d ;
:: any-publishing ;
:: ([:Number:]) ;
:: [:Uppercase Letter:] ;
:: latin-greek ;
:: greek-japanese ;
x → y ;
z → w ;
:: upper ;
a → b ;
c → d ;
:: any-publishing ;
:: [:Number:] ;
:: publishing-any ;
d → c ;
:: lower ;
y → x ;
m → r ;
:: japanese-greek ;
:: greek-latin ;

Note how the irrelevant rules (the inverse filter rule and the rules containing ←) are omitted (ignored, actually) in the forward direction, and notice how things are reversed: the transform rules are inverted and happen in the opposite order, and the groups of conversion rules are also executed in the opposite relative order (although the rules within each group are executed in the same order).

11 List Patterns

<!ELEMENT listPatterns (alias | (listPattern*, special*)) >

<!ELEMENT listPattern (alias | (listPatternPart*, special*)) >
<!ATTLIST listPattern type (NMTOKEN) #IMPLIED >

<!ELEMENT listPatternPart ( #PCDATA ) >
<!ATTLIST listPatternPart type (start | middle | end | 2 | 3) #REQUIRED >

List patterns can be used to format variable-length lists of things in a locale-sensitive manner, such as "Monday, Tuesday, Friday, and Saturday" (in English) versus "lundi, mardi, vendredi et samedi" (in French). For example, consider the following example:

<listPatterns>
 <listPattern>
  <listPatternPart type="2">{0} and {1}</listPatternPart>
  <listPatternPart type="start">{0}, {1}</listPatternPart>
  <listPatternPart type="middle">{0}, {1}</listPatternPart>
  <listPatternPart type="end">{0}, and {1}</listPatternPart>
 </listPattern>
</listPatterns>

The data is used as follows: If there is a type type matches exactly the number of elements in the desired list (such as "2" in the above list), then use that pattern. Otherwise,

  1. Format the last two elements with the "end" format.
  2. Then use middle format to add on subsequent elements working towards the front, all but the very first element. That is, {1} is what you've already done, and {0} is the previous element.
  3. Then use "start" to add the front element, again with {1} as what you've done so far, and {0} is the first element.

Thus a list (a,b,c,...m, n) is formatted as: start(a,middle(b,middle(c,middle(...end(m, n))...)))

The following type attributes are in use:

type attribute value Description Examples
standard (or no type) A typical 'and' list for arbitrary placeholders January, February, and March
standard-short A short version of a 'and' list, suitable for use with short or abbreviated placeholder values Jan., Feb., and Mar.
or A typical 'or' list for arbitrary placeholders January, February, or March
or-short A short version of an 'or' list Jan., Feb., or Mar.
unit A list suitable for wide units 3 feet, 7 inches
unit-short A list suitable for short units 3 ft, 7 in
unit-narrow A list suitable for narrow units, where space on the screen is very limited. 3′ 7″

In many languages there may not be a difference among many of these lists. In others, the spacing, the length or presence or a conjunction, and the separators may change.

11.1 Gender of Lists

<!-- Gender List support -->
<!ELEMENT gender ( personList+ ) >
<!ELEMENT personList EMPTY >
<!ATTLIST personList type ( neutral | mixedNeutral | maleTaints ) #REQUIRED >
<!ATTLIST personList locales NMTOKENS #REQUIRED >

This can be used to determine the gender of a list of 2 or more persons, such as "Tom and Mary", for use with gender-selection messages. For example,

  <supplementalData>
    <gender>
      <!-- neutral: gender(list) = other -->
      <personList type="neutral" locales="af da en..."/>

      <!-- mixedNeutral: gender(all male) = male, gender(all female) = female, otherwise gender(list) = other -->
      <personList type="mixedNeutral" locales="el"/>

      <!-- maleTaints: gender(all female) = female, otherwise gender(list) = male -->
      <personList type="maleTaints" locales="ar ca..."/>
    </gender>
  </supplementalData>

There are three ways the gender of a list can be formatted:

  1. neutral: A gender-independent "other" form will be used for the list.
  2. mixedNeutral: If the elements of the list are all male, "male" form is used for the list. If all the elements of the lists are female, "female" form is used. If the list has a mix of male, female and neutral names, the "other" form is used.
  3. maleTaints: If all the elements of the lists are female, "female" form is used, otherwise the "male" form is used.

12 ContextTransform Elements

<!ELEMENT contextTransforms ( alias | (contextTransformUsage*, special*)) >
<!ELEMENT contextTransformUsage ( alias | (contextTransform*, special*)) >
<!ATTLIST contextTransformUsage type CDATA #REQUIRED >
<!ELEMENT contextTransform ( #PCDATA ) >
<!ATTLIST contextTransform type ( uiListOrMenu | stand-alone ) #REQUIRED >

CLDR locale elements provide data for display names or symbols in many categories. The default capitalization for these elements is intended to be the form used in the middle of running text. In many languages, other capitalization may be required in other contexts, depending on the type of name or symbol.

Each <contextTransformUsage> element’s type attribute specifies a category of data from the table below; the element includes one or more <contextTransform> elements that specify how to perform capitalization of this category of data in different contexts. The <contextTransform> elements are needed primarily for cases in which the capitalization is other than the default form used in the middle of running text. However, it is also useful to mark cases in which it is known that no transformation from this default form is needed; this may be necessary, for example, to override the transformation specified by a parent locale. The following values are currently defined for the <contextTransform> element:

Four contexts for capitalization behavior are currently identified. Two need no data, and hence have no corresponding <contextTransform> elements:

Two other contexts require <contextTransform> elements if their capitalization behavior is other than the default for running text. The context is identified by the type attribute, as follows:

Example:

    <contextTransforms>
        <contextTransformUsage type="languages">
             <contextTransform type="uiListOrMenu">titlecase-firstword</contextTransform>
             <contextTransform type="stand-alone">titlecase-firstword</contextTransform>
        </contextTransformUsage>
        <contextTransformUsage type="month-format-except-narrow">
             <contextTransform type="uiListOrMenu">titlecase-firstword</contextTransform>
        </contextTransformUsage>
        <contextTransformUsage type="month-standalone-except-narrow">
             <contextTransform type="uiListOrMenu">titlecase-firstword</contextTransform>
        </contextTransformUsage>
    </contextTransforms>
Element contextTransformUsage type attribute values
type attribute value Description
all Special value, indicates that the specified transformation applies to all of the categories below
language localeDisplayNames language names
script localeDisplayNames script names
territory localeDisplayNames territory names
variant localeDisplayNames variant names
key localeDisplayNames key names
keyValue localeDisplayNames key value type names
month-format-except-narrow dates/calendars/calendar[type=*]/months format wide and abbreviated month names
month-standalone-except-narrow dates/calendars/calendar[type=*]/months stand-alone wide and abbreviated month names
month-narrow dates/calendars/calendar[type=*]/months format and stand-alone narrow month names
day-format-except-narrow dates/calendars/calendar[type=*]/days format wide and abbreviated day names
day-standalone-except-narrow dates/calendars/calendar[type=*]/days stand-alone wide and abbreviated day names
day-narrow dates/calendars/calendar[type=*]/days format and stand-alone narrow day names
era-name dates/calendars/calendar[type=*]/eras (wide) era names
era-abbr dates/calendars/calendar[type=*]/eras abbreviated era names
era-narrow dates/calendars/calendar[type=*]/eras narrow era names
quarter-format-wide dates/calendars/calendar[type=*]/quarters format wide quarter names
quarter-standalone-wide dates/calendars/calendar[type=*]/quarters stand-alone wide quarter names
quarter-abbreviated dates/calendars/calendar[type=*]/quarters format and stand-alone abbreviated quarter names
quarter-narrow dates/calendars/calendar[type=*]/quarters format and stand-alone narrow quarter names
calendar-field dates/fields/field[type=*]/displayName field names
(for relative forms see type "tense" below)
zone-exemplarCity dates/timeZoneNames/zone[type=*]/exemplarCity city names
zone-long dates/timeZoneNames/zone[type=*]/long zone names
zone-short dates/timeZoneNames/zone[type=*]/short zone names
metazone-long dates/timeZoneNames/metazone[type=*]/long metazone names
metazone-short dates/timeZoneNames/metazone[type=*]/short metazone names
symbol numbers/currencies/currency[type=*]/symbol symbol names
currencyName numbers/currencies/currency[type=*]/displayName currency names
currencyName-count numbers/currencies/currency[type=*]/displayName[count=*] currency names for use with count
relative dates/fields/field[type=*]/relative and dates/fields/field[type=*]/relativeTime relative field names
unit-pattern units/unitLength[type=*]/unit[type=*]/unitPattern[count=*] unit names
number-spellout rbnf/rulesetGrouping[type=*]/ruleset[type=*]/rbnfrule number spellout rules

13 Choice Patterns

A choice pattern is a string that chooses among a number of strings, based on numeric value. It has the following form:

<choice_pattern> = <choice> ( '|' <choice> )*
<choice> = <number><relation><string>
<number> = ('+' | '-')? ('∞' | [0-9]+ ('.' [0-9]+)?)
<relation> = '<' | '
≤'

The interpretation of a choice pattern is that given a number N, the pattern is scanned from right to left, for each choice evaluating <number> <relation> N. The first choice that matches results in the corresponding string. If no match is found, then the first string is used. For example:

Pattern N Result
0≤Rf|1≤Ru|1<Re -∞, -3, -1, -0.000001 Rf (defaulted to first string)
0, 0.01, 0.9999 Rf
1 Ru
1.00001, 5, 99, Re

Quoting is done using ' characters, as in date or number formats.

14 Annotations and Labels

Annotations provide information about characters, typically used in input. For example, on a mobile keyboard they can be used to do completion. They are typically used for symbols, especially emoji characters.

For more information, see version 5.0 or UTR #51, Unicode Emoji. (Note that during the period between the publication of CLDR v31 and that of Emoji 5.0, the “Latest Proposed Update” link should be used to get to the draft specification for Emoji 5.0.)

<!ELEMENT annotations ( annotation* ) >

<!ELEMENT annotation ( #PCDATA ) >

<!ATTLIST annotation cp CDATA #REQUIRED >

<!ATTLIST annotation type (tts) #IMPLIED >

There are two kinds of annotations: short names, and keywords.

With an attribute type="tts", the value is a short name, such as one that can be used for text-to-speech. It should be treated as one of the element values for other purposes.

When there is no type attribute, the value is a set of keywords, delimited by |. Spaces around each element are to be trimmed. The keywords are words associated with the character(s) that might be used in searching for the character, or in predictive typing on keyboards. The short name itself can be used as a keyword.

Here is an example from German:

<annotation cp="👎">schlecht | Hand | Daumen | nach unten</annotation>
<annotation cp="👎" type="tts">Daumen runter</annotation>

The cp attribute value has two formats: either a single string, or if contained within […] a UnicodeSet. The latter format can contain multiple code points or strings. A code point pr string can occur in multiple annotation element cp values, such as the following, which also contains the "thumbs down" character.

<annotation cp='[☝✊-✍👆-👐👫-👭💁🖐🖕🖖🙅🙆🙋🙌🙏🤘]'>hand</annotation>

Both for short names and keywords, values do not have to match between different languages. They should be the most common values that people using that language would associated with those characters. For example, a "black heart" might have the association of "wicked" in English, but not in some other languages.

The cp value may contain sequences, but does not contain any Emoji or Text Variant (VS15 & VS16) characters. All such characters should be removed before looking up any short names and keywords.

14.1 Synthesizing Sequence Names

Many emoji are represented by sequences of characters. When there are no annotation elements for that string, the short name can be synthesized as follows. Note: The process details may change after the release of this specification, and may further change in the future if other sequences are added. Please see the Known Issues section of the CLDR download page for any updates.

  1. If sequence is an emoji flag sequence, look up the territory name in CLDR for the corresponding ASCII characters and return as the short name. For example, the regional indicator symbols P+F would map to “Französisch-Polynesien” in German.
  2. If sequence is an emoji tag sequence, look up the subdivision name in CLDR for the corresponding ASCII characters and return as the short name. For example, the TAG characters gbsct would map to “Schottland” in German.
  3. If sequence is a keycap sequence or 🔟, use the characterLabel for "keycap" as the prefixName and set the suffix to be the sequence (or "10" in the case of 🔟), then go to step 8.
  4. Let suffix and prefixName be "".
  5. If sequence contains any emoji modifiers, move them (in order) into suffix, removing them from sequence.
  6. If sequence is a "KISS", "HEART" or "FAMILY" emoji ZWJ sequence, move the characters in sequence to the front of suffix, and set the sequence to be "💏", "💑", or "👪" respectively, and go to step 7.
    1. A KISS sequence contains ZWJ, "💋", and "❤", which are skipped in moving to suffix.
    2. A HEART sequence contains ZWJ and "❤", which are skipped in moving to suffix.
    3. A FAMILY sequence contains only characters from the set {👦, 👧, 👨, 👩, 👴, 👵, 👶}. Nothing is skipped in moving to suffix, except ZWJ.
  7. If sequence ends with ♂ or ♀, and does not have a name, remove the ♂ or ♀ and move the name for "👨" or "👩" respectively to the start of prefixName.
  8. Transform sequence and append to prefixName, by successively getting names for the longest subsequences, skipping any singleton ZWJ characters. If there is more than one name, use the listPattern for unit-short, type=2 to link them.
  9. Transform suffix into suffixName in the same manner.
  10. If both the prefixName and suffixName are non-empty, form the name by joining them with the "category-list" characterLabelPattern and return it. Otherwise return whichever of them is non-empty.

The synthesized keywords can follow a similar process.

  1. For an emoji flag sequence or emoji tag sequence representing a subdivision, use "flag".
  2. For keycap sequences, use "keycap".
  3. For other sequences, add the keywords for the subsequences used to get the short names for prefixName, and the short names used for suffixName.

Some examples for English data (v30) are given in the following table.

Synthesized Emoji Sequence Names
Sequence Short Name Keywords
🇪🇺 European Union flag
#️⃣ keycap: # keycap
9️⃣ keycap: 9 keycap
💏 kiss couple
👩‍❤️‍💋‍👩 kiss: woman, woman couple, woman
💑 couple with heart love, couple
👩‍❤️‍👩 couple with heart: woman, woman love, couple, woman
👪 family family
👩‍👩‍👧 family: woman, woman, girl woman, family, girl
👦🏻 boy: light skin tone young, light skin tone, boy
👩🏿 woman: dark skin tone woman, dark skin tone
👨‍⚖ man judge scales, justice, man
👨🏿‍⚖ man judge: dark skin tone scales, justice, dark skin tone, man
👩‍⚖ woman judge woman, scales, judge
👩🏼‍⚖ woman judge: medium-light skin tone woman, scales, medium-light skin tone, judge
👮 police officer police, cop, officer
👮🏿 police officer: dark skin tone police, cop, officer, dark skin tone
👮‍♂️ man police officer police, cop, officer, man
👮🏼‍♂️ man police officer: medium-light skin tone police, cop, officer, medium-light skin tone, man
👮‍♀️ woman police officer police, woman, cop, officer
👮🏿‍♀️ woman police officer: dark skin tone police, woman, cop, officer, dark skin tone
🚴 person biking cyclist, bicycle, biking
🚴🏿 person biking: dark skin tone cyclist, bicycle, biking, dark skin tone
🚴‍♂️ man biking cyclist, bicycle, biking, man
🚴🏿‍♂️ man biking: dark skin tone cyclist, bicycle, biking, dark skin tone, man
🚴‍♀️ woman biking cyclist, woman, bicycle, biking
🚴🏿‍♀️ woman biking: dark skin tone cyclist, woman, bicycle, biking, dark skin tone

For more information, see Unicode Emoji.

14.2 Annotations Character Labels

<!ELEMENT characterLabels ( alias | ( characterLabelPattern*, characterLabel*, special* ) ) >

<!ELEMENT characterLabelPattern ( #PCDATA ) >

<!ATTLIST characterLabelPattern type NMTOKEN #REQUIRED >

<!ATTLIST characterLabelPattern count (0 | 1 | zero | one | two | few | many | other) #IMPLIED > <!-- count only used for certain patterns" -->

<!ELEMENT characterLabel ( #PCDATA ) >

<!ATTLIST characterLabel type NMTOKEN #REQUIRED >

The character labels can be used for categories or groups of characters in a character picker or keyboard palette. They have the above structure. Items with special meanings are explained below. Many of the categories are based on terms used in Unicode. Consult the Unicode Glossary where the meaning is not clear.

The following are special patterns used in composing labels.

characterLabelPattern
Type English Description of the group specified.
all{0} — all Used where the title {0} is just a subset. For example, {0} might be "Latin", and contain the most common Latin characters. Then "Latin — all" would be all of them.
category-list{0}: {1} Use for a name, where {0} is the main item like "Family", and {1} is a list of one or more components or subcategories. The list is formatted using a list pattern.
compatibility{0} — compatibility For grouping Unicode compatibility characters separately, such as "Arabic — compatibility".
enclosed{0} — enclosed For indicating enclosed forms, such as "digits — enclosed"
extended{0} — extended For indicating a group of "extended" characters (special use, technical, etc.)
historic{0} — historic For indicating a group of "historic" characters (no longer in common use).
miscellaneous{0} — miscellaneous For indicating a group of "miscellaneous" characters (typically that don't fall into a broader class).
other{0} — other Used where the title {0} is just a subset. For example, {0} might be "Latin", and contain the most common Latin characters. Then "Latin — other" would be the rest of them.
scriptsscripts — {0} For indicating a group of "scripts" characters matching {0}. The value for {0} may be a geographic indicator, like "Africa" (although there are specific combinations listed below), or some other designation, like "other" (from below).
strokes{0} strokes Used as an index title for CJK characters. It takes a "count" value, which allows the right plural form to be specified for the language.

The following are character labels. Where the meaning of the label is fairly clear (like "animal") or is in the Unicode glossary, it is omitted.

characterLabel
activitiesactivity Human activities, such as running.
african_scriptsAfrican script Scripts associated with the continent of Africa.
american_scriptsAmerican script Scripts associated with the continents of North and South America.
animals_natureanimal or nature A broad category uses for
arrowsarrow Arrow symbols
bodybody Symbols for body parts, such as an arm.
box_drawingbox drawing Unicode box-drawing characters (geometric shapes)
bullets_starsbullet or star Unicode bullets (such as • or ‣ or ⁍) or stars (★✩✪✵...)
consonantal_jamoconsonantal jamo Korean Jamo consonants.
currency_symbolscurrency symbol Symbols such as $, ¥, £
dash_connectordash or connector Characters like _ or ⁓
dingbatsdingbat Font dingbat characters, such as ❿ or ♜.
downwards_upwards_arrowsdownwards upwards arrow ⇕,...
femalefemale Indicates that a character is female or feminine in appearance.
formatformat A Unicode format character.
format_whitespaceformat & whitespace A Unicode format character or whitespace.
full_width_form_variantfull-width variant Full width variant, such as a wide A.
half_width_form_varianthalf-width variant Narrow width variant, such as a half-width katakana character.
han_charactersHan character Han (aka CJK: Chinese, Japanese, or Korean) ideograph
han_radicalsHan radical Radical (component) used in Han characters.
hanjahanja Korean name for Han character.
hanzi_simplifiedHanzi (simplified) Simplified Chinese ideograph
hanzi_traditionalHanzi (traditional) Traditional Chinese ideograph
historic_scriptshistoric script Script no longer in common modern usage, such as Runes or Hieroglyphs.
ideographic_desc_charactersideographic desc. character Special Unicode characters (see the glossary).
kanjikanji Japanese Han ideograph
keycapkeycap A key on a computer keyboard or phone. For example, the "3" key on a phone or laptop would be "keycap: 3"
limited_uselimited-use Not in common modern use.
malemale Indicates that a character is male or masculine in appearance.
modifiermodifier A Unicode modifier letter or symbol.
nonspacingnonspacing Uses for characters that occupy no width by themselves, such as the ¨ over the a in ä.

14.3 Typographic Names

<!ELEMENT typographicNames ( alias | ( axisName*, styleName*, featureName*, special* ) ) >

<!ELEMENT axisName ( #PCDATA ) >
<!ATTLIST axisName type (ital | opsz | slnt | wdth | wght) #REQUIRED >
<!ATTLIST axisName alt NMTOKENS #IMPLIED >

<!ELEMENT styleName ( #PCDATA ) >
<!ATTLIST styleName type (ital | opsz | slnt | wdth | wght) #REQUIRED >
<!ATTLIST styleName subtype NMTOKEN #REQUIRED >
<!ATTLIST styleName alt NMTOKENS #IMPLIED >

<!ELEMENT featureName ( #PCDATA ) >
<!ATTLIST featureName type (afrc | cpsp | dlig | frac | lnum | onum | ordn | pnum | smcp | tnum | zero) #REQUIRED >
<!ATTLIST featureName alt NMTOKENS #IMPLIED >

The typographic names provide for names of font features for use in a UI. This is useful for apps that show the name of font styles and design axes according to the user’s languages. It would also be useful for system-level libraries.

The identifers (types) use the tags from the OpenType Feature Tag Registry. Given their large number, only the names of frequently-used OpenType feature names are available CLDR. (Many features are not user-visible settings, but instead serve as a data channel for sofware to pass information to the font). The example below shows an approach for using the CLDR data. Of course, applications are free to implement their own algorithms depending on their specific needs.

To find a localized subfamily name such as “Extraleicht Schmal” for a font called “Extralight Condensed”, a system or application library might do the following:

  1. Determine the set of languages in which the subfamily name can potentially be returned.This is the union of the languages for which the font contains ‘name’ table entries with ID 2 or 17, plus the languages for which CLDR supplies typographic names.

  2. Use a language matching algorithm such as in ICU to find the best available language given the user preferences. The resulting subfamily name will be localized to this language.

  3. If the font’s ‘name’ table contains a typographic subfamily name (ID17) in this language and all font variation axes are set to their defaults, return this name.

  4. If the font’s ‘name’ table contains a font subfamilyname (‘name’ID2) in this language and all font variation axes are set to their defaults, return this name.

  5. If the font has a style attributes (STAT) table, lookup the design axis tags and their ordering. If the font has no STAT table, assume [Width, Weight, Slant] as axis ordering, and infer the font’s style atributes from other available data in the font (eg. the OS/2 table).

  6. For each design axis, find a localized style name for its value.
    1. If the font’s style attributes point to a ‘name’ table entry that is available the result language, use this name.
    2. Otherwise, generate a fallback name from CLDR style Name data.
      1. The type key is the OpenType axis tag ( ‘wght’). The subtype and alt keys are taken from the entry in English CLDR where the string is equal to the English name in the font. For example, when the font uses a weight whose English style name is “Extralight”, this will lead to subtype = “200” and alt = “variant”. If there is no match, take the axis value (“200”) for subtype and the empty string for alt.
      2. Look up (type, subtype) in a data table derived from CLDR’s style names. If CLDR supplies multiple alternate names for this (type, subtype), use the one whose “alt” key is matching; otherwise, use the default alternate (which has no “alt” atribute in CLDR).
  7. Concatenate the strings, with a separator between them.