RxMetricUnitFormatUtils
Observable formatting, for UI that should follow the player's language. Kept apart from MetricUnitFormatUtils so formatting itself needs no Rx and runs anywhere, servers and specs included.
Functions
observeFormat
Observes MetricUnitFormatUtils.format in the translator's language: emits again when the player's locale
changes or its translations finish streaming in, with English names until then. Numbers follow the translator's
locale unless options.locale is given.
local translator = serviceBag:GetService(require("MetricUnitTranslator"))
maid:GiveTask(RxMetricUnitFormatUtils.observeFormat(translator, MetricUnit.new(3, "mile"), {
unitDisplay = "long",
}):Subscribe(function(text)
label.Text = text -- "3 miles", "3 millas", "3 Meilen"
end))