Apply number formatting when using FluentNumberOptions
This pull request aims to fill a gap found in the code regarding number formatting.
According to the code, 5 different format options are allowed regarding a number's length, considering rear and trailing zeroes when needed. These options are listed in the struct [`FluentNumberOptions`](https://github.com/projectfluent/fluent-rs/blob/f2033ce8340e09000ad9efccd6215b3fa5c23496/fluent-bundle/src/types/number.rs#L67).
However, I can't figure out what is the expected difference between `FluentNumberOptions.maximum_significant_digits` and `FluentNumberOptions.maximum_fraction_digits`; and between `FluentNumberOptions.minimum_fraction_digits` and `FluentNumberOptions.minimum_significant_digits`. I'll consider those redundant, and I won't implement any specific formatting unless someone tells me what's the difference.
The current implementation:
https://github.com/projectfluent/fluent-rs/blob/f2033ce8340e09000ad9efccd6215b3fa5c23496/fluent-bundle/src/types/number.rs#L148C1-L165C2
Only considers the option `FluentNumberOptions.minimum_fraction_digits`, thus all the other options are simply ignored when provided. This was already reported by #368.
I'd like to work on a proposal for the implementation of such missing logic. I've added a few unit tests that show what kind of formatting shall be expected when using the options. So the idea is to implement the code that make those test to pass.
Please, let me know if I'm missing something.
_Notes for the reviewers:_ I added [Rstest](https://crates.io/crates/rstest) as a _dev-dependency_, if that is not acceptable, I'll rewrite the tests that I pushed.
Closes #368
合并状态:未合并 5 条评论