Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Common/UnitDefinitions/Volume.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
"PluralName": "UsGallons",
"FromUnitToBaseFunc": "x*0.00378541",
"FromBaseToUnitFunc": "x/0.00378541",
"Prefixes": [ "Kilo", "Mega" ],
"Prefixes": [ "Deca", "Deci", "Hecto", "Kilo", "Mega" ],
Copy link
Owner

@angularsen angularsen Apr 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mentioned reports using 'cGal'/'100 Gal' and 'kGal'/'1000 Gal'.

Please note:

  1. The abbreviations used by ToString() will in this PR be dgal (U.S.) and hgal (U.S.) etc.
  2. Volume.Parse("5 cGal (U.S.)") will throw an exception, because parsing is currently case sensitive.

If you really want ToString() and Parse() to support using uppercase Gal, then you need to add that Gal (U.S.) abbreviation to the end of the Abbreviations array below. It would still need the (U.S.) suffix to be consistent with our naming conventions though..

To use a specific abbreviation in ToString(), take a look at custom string formatting.

If you are fine with the existing lowercase gal (U.S.) abbreviation, then I recommend not adding Gal (U.S.) unless it will actually be used.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#781 is now merged, so this is point is no longer relevant :-) This PR is then good to go!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@angularsen Sorry for delay with my reply. You see, in our system exists a few different names for the same unit. First company names it "kGal", the second - "100 Gal", the third - "Hundred Gallons" and so on. Thus I don't think that there is any standard name of those units in the States, and if there is actually one, looks like no one really respects it. So I would leave it as it is now. :-)

"Localization": [
{
"Culture": "en-US",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions UnitsNet.Tests/CustomCode/VolumeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,17 @@ public class VolumeTests : VolumeTestsBase

protected override double CubicYardsInOneCubicMeter => 1.30795062;

protected override double DecausGallonsInOneCubicMeter => 2.6417217e+1;

protected override double DecilitersInOneCubicMeter => 1E4;
protected override double DeciusGallonsInOneCubicMeter => 2.6417217e+3;
protected override double HectocubicFeetInOneCubicMeter => 3.531472e-1;
protected override double HectocubicMetersInOneCubicMeter => 0.01;

protected override double HectolitersInOneCubicMeter => 1E1;

protected override double HectousGallonsInOneCubicMeter => 2.6417217;

protected override double ImperialGallonsInOneCubicMeter => 219.96924;

protected override double ImperialOuncesInOneCubicMeter => 35195.07972;
Expand Down
243 changes: 144 additions & 99 deletions UnitsNet.Tests/GeneratedCode/TestsBase/VolumeTestsBase.g.cs

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions UnitsNet/GeneratedCode/Quantities/Volume.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading