-
Notifications
You must be signed in to change notification settings - Fork 382
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 overridden abbrev #833
base: master
Are you sure you want to change the base?
Conversation
…allback/override behavior
Codecov Report
@@ Coverage Diff @@
## master #833 +/- ##
=======================================
Coverage 80.54% 80.55%
=======================================
Files 281 281
Lines 41925 41936 +11
=======================================
+ Hits 33770 33783 +13
+ Misses 8155 8153 -2
Continue to review full report at Codecov.
|
abbreviations.UnionWith(lookup!.GetAbbreviationsForUnit(unitValue)); | ||
|
||
if(formatProvider != FallbackCulture) | ||
abbreviations.UnionWith(GetUnitAbbreviations(unitType, unitValue, FallbackCulture)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance, I'm not sure about this union.
If you call GetUnitAbbreviations(typeof(LengthUnit), 1, russianCulture)
then from this public method signature, isn't it unexpected to also receive English abbreviations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good question :) Should it? Currently you can get English abbreviations from GetUnitAbbreviations, but only if no Russian ones exist.
The parser obviously will not fall back without it. It's either that, or the parser logic will need to include the fallback logic. I wanted to keep everything contained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really not sure. How about adding a new parameter bool includeFallbackCulture = false
and call it with true
from our own usages where we need to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think we should not do a union here indiscriminately. What do you think of my proposal of a new argument?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Fixes #832