RelativeDurationOptions
data class RelativeDurationOptions(val minUnit: DurationUnit = DurationUnit.SECONDS, val maxUnit: DurationUnit? = null, val style: RelativeUnitStyle = RelativeUnitStyle.LONG, val ifZeroLocalization: IfZeroLocalization = {
if (minUnit == DurationUnit.SECONDS) {
localizeNow()
} else {
null
}
}) : PolyglotLocalizerOptions<RelativeDurationLocalizer>
Localization options for RelativeDurationLocalizer and Duration.localizeRelative
Constructors
Link copied to clipboard
constructor(minUnit: DurationUnit = DurationUnit.SECONDS, maxUnit: DurationUnit? = null, style: RelativeUnitStyle = RelativeUnitStyle.LONG, ifZeroLocalization: IfZeroLocalization = {
if (minUnit == DurationUnit.SECONDS) {
localizeNow()
} else {
null
}
})
Properties
Link copied to clipboard
string that will be returned as-is in case if the computed unit is zero. Note that this doesn't necessarily mean that the passed Duration is itself Duration.ZERO, but rather that it's smaller than the minUnit. If this returns null, the default 0 <min-unit> localized string will be used. By default, this localizes the string "now" if the min unit is seconds, returns null otherwise.
Link copied to clipboard
Link copied to clipboard
the smallest unit that will be in output. If the Duration is smaller, 0 <min-unit> will be returned (see also the ifZeroLocalization parameter)
Link copied to clipboard
the style of the duration unit