Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maximum_fraction_digits doesn't do anything #368

Open
nazar-pc opened this issue Aug 3, 2024 · 1 comment · May be fixed by #377
Open

maximum_fraction_digits doesn't do anything #368

nazar-pc opened this issue Aug 3, 2024 · 1 comment · May be fixed by #377

Comments

@nazar-pc
Copy link
Contributor

nazar-pc commented Aug 3, 2024

Setting this doesn't seem to have any effect whatsoever. I see it is set in the example here, but the input value doesn't have enough floating point digits to actually check it or else assertion would fail:

let num = FluentNumber::new(
25.2,
FluentNumberOptions {
maximum_fraction_digits: Some(8),
minimum_fraction_digits: Some(1),
..Default::default()
},
);
args.set("num", num);
let value = bundle.format_pattern(pattern, Some(&args), &mut errors);
// Notice, that since we specified minimum and maximum fraction digits options
// to be 1 and 8 when construction the argument, and then the minimum fraction
// digits option has been overridden in the localization the formatter
// will received options:
// - minimum_fraction_digits: Some(5)
// - maximum_fraction_digits: Some(8)
assert_eq!(
value,
"Here is an explicitly encoded variable: CUSTOM(25.2)."
);

@nazar-pc
Copy link
Contributor Author

nazar-pc commented Aug 3, 2024

According to fluent-bundle/src/types/number.rs most of the options seem to be doing nothing 😕

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant