Interface ListFormatOptions
@JsType(isNative=true,
namespace="<global>")
public interface ListFormatOptions
Mapping for list
format options passed to
ListFormat constructors.
In addition to the actual mappings, this class implements the builder pattern using enums to create the options easily and in
a type-safe manner. Some enums are shared with other format option builders of the Intl module and may contain
more values than intended for the given method. In that case the allowed values are listed on the method. In all other cases
all enum values are applicable.
var vehicles = JsArray.of("Motorcycle", "Bus", "Car");
var formatter = listFormat("en", listFormatOptions()
.style(long_)
.type(conjunction));
console.log(formatter.format(vehicles));
// Expected output: "Motorcycle, Bus, and Car"
var formatter2 = listFormat("de", listFormatOptions()
.style(short_)
.type(disjunction));
console.log(formatter2.format(vehicles));
// Expected output: "Motorcycle, Bus oder Car"
var formatter3 = listFormat("en", listFormatOptions()
.style(narrow)
.type(unit));
console.log(formatter3.format(vehicles));
// Expected output: "Motorcycle Bus Car"
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic ListFormatOptionsdefault ListFormatOptionslocalMatcher(Matcher localeMatcher) Allowed values:Matcher.lookup,Matcher.bestFit.voidsetLocaleMatcher(String localeMatcher) voidvoiddefault ListFormatOptionsdefault ListFormatOptions
-
Method Details
-
listFormatOptions
-
setLocaleMatcher
-
setStyle
-
setType
-
localMatcher
Allowed values:Matcher.lookup,Matcher.bestFit. -
type
-
style
-