-
Notifications
You must be signed in to change notification settings - Fork 102
Open
Labels
help wantedWe need help making decisions or writing PRs for this.We need help making decisions or writing PRs for this.icu4xMigrate example components to use icu4x instead of custom stubbed out components.Migrate example components to use icu4x instead of custom stubbed out components.
Description
Update (from @gregtatum): This bug is now about about using ICU4X's number formatter to back FluentNumber.
It seems that fluent-rs can parse options for numbers, but not use them.
Looking at FluentNumber::as_string(), the only option that gets used is minimum fraction digits.
pub fn as_string(&self) -> Cow<'static, str> {
let mut val = self.value.to_string();
if let Some(minfd) = self.options.minimum_fraction_digits {
if let Some(pos) = val.find('.') {
let frac_num = val.len() - pos - 1;
let missing = if frac_num > minfd {
0
} else {
minfd - frac_num
};
val = format!("{}{}", val, "0".repeat(missing));
} else {
val = format!("{}.{}", val, "0".repeat(minfd));
}
}
val.into()
}
So, things to implement:
- Percent formatting
- Currency formatting
- Decimal formatting (implicitly assumed, I guess)
- use_grouping
- minimum_integer_digits
- minimum_fraction_digits
- maximum_fraction_digits
- minimum_significant_digits
- maximum_significant_digits
joseluis
Metadata
Metadata
Labels
help wantedWe need help making decisions or writing PRs for this.We need help making decisions or writing PRs for this.icu4xMigrate example components to use icu4x instead of custom stubbed out components.Migrate example components to use icu4x instead of custom stubbed out components.