17 releases (stable)

2.2.0 Apr 1, 2026
2.1.1 Oct 28, 2025
2.0.0 May 7, 2025
2.0.0-beta2 Feb 26, 2025
0.0.1 Apr 29, 2021

#347 in Internationalization (i18n)

Download history 23277/week @ 2025-12-26 35495/week @ 2026-01-02 36686/week @ 2026-01-09 39307/week @ 2026-01-16 41834/week @ 2026-01-23 42309/week @ 2026-01-30 47155/week @ 2026-02-06 44465/week @ 2026-02-13 45666/week @ 2026-02-20 59301/week @ 2026-02-27 88378/week @ 2026-03-06 61739/week @ 2026-03-13 57419/week @ 2026-03-20 51717/week @ 2026-03-27 59333/week @ 2026-04-03 57710/week @ 2026-04-10

235,678 downloads per month
Used in 126 crates (12 directly)

Unicode-3.0

740KB
12K SLoC

icu_list crates.io

Formatting lists in a locale-sensitive way.

This module is published as its own crate (icu_list) and as part of the icu crate. See the latter for more details on the ICU4X project.

Examples

Formatting and lists in Spanish

let list_formatter = ListFormatter::try_new_and(
    locale!("es").into(),
    ListFormatterOptions::default().with_length(ListLength::Wide),
)
.expect("locale should be present");

assert_writeable_eq!(
    list_formatter.format(["España", "Suiza"].iter()),
    "España y Suiza",
);

// The Spanish 'y' sometimes becomes an 'e':
assert_writeable_eq!(
    list_formatter.format(["España", "Suiza", "Italia"].iter()),
    "España, Suiza e Italia",
);

Formatting or lists in Thai

let list_formatter = ListFormatter::try_new_or(
    locale!("th").into(),
    ListFormatterOptions::default().with_length(ListLength::Short),
)
.expect("locale should be present");

// We can use any Writeables as inputs
assert_writeable_eq!(list_formatter.format(1..=3), "1, 2 หรือ 3",);

Formatting unit lists in English

let list_formatter = ListFormatter::try_new_unit(
    locale!("en").into(),
    ListFormatterOptions::default().with_length(ListLength::Wide),
)
.expect("locale should be present");

assert_writeable_eq!(
    list_formatter.format(["1ft", "2in"].iter()),
    "1ft, 2in",
);

Note: this last example is not fully internationalized. See icu4x/2192 for full unit handling.

More Information

For more information on development, authorship, contributing etc. please visit ICU4X home page.

Dependencies

~1.7–3.5MB
~52K SLoC