[PTRun][Unit]Support for plural units and improve alternative spellings (#19961)

* Upgrade UnitsNet package to a version that supports plural

* Add support for plurals

Fix metre conversion
Add and update unit tests
This commit is contained in:
Floris Westerman
2022-08-24 11:50:34 +02:00
committed by GitHub
parent 13db8575e0
commit f44bf99dfd
8 changed files with 54 additions and 43 deletions

View File

@@ -169,19 +169,12 @@ namespace Community.PowerToys.Run.Plugin.UnitConverter
}
/// <summary>
/// Converts spelling "metre" to "meter"
/// Converts spelling "metre" to "meter", also for centimetre and other variants
/// </summary>
public static void MetreToMeter(ref string[] split)
{
if (split[1].ToLowerInvariant() == "metre")
{
split[1] = "meter";
}
if (split[3].ToLowerInvariant() == "metre")
{
split[3] = "meter";
}
split[1] = split[1].Replace("metre", "meter", System.StringComparison.CurrentCultureIgnoreCase);
split[3] = split[3].Replace("metre", "meter", System.StringComparison.CurrentCultureIgnoreCase);
}
/// <summary>