diff options
Diffstat (limited to 'vendor/icu_list/README.md')
-rw-r--r-- | vendor/icu_list/README.md | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/vendor/icu_list/README.md b/vendor/icu_list/README.md index d17e8a8d7..a0b4680f2 100644 --- a/vendor/icu_list/README.md +++ b/vendor/icu_list/README.md @@ -1,5 +1,7 @@ # icu_list [![crates.io](https://img.shields.io/crates/v/icu_list)](https://crates.io/crates/icu_list) +<!-- cargo-rdme start --> + Formatting lists in a locale-sensitive way. This module is published as its own crate ([`icu_list`](https://docs.rs/icu_list/latest/icu_list/)) @@ -10,13 +12,11 @@ and as part of the [`icu`](https://docs.rs/icu/latest/icu/) crate. See the latte ### Formatting *and* lists in Spanish ```rust -# -let list_formatter = ListFormatter::try_new_and_with_length_unstable( - &icu_testdata::unstable(), +let list_formatter = ListFormatter::try_new_and_with_length( &locale!("es").into(), ListLength::Wide, ) -.expect("Data should load successfully"); +.expect("locale should be present"); assert_writeable_eq!( list_formatter.format(["España", "Suiza"].iter()), @@ -33,13 +33,11 @@ assert_writeable_eq!( ### Formatting *or* lists in Thai ```rust -# -let list_formatter = ListFormatter::try_new_or_with_length_unstable( - &icu_testdata::unstable(), +let list_formatter = ListFormatter::try_new_or_with_length( &locale!("th").into(), ListLength::Short, ) -.expect("Data should load successfully"); +.expect("locale should be present"); // We can use any Writeables as inputs assert_writeable_eq!(list_formatter.format(1..=3), "1, 2 หรือ 3",); @@ -48,13 +46,11 @@ assert_writeable_eq!(list_formatter.format(1..=3), "1, 2 หรือ 3",); ### Formatting unit lists in English ```rust -# -let list_formatter = ListFormatter::try_new_unit_with_length_unstable( - &icu_testdata::unstable(), +let list_formatter = ListFormatter::try_new_unit_with_length( &locale!("en").into(), ListLength::Wide, ) -.expect("Data should load successfully"); +.expect("locale should be present"); assert_writeable_eq!( list_formatter.format(["1ft", "2in"].iter()), @@ -64,6 +60,8 @@ assert_writeable_eq!( Note: this last example is not fully internationalized. See [icu4x/2192](https://github.com/unicode-org/icu4x/issues/2192) for full unit handling. +<!-- cargo-rdme end --> + ## More Information For more information on development, authorship, contributing etc. please visit [`ICU4X home page`](https://github.com/unicode-org/icu4x). |