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

Fix: Auto-detection of PluralLocalizationFormatter does not throw for values not convertible to decimal #330

Merged
merged 2 commits into from
Feb 19, 2023

Conversation

axunonb
Copy link
Member

@axunonb axunonb commented Feb 19, 2023

Resolves #329

Current behavior, introduced in v3.2.0:

When PluralLocalizationFormatter.CanAutoDetect == true, values that are not convertible to decimal will throw then trying to IConvertible.ToDecimal(...)

New behavior:

When PluralLocalizationFormatter.CanAutoDetect == true, for values that are not convertible to decimal, IFormatter.TryEvaluateFormat(...) will return false

@karljj1 Makes sense?

Current behavior, introduced in v3.2.0:
When PluralLocalizationFormatter.CanAutoDetect == true, values not convertible to decimal will throw then trying to IConvertible.ToDecimal(...)

New behavior:
When PluralLocalizationFormatter.CanAutoDetect == true, for values not convertible to decimal, IFormatter.TryEvaluateFormat(...) will return false
@axunonb axunonb self-assigned this Feb 19, 2023
@codecov
Copy link

codecov bot commented Feb 19, 2023

Codecov Report

Base: 96% // Head: 96% // Increases project coverage by +0% 🎉

Coverage data is based on head (78cdf94) compared to base (a6feb2e).
Patch coverage: 100% of modified lines in pull request are covered.

❗ Current head 78cdf94 differs from pull request most recent head 49a3622. Consider uploading reports for the commit 49a3622 to get more accurate results

Additional details and impacted files
@@         Coverage Diff         @@
##           main   #330   +/-   ##
===================================
  Coverage    96%    96%           
===================================
  Files        91     91           
  Lines      3185   3191    +6     
===================================
+ Hits       3069   3075    +6     
  Misses      116    116           
Impacted Files Coverage Δ
...rtFormat/Extensions/PluralLocalizationFormatter.cs 92% <100%> (+1%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@karljj1
Copy link
Collaborator

karljj1 commented Feb 19, 2023

Resolves #329

Current behavior, introduced in v3.2.0:

When PluralLocalizationFormatter.CanAutoDetect == true, values that are not convertible to decimal will throw then trying to IConvertible.ToDecimal(...)

New behavior:

When PluralLocalizationFormatter.CanAutoDetect == true, for values that are not convertible to decimal, IFormatter.TryEvaluateFormat(...) will return false

@karljj1 Makes sense?

Make sense. Looks good to me. Nice catch.

@axunonb axunonb merged commit 3336607 into axuno:main Feb 19, 2023
@axunonb axunonb deleted the pr/fix-false-positive-auto-detection branch February 19, 2023 19:19
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 this pull request may close these issues.

Issue with PluralLocalizationFormatter.TryEvaluateFormat in v3.2.0
2 participants