Package org.jboss.elemento.intl
Class ListFormat
java.lang.Object
org.jboss.elemento.intl.ListFormat
@JsType(isNative=true,
namespace="<global>",
name="Intl.ListFormat")
public class ListFormat
extends Object
Mapping for
Intl.ListFormat.
var vehicles = JsArray.of("Motorcycle", "Bus", "Car");
var formatter = new ListFormat("en", ListFormatOptions.create()
.style(long_)
.type(conjunction));
console.log(formatter.format(vehicles));
// Expected output: "Motorcycle, Bus, and Car"
var formatter2 = new ListFormat("de", ListFormatOptions.create()
.style(short_)
.type(disjunction));
console.log(formatter2.format(vehicles));
// Expected output: "Motorcycle, Bus oder Car"
var formatter3 = new ListFormat("en", ListFormatOptions.create()
.style(narrow)
.type(unit));
console.log(formatter3.format(vehicles));
// Expected output: "Motorcycle Bus Car"
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionListFormat(String locale) ListFormat(String locale, ListFormatOptions options) ListFormat(jsinterop.base.JsArrayLike<String> locales) ListFormat(jsinterop.base.JsArrayLike<String> locales, ListFormatOptions options) ListFormat(ListFormatOptions options) -
Method Summary
Modifier and TypeMethodDescriptionformatToParts(JsArray<String> list) jsinterop.base.JsPropertyMap<String> supportedLocalesOf(String locale) supportedLocalesOf(String locale, SupportOptions options) supportedLocalesOf(jsinterop.base.JsArrayLike<String> locales) supportedLocalesOf(jsinterop.base.JsArrayLike<String> locales, SupportOptions options)
-
Constructor Details
-
ListFormat
public ListFormat() -
ListFormat
-
ListFormat
-
ListFormat
-
ListFormat
-
ListFormat
-
-
Method Details
-
supportedLocalesOf
-
supportedLocalesOf
-
supportedLocalesOf
-
supportedLocalesOf
public static JsArray<String> supportedLocalesOf(jsinterop.base.JsArrayLike<String> locales, SupportOptions options) -
format
-
formatToParts
-
resolvedOptions
-