DynamicLocalizer
class DynamicLocalizer<T>(val thresholds: List<DynamicLocalizer.Case.Threshold<T>>, val default: DynamicLocalizer.Case.Default<T>) : PolyglotReferenceDateTimeLocalizer<T>
Special localizer class that allows to pick an arbitrary PolyglotReferenceDateTimeLocalizer based on the current reference time.
On localization, it goes through each one of thresholds, stopping at the first one whose reference is in Case.Threshold.range, and returning its value. If the reference is in none of the thresholds' ranges, default is selected instead.
Note that it is not recommended to provide thresholds that overlap. However, the class will not stop you from doing that and should work correctly regardless.
The next tick is selected with the minimum between the selected case and all thresholds that come before it.
Constructors
Link copied to clipboard
constructor(thresholds: List<DynamicLocalizer.Case.Threshold<T>>, default: DynamicLocalizer.Case.Default<T>)
constructor(vararg cases: DynamicLocalizer.Case.Threshold<T>, default: DynamicLocalizer.Case.Default<T>)