Introduction¶
Cosmo formats money, dates, numbers, units, and text using the conventions of a locale. Set a locale and, for date and time formatting, a time zone, then call the formatter you need.
Cosmo uses ICU for locale data and formatting:
import com.miloun.cosmo.Cosmo;
Cosmo c = new Cosmo("es_ES");
c.money(11000.4, "EUR"); // "11.000,40 €"
c.percentage(0.2); // "20%"
Locale data from ICU¶
Cosmo reads locale data from ICU rather than maintaining its own tables. The library uses ICU4J.
See Platform notes for supported features and limitations.
Next steps¶
- Getting started — install and your first formatted value
- Guide — every feature, with side-by-side examples
- API reference — the complete method list
- Feature parity — what's available where