Skip to content

Commit 089b391

Browse files
committed
Add special cases for units when using the system's locale.
1 parent 35a890e commit 089b391

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Source/Contrib/ContentManager/ContentManagerGUI.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,15 @@ public ContentManagerGUI()
7676
ContentManager = new ContentManager(Settings.Folders);
7777

7878
// add unit settings to ContentInfo static class; only considering explict setting or system setting
79-
ContentInfo.IsMetric = Settings.Units == "Metric" || (Settings.Units == "Automatic" && System.Globalization.RegionInfo.CurrentRegion.IsMetric) || (Settings.Units == "Route" && System.Globalization.RegionInfo.CurrentRegion.IsMetric);
80-
ContentInfo.IsUK = Settings.Units == "UK";
79+
if (Settings.Units == "Metric") { ContentInfo.IsMetric = true; }
80+
else if (Settings.Units == "UK") { ContentInfo.IsUK = true; }
81+
else // setting is Automatic or Route
82+
{
83+
ContentInfo.IsMetric = System.Globalization.RegionInfo.CurrentRegion.IsMetric;
84+
// special cases
85+
if (System.Globalization.RegionInfo.CurrentRegion.Name == "UK") { ContentInfo.IsUK = true; }
86+
else if (System.Globalization.RegionInfo.CurrentRegion.Name == "CA") { ContentInfo.IsMetric = false; } // Canada is metric, but RRs use imperial US
87+
}
8188

8289
// Start off the tree with the Content Manager itself at the root and expand to show packages.
8390
treeViewContent.Nodes.Add(CreateContentNode(ContentManager));

0 commit comments

Comments
 (0)