Package limn.i18n

Enum Class NumberingSystem

java.lang.Object
java.lang.Enum<NumberingSystem>
limn.i18n.NumberingSystem
All Implemented Interfaces:
Serializable, Comparable<NumberingSystem>, Constable

public enum NumberingSystem extends Enum<NumberingSystem>
The digits a formatted number is written in: one zero code point and its nine successors, which is all a decimal numbering system is. Resolved from the UI language by I18n.numberingSystem() and applied at format time through I18n.localizeDigits(java.lang.String); nothing at the shaping or drawing layer knows this type exists.

The table below is CLDR's, checked against it. scripts/i18n/dump-cldr-locale-facts.mjs reads Node's Intl.NumberFormat, which is CLDR through ICU, and CldrLocaleFactsTest holds forLocale(java.util.Locale) to the dump. That check found the first hand-written table inverted where it mattered most: it answered ARAB for plain ar and treated the Maghreb as the exception, where CLDR makes Latin the Arabic default and names twenty-three regions that write Arabic-Indic digits. A reader in Dubai or Casablanca was shown digits no application beside ours uses. Being CLDR's data, the table is under the Unicode License v3, whose text the toolkit's jar carries at limn/i18n/internal/CLDR-LICENSE.txt.

Seven systems CLDR names for a language are deliberately absent, and a locale that wants one gets LATN until they are added: Bengali (as, bn, mni), Burmese (my), Tibetan (dz), Chakma (ccp), N'Ko (nqo), Ol Chiki (sat) and Adlam (Fulah written in it, ff-Adlm). Each is a constant and a table row away, and what gates them is not this class but the glyph coverage test — a numbering system whose digits the vendored fonts cannot draw is worse than Latin ones. CldrLocaleFactsTest names them as known gaps rather than letting them read as oversights.

DEVA is chosen automatically, for the languages CLDR gives it to — Marathi, Nepali, Sanskrit, Bhojpuri, Haryanvi and Rajasthani — and not for Hindi, which CLDR writes in Latin digits. Until 2026-09-21 it was reachable only through I18n.setNumberingSystem(limn.i18n.NumberingSystem), on the belief that no language defaulted to it.

A 1.x minor release may add constants to this enum: a switch over it needs a default branch.

  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Arabic-Indic ٠–٩ (U+0660–0669): Arabic in the twenty-three regions below, Najdi Arabic, Central Kurdish, and Sindhi in Arabic script, which is Sindhi everywhere but India.
    Extended Arabic-Indic ۰–۹ (U+06F0–06F9): Persian, Pashto, Mazanderani, Northern Luri, Kashmiri except in Devanagari, Punjabi and Uzbek in Arabic script, and Urdu in India.
    Devanagari ०–९ (U+0966–096F): Marathi, Nepali, Sanskrit, Bhojpuri, Haryanvi, Rajasthani — and never Hindi.
    ASCII 0–9: the default, and the system every parse normalizes to.
  • Method Summary

    Modifier and Type
    Method
    Description
    char
    digit(int value)
    The digit value (0–9) is written as in this system.
    static int
    digitValue(int codepoint)
    The numeric value of codepoint in any system this enum knows, or -1.
    forLocale(Locale locale)
    CLDR's default system for locale, over the systems this enum carries.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • LATN

      public static final NumberingSystem LATN
      ASCII 0–9: the default, and the system every parse normalizes to.
    • ARAB

      public static final NumberingSystem ARAB
      Arabic-Indic ٠–٩ (U+0660–0669): Arabic in the twenty-three regions below, Najdi Arabic, Central Kurdish, and Sindhi in Arabic script, which is Sindhi everywhere but India.
    • ARABEXT

      public static final NumberingSystem ARABEXT
      Extended Arabic-Indic ۰–۹ (U+06F0–06F9): Persian, Pashto, Mazanderani, Northern Luri, Kashmiri except in Devanagari, Punjabi and Uzbek in Arabic script, and Urdu in India.
    • DEVA

      public static final NumberingSystem DEVA
      Devanagari ०–९ (U+0966–096F): Marathi, Nepali, Sanskrit, Bhojpuri, Haryanvi, Rajasthani — and never Hindi.
  • Method Details

    • values

      public static NumberingSystem[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static NumberingSystem valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • digit

      public char digit(int value)
      The digit value (0–9) is written as in this system.
    • digitValue

      public static int digitValue(int codepoint)
      The numeric value of codepoint in any system this enum knows, or -1. Deliberately not restricted to one system: a parse that folded only the active system's digits would reject a pasted value the moment the locale changed under it.
    • forLocale

      public static NumberingSystem forLocale(Locale locale)
      CLDR's default system for locale, over the systems this enum carries.

      Every branch is a row of cldr-locale-facts.txt and none of it is reasoned from the shape of a language: Sindhi writes Arabic-Indic digits at home and Latin ones in India, Punjabi writes Latin digits except in Pakistan, and Urdu writes Latin digits except in India, which no rule about scripts would predict. What CLDR writes in Bengali, Burmese, Tibetan, Chakma, N'Ko, Ol Chiki or Adlam digits answers LATN, since this enum does not carry those systems; the class note says why.

      A script the locale names decides before its region does, where CLDR holds the language in that script, because a region stands for the script the language is written in there and a named script says so outright: Punjabi in Pakistan is Punjabi in Arabic script, and Punjabi in Gurmukhi writes Latin digits in Pakistan too. So Sindhi in Devanagari writes Latin digits and Sindhi in Arabic script Arabic-Indic ones even in India, Kashmiri in Devanagari writes Latin digits, Punjabi and Uzbek in Arabic script write Extended Arabic-Indic digits in every region, and Uzbek in Latin or Cyrillic keeps Latin ones in Afghanistan. A script CLDR does not hold the language in, Arabic in Latin script say, is read as no script at all, and the language and its region decide.

      A code ICU reads as another language is read as that language before anything is decided, as ICU reads it before it looks anything up: pes, the ISO 639-3 code for Iranian Persian, writes what fa writes, and arb-EG, Standard Arabic in Egypt, what ar-EG writes. Locale replaces only iw, ji and in on its own. A replacement that carries a region or a script fills in only what the locale leaves out: prs, Dari, is fa-AF, and prs-IR is fa-IR. The codes are every one ICU replaces, the same ones the plural rules, the string bundles and the calendars read a locale through. A region named by its UN number is read the same way, as the region it stands for: ar-818 writes what ar-EG writes, and so is a retired one: ar-YD, South Yemen, writes what ar-YE writes.

      A locale that names its digits decides first: the Unicode extension -u-nu-, as a user's system settings write a choice of digits that is not the language's default, so ar-EG-u-nu-latn writes Latin digits and en-u-nu-arab Arabic-Indic ones. A system the extension names and this enum does not carry is read as no extension at all.

      Parameters:
      locale - the locale to classify
      Returns:
      the system the locale names, else the one CLDR gives it, else LATN