diff --git a/Common/UnitDefinitions/Duration.json b/Common/UnitDefinitions/Duration.json index 061fc3b3a5..96568172e0 100644 --- a/Common/UnitDefinitions/Duration.json +++ b/Common/UnitDefinitions/Duration.json @@ -136,8 +136,8 @@ }, { "Culture": "ru-RU", - "Abbreviations": [ "с" ], - "AbbreviationsWithPrefixes": [ "нс", "мкс", "мс" ] + "Abbreviations": [ "с", "сек" ], + "AbbreviationsWithPrefixes": [ ["нс", "нсек"], ["мкс", "мксек"], ["мс", "мсек"] ] } ] } diff --git a/UnitsNet.Tests/CustomCode/DurationTests.cs b/UnitsNet.Tests/CustomCode/DurationTests.cs index 39b0ccee85..4facb8eab1 100644 --- a/UnitsNet.Tests/CustomCode/DurationTests.cs +++ b/UnitsNet.Tests/CustomCode/DurationTests.cs @@ -3,6 +3,7 @@ using Xunit; using System; +using System.Globalization; namespace UnitsNet.Tests.CustomCode { @@ -164,5 +165,21 @@ public void DurationTimesVolumeFlowEqualsVolume() Volume volume = Duration.FromSeconds(20) * VolumeFlow.FromCubicMetersPerSecond(2); Assert.Equal(Volume.FromCubicMeters(40), volume); } + + [Theory] + [InlineData("1s", 1)] + [InlineData("2 seconds", 2)] + [InlineData("1 ms", 1e-3)] + [InlineData("1000 msec", 1)] + [InlineData("1 с", 1, "ru-RU")] + [InlineData("1 сек", 1, "ru-RU")] + [InlineData("1000 мс", 1, "ru-RU")] + [InlineData("1000 мсек", 1, "ru-RU")] + public void DurationFromStringUsingMultipleAbbreviationsParsedCorrectly(string textValue, double expectedSeconds, string culture = null) + { + var cultureInfo = culture == null ? null : new CultureInfo(culture); + + AssertEx.EqualTolerance(expectedSeconds, Duration.Parse(textValue, cultureInfo).Seconds, SecondsTolerance); + } } } diff --git a/UnitsNet.Tests/CustomCode/MolarityTests.cs b/UnitsNet.Tests/CustomCode/MolarityTests.cs index 229098406e..c7cfadd076 100644 --- a/UnitsNet.Tests/CustomCode/MolarityTests.cs +++ b/UnitsNet.Tests/CustomCode/MolarityTests.cs @@ -103,12 +103,10 @@ public void OneMolarFromStringParsedCorrectly() Assert.Equal(Molarity.Parse("1M"), Molarity.Parse("1 mol/L")); } - [Fact(Skip = "Awaiting fix for https://github.com/angularsen/UnitsNet/issues/344")] + [Fact] public void OneMilliMolarFromStringParsedCorrectly() { - var one_mM = Molarity.Parse("1000 mM"); - - Assert.Equal(1, one_mM.MolesPerLiter); + Assert.Equal(1, Molarity.Parse("1000 mM").MolesPerLiter); } } diff --git a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs index d59eca7fa8..fc54d544e3 100644 --- a/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet.WindowsRuntimeComponent/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -72,14 +72,17 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µdeg"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µrad"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µрад"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"mdeg"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mrad"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mрад"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"ndeg"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nrad"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nрад"}), @@ -127,28 +130,40 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(BitRateUnit), (int)BitRateUnit.BitPerSecond, new string[]{"bit/s", "bps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.BytePerSecond, new string[]{"B/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabitPerSecond, new string[]{"Ebit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabitPerSecond, new string[]{"Ebps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabytePerSecond, new string[]{"EB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibitPerSecond, new string[]{"Eibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibitPerSecond, new string[]{"Eibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibytePerSecond, new string[]{"EiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibitPerSecond, new string[]{"Gibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibitPerSecond, new string[]{"Gibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibytePerSecond, new string[]{"GiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabitPerSecond, new string[]{"Gbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabitPerSecond, new string[]{"Gbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabytePerSecond, new string[]{"GB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibitPerSecond, new string[]{"Kibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibitPerSecond, new string[]{"Kibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibytePerSecond, new string[]{"KiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobitPerSecond, new string[]{"kbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobitPerSecond, new string[]{"kbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobytePerSecond, new string[]{"kB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibitPerSecond, new string[]{"Mibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibitPerSecond, new string[]{"Mibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibytePerSecond, new string[]{"MiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabitPerSecond, new string[]{"Mbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabitPerSecond, new string[]{"Mbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabytePerSecond, new string[]{"MB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibitPerSecond, new string[]{"Pibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibitPerSecond, new string[]{"Pibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibytePerSecond, new string[]{"PiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabitPerSecond, new string[]{"Pbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabitPerSecond, new string[]{"Pbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabytePerSecond, new string[]{"PB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibitPerSecond, new string[]{"Tibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibitPerSecond, new string[]{"Tibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibytePerSecond, new string[]{"TiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabitPerSecond, new string[]{"Tbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabitPerSecond, new string[]{"Tbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabytePerSecond, new string[]{"TB/s"}), ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, new string[]{"g/kWh"}), ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, new string[]{"kg/J"}), @@ -212,17 +227,38 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"h", "hr", "hrs", "hour", "hours"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"ч"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µs"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µsec"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µsecs"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µsecond"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µseconds"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мкс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мксек"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мкс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мксек"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"ms"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"msec"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"msecs"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"msecond"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"mseconds"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мсек"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мсек"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"m", "min", "minute", "minutes"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"мин"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"mo", "month", "months"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"месяц"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"ns"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"nsec"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"nsecs"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"nsecond"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"nseconds"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нсек"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нсек"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"s", "sec", "secs", "second", "seconds"}), - ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"с"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"с", "сек"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"wk", "week", "weeks"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"мин"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Year365, new string[]{"yr", "year", "years"}), @@ -557,6 +593,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"kg"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"кг"}), ("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klb"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klbs"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klbm"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"kфунт"}), ("en-US", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"kt"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"кт"}), @@ -564,6 +602,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"long tn"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"тонна большая"}), ("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlb"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlbs"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlbm"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mфунт"}), ("en-US", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Mt"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Мт"}), @@ -721,13 +761,19 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.KilojoulePerMoleKelvin, new string[]{"kJ/(mol*K)"}), ("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.MegajoulePerMoleKelvin, new string[]{"MJ/(mol*K)"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.CentimolesPerLiter, new string[]{"cmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.CentimolesPerLiter, new string[]{"cM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.DecimolesPerLiter, new string[]{"dmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.DecimolesPerLiter, new string[]{"dM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MicromolesPerLiter, new string[]{"µmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MicromolesPerLiter, new string[]{"µM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MillimolesPerLiter, new string[]{"mmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MillimolesPerLiter, new string[]{"mM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerCubicMeter, new string[]{"mol/m³"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerLiter, new string[]{"mol/L", "M"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.NanomolesPerLiter, new string[]{"nmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.NanomolesPerLiter, new string[]{"nM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.PicomolesPerLiter, new string[]{"pmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.PicomolesPerLiter, new string[]{"pM"}), ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"cg/mol"}), ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"сг/моль"}), ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.DecagramPerMole, new string[]{"dag/mol"}), @@ -856,6 +902,7 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Kilopascal, new string[]{"кПа"}), ("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareFoot, new string[]{"kipf/ft²"}), ("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareInch, new string[]{"kipf/in²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareInch, new string[]{"kipf/in²"}), ("en-US", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mbar"}), ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mбар"}), ("en-US", typeof(PressureUnit), (int)PressureUnit.MeganewtonPerSquareMeter, new string[]{"MN/m²"}), @@ -928,14 +975,17 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/s", "deg/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/s"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µdeg/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µrad/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µрад/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/s"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"mdeg/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mrad/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mрад/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/s"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"ndeg/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nrad/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nрад/с"}), @@ -946,10 +996,14 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"r/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"об/с"}), ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.KilonewtonMeterPerRadian, new string[]{"kN·m/rad"}), + ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.KilonewtonMeterPerRadian, new string[]{"kNm/rad"}), ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.MeganewtonMeterPerRadian, new string[]{"MN·m/rad"}), + ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.MeganewtonMeterPerRadian, new string[]{"MNm/rad"}), ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.NewtonMeterPerRadian, new string[]{"N·m/rad", "Nm/rad"}), ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, new string[]{"kN·m/rad/m"}), + ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, new string[]{"kNm/rad/m"}), ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, new string[]{"MN·m/rad/m"}), + ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, new string[]{"MNm/rad/m"}), ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, new string[]{"N·m/rad/m", "Nm/rad/m"}), ("en-US", typeof(SolidAngleUnit), (int)SolidAngleUnit.Steradian, new string[]{"sr"}), ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.BtuPerPound, new string[]{"btu/lb"}), @@ -1194,6 +1248,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.AcreFootPerMinute, new string[]{"af/m"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.AcreFootPerSecond, new string[]{"af/s"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerDay, new string[]{"cl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerDay, new string[]{"cL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerDay, new string[]{"cLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerMinute, new string[]{"cLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"dm³/min"}), ("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"дм³/мин"}), @@ -1213,8 +1269,12 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerMinute, new string[]{"yd³/min"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerSecond, new string[]{"yd³/s"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerDay, new string[]{"dl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerDay, new string[]{"dL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerDay, new string[]{"dLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerMinute, new string[]{"dLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerDay, new string[]{"kl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerDay, new string[]{"kL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerDay, new string[]{"kLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerMinute, new string[]{"kLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KilousGallonPerMinute, new string[]{"kgal (U.S.)/min", "KGPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerDay, new string[]{"l/day", "L/d", "LPD"}), @@ -1223,13 +1283,21 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerMinute, new string[]{"LPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerSecond, new string[]{"LPS"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MegaliterPerDay, new string[]{"Ml/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MegaliterPerDay, new string[]{"ML/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MegaliterPerDay, new string[]{"MLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MegaukGallonPerSecond, new string[]{"Mgal (imp.)/s"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerDay, new string[]{"µl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerDay, new string[]{"µL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerDay, new string[]{"µLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerMinute, new string[]{"µLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerDay, new string[]{"ml/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerDay, new string[]{"mL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerDay, new string[]{"mLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerMinute, new string[]{"mLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MillionUsGallonsPerDay, new string[]{"MGD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerDay, new string[]{"nl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerDay, new string[]{"nL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerDay, new string[]{"nLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerMinute, new string[]{"nLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerDay, new string[]{"bbl/d", "BOPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerHour, new string[]{"bbl/hr", "bph"}), diff --git a/UnitsNet.WindowsRuntimeComponent/Scripts/GenerateUnits.ps1 b/UnitsNet.WindowsRuntimeComponent/Scripts/GenerateUnits.ps1 index d4531df071..7147eeabc5 100644 --- a/UnitsNet.WindowsRuntimeComponent/Scripts/GenerateUnits.ps1 +++ b/UnitsNet.WindowsRuntimeComponent/Scripts/GenerateUnits.ps1 @@ -192,16 +192,29 @@ function Add-PrefixUnits { FromUnitToBaseFunc="("+$unit.FromUnitToBaseFunc+") * $prefixFactor" FromBaseToUnitFunc="("+$unit.FromBaseToUnitFunc+") / $prefixFactor" - Localization=$unit.Localization | % { - $abbrev = $prefixAbbreviation + $_.Abbreviations[0] - if ($_.AbbreviationsWithPrefixes) { - $abbrev = $_.AbbreviationsWithPrefixes[$prefixIndex] - } - - New-Object PsObject -Property @{ - Culture=$_.Culture - Abbreviations= $abbrev - }} + Localization=$unit.Localization | % { + foreach ($abbrSyno in $_.Abbreviations) { + $abbrev = $prefixAbbreviation + $abbrSyno + if ($_.AbbreviationsWithPrefixes) { + if($_.AbbreviationsWithPrefixes[$prefixIndex] -isnot [System.String]){ + foreach($synoWithPrefix in $_.AbbreviationsWithPrefixes[$prefixIndex]){ + New-Object PsObject -Property @{ + Culture=$_.Culture + Abbreviations= $synoWithPrefix + } + } + continue + } + else{ + $abbrev = $_.AbbreviationsWithPrefixes[$prefixIndex] + } + } + New-Object PsObject -Property @{ + Culture=$_.Culture + Abbreviations= $abbrev + } + } + } } # Append prefix unit diff --git a/UnitsNet.WindowsRuntimeComponent/Scripts/Types.psm1 b/UnitsNet.WindowsRuntimeComponent/Scripts/Types.psm1 index 8badec4b31..7dfae70090 100644 --- a/UnitsNet.WindowsRuntimeComponent/Scripts/Types.psm1 +++ b/UnitsNet.WindowsRuntimeComponent/Scripts/Types.psm1 @@ -28,7 +28,7 @@ class Localization { [string]$Culture [string[]]$Abbreviations = @() - [string[]]$AbbreviationsWithPrefixes = @() + [object[]]$AbbreviationsWithPrefixes = @() } class BaseDimensions diff --git a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs index b3df2f3c0d..c2915b9da4 100644 --- a/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs +++ b/UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs @@ -72,14 +72,17 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Gradian, new string[]{"g"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µdeg"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microdegree, new string[]{"µ°"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µrad"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Microradian, new string[]{"µрад"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"mdeg"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Millidegree, new string[]{"m°"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mrad"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Milliradian, new string[]{"mрад"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), + ("en-US", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"ndeg"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanodegree, new string[]{"n°"}), ("en-US", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nrad"}), ("ru-RU", typeof(AngleUnit), (int)AngleUnit.Nanoradian, new string[]{"nрад"}), @@ -127,28 +130,40 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(BitRateUnit), (int)BitRateUnit.BitPerSecond, new string[]{"bit/s", "bps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.BytePerSecond, new string[]{"B/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabitPerSecond, new string[]{"Ebit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabitPerSecond, new string[]{"Ebps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExabytePerSecond, new string[]{"EB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibitPerSecond, new string[]{"Eibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibitPerSecond, new string[]{"Eibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.ExbibytePerSecond, new string[]{"EiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibitPerSecond, new string[]{"Gibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibitPerSecond, new string[]{"Gibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GibibytePerSecond, new string[]{"GiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabitPerSecond, new string[]{"Gbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabitPerSecond, new string[]{"Gbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.GigabytePerSecond, new string[]{"GB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibitPerSecond, new string[]{"Kibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibitPerSecond, new string[]{"Kibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KibibytePerSecond, new string[]{"KiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobitPerSecond, new string[]{"kbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobitPerSecond, new string[]{"kbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.KilobytePerSecond, new string[]{"kB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibitPerSecond, new string[]{"Mibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibitPerSecond, new string[]{"Mibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MebibytePerSecond, new string[]{"MiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabitPerSecond, new string[]{"Mbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabitPerSecond, new string[]{"Mbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.MegabytePerSecond, new string[]{"MB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibitPerSecond, new string[]{"Pibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibitPerSecond, new string[]{"Pibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PebibytePerSecond, new string[]{"PiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabitPerSecond, new string[]{"Pbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabitPerSecond, new string[]{"Pbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.PetabytePerSecond, new string[]{"PB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibitPerSecond, new string[]{"Tibit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibitPerSecond, new string[]{"Tibps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TebibytePerSecond, new string[]{"TiB/s"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabitPerSecond, new string[]{"Tbit/s"}), + ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabitPerSecond, new string[]{"Tbps"}), ("en-US", typeof(BitRateUnit), (int)BitRateUnit.TerabytePerSecond, new string[]{"TB/s"}), ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.GramPerKiloWattHour, new string[]{"g/kWh"}), ("en-US", typeof(BrakeSpecificFuelConsumptionUnit), (int)BrakeSpecificFuelConsumptionUnit.KilogramPerJoule, new string[]{"kg/J"}), @@ -212,17 +227,38 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"h", "hr", "hrs", "hour", "hours"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Hour, new string[]{"ч"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µs"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µsec"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µsecs"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µsecond"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"µseconds"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мкс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мксек"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мкс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Microsecond, new string[]{"мксек"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"ms"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"msec"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"msecs"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"msecond"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"mseconds"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мсек"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Millisecond, new string[]{"мсек"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"m", "min", "minute", "minutes"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Minute, new string[]{"мин"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"mo", "month", "months"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Month30, new string[]{"месяц"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"ns"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"nsec"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"nsecs"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"nsecond"}), + ("en-US", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"nseconds"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нсек"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нс"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Nanosecond, new string[]{"нсек"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"s", "sec", "secs", "second", "seconds"}), - ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"с"}), + ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Second, new string[]{"с", "сек"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"wk", "week", "weeks"}), ("ru-RU", typeof(DurationUnit), (int)DurationUnit.Week, new string[]{"мин"}), ("en-US", typeof(DurationUnit), (int)DurationUnit.Year365, new string[]{"yr", "year", "years"}), @@ -557,6 +593,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"kg"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilogram, new string[]{"кг"}), ("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klb"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klbs"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"klbm"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilopound, new string[]{"kфунт"}), ("en-US", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"kt"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Kilotonne, new string[]{"кт"}), @@ -564,6 +602,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"long tn"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.LongTon, new string[]{"тонна большая"}), ("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlb"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlbs"}), + ("en-US", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mlbm"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Megapound, new string[]{"Mфунт"}), ("en-US", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Mt"}), ("ru-RU", typeof(MassUnit), (int)MassUnit.Megatonne, new string[]{"Мт"}), @@ -721,13 +761,19 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.KilojoulePerMoleKelvin, new string[]{"kJ/(mol*K)"}), ("en-US", typeof(MolarEntropyUnit), (int)MolarEntropyUnit.MegajoulePerMoleKelvin, new string[]{"MJ/(mol*K)"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.CentimolesPerLiter, new string[]{"cmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.CentimolesPerLiter, new string[]{"cM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.DecimolesPerLiter, new string[]{"dmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.DecimolesPerLiter, new string[]{"dM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MicromolesPerLiter, new string[]{"µmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MicromolesPerLiter, new string[]{"µM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MillimolesPerLiter, new string[]{"mmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MillimolesPerLiter, new string[]{"mM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerCubicMeter, new string[]{"mol/m³"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.MolesPerLiter, new string[]{"mol/L", "M"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.NanomolesPerLiter, new string[]{"nmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.NanomolesPerLiter, new string[]{"nM"}), ("en-US", typeof(MolarityUnit), (int)MolarityUnit.PicomolesPerLiter, new string[]{"pmol/L"}), + ("en-US", typeof(MolarityUnit), (int)MolarityUnit.PicomolesPerLiter, new string[]{"pM"}), ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"cg/mol"}), ("ru-RU", typeof(MolarMassUnit), (int)MolarMassUnit.CentigramPerMole, new string[]{"сг/моль"}), ("en-US", typeof(MolarMassUnit), (int)MolarMassUnit.DecagramPerMole, new string[]{"dag/mol"}), @@ -856,6 +902,7 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Kilopascal, new string[]{"кПа"}), ("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareFoot, new string[]{"kipf/ft²"}), ("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareInch, new string[]{"kipf/in²"}), + ("en-US", typeof(PressureUnit), (int)PressureUnit.KilopoundForcePerSquareInch, new string[]{"kipf/in²"}), ("en-US", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mbar"}), ("ru-RU", typeof(PressureUnit), (int)PressureUnit.Megabar, new string[]{"Mбар"}), ("en-US", typeof(PressureUnit), (int)PressureUnit.MeganewtonPerSquareMeter, new string[]{"MN/m²"}), @@ -928,14 +975,17 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/s", "deg/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.DegreePerSecond, new string[]{"°/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/s"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µdeg/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicrodegreePerSecond, new string[]{"µ°/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µrad/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MicroradianPerSecond, new string[]{"µрад/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/s"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"mdeg/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MillidegreePerSecond, new string[]{"m°/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mrad/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.MilliradianPerSecond, new string[]{"mрад/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/s"}), + ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"ndeg/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanodegreePerSecond, new string[]{"n°/с"}), ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nrad/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.NanoradianPerSecond, new string[]{"nрад/с"}), @@ -946,10 +996,14 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"r/s"}), ("ru-RU", typeof(RotationalSpeedUnit), (int)RotationalSpeedUnit.RevolutionPerSecond, new string[]{"об/с"}), ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.KilonewtonMeterPerRadian, new string[]{"kN·m/rad"}), + ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.KilonewtonMeterPerRadian, new string[]{"kNm/rad"}), ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.MeganewtonMeterPerRadian, new string[]{"MN·m/rad"}), + ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.MeganewtonMeterPerRadian, new string[]{"MNm/rad"}), ("en-US", typeof(RotationalStiffnessUnit), (int)RotationalStiffnessUnit.NewtonMeterPerRadian, new string[]{"N·m/rad", "Nm/rad"}), ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, new string[]{"kN·m/rad/m"}), + ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.KilonewtonMeterPerRadianPerMeter, new string[]{"kNm/rad/m"}), ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, new string[]{"MN·m/rad/m"}), + ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.MeganewtonMeterPerRadianPerMeter, new string[]{"MNm/rad/m"}), ("en-US", typeof(RotationalStiffnessPerLengthUnit), (int)RotationalStiffnessPerLengthUnit.NewtonMeterPerRadianPerMeter, new string[]{"N·m/rad/m", "Nm/rad/m"}), ("en-US", typeof(SolidAngleUnit), (int)SolidAngleUnit.Steradian, new string[]{"sr"}), ("en-US", typeof(SpecificEnergyUnit), (int)SpecificEnergyUnit.BtuPerPound, new string[]{"btu/lb"}), @@ -1194,6 +1248,8 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.AcreFootPerMinute, new string[]{"af/m"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.AcreFootPerSecond, new string[]{"af/s"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerDay, new string[]{"cl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerDay, new string[]{"cL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerDay, new string[]{"cLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CentiliterPerMinute, new string[]{"cLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"dm³/min"}), ("ru-RU", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicDecimeterPerMinute, new string[]{"дм³/мин"}), @@ -1213,8 +1269,12 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerMinute, new string[]{"yd³/min"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.CubicYardPerSecond, new string[]{"yd³/s"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerDay, new string[]{"dl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerDay, new string[]{"dL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerDay, new string[]{"dLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.DeciliterPerMinute, new string[]{"dLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerDay, new string[]{"kl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerDay, new string[]{"kL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerDay, new string[]{"kLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KiloliterPerMinute, new string[]{"kLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.KilousGallonPerMinute, new string[]{"kgal (U.S.)/min", "KGPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerDay, new string[]{"l/day", "L/d", "LPD"}), @@ -1223,13 +1283,21 @@ private static readonly (string CultureName, Type UnitType, int UnitValue, strin ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerMinute, new string[]{"LPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.LiterPerSecond, new string[]{"LPS"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MegaliterPerDay, new string[]{"Ml/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MegaliterPerDay, new string[]{"ML/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MegaliterPerDay, new string[]{"MLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MegaukGallonPerSecond, new string[]{"Mgal (imp.)/s"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerDay, new string[]{"µl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerDay, new string[]{"µL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerDay, new string[]{"µLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MicroliterPerMinute, new string[]{"µLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerDay, new string[]{"ml/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerDay, new string[]{"mL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerDay, new string[]{"mLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MilliliterPerMinute, new string[]{"mLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.MillionUsGallonsPerDay, new string[]{"MGD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerDay, new string[]{"nl/day"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerDay, new string[]{"nL/d"}), + ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerDay, new string[]{"nLPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.NanoliterPerMinute, new string[]{"nLPM"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerDay, new string[]{"bbl/d", "BOPD"}), ("en-US", typeof(VolumeFlowUnit), (int)VolumeFlowUnit.OilBarrelPerHour, new string[]{"bbl/hr", "bph"}), diff --git a/UnitsNet/Scripts/GenerateUnits.ps1 b/UnitsNet/Scripts/GenerateUnits.ps1 index a44f6052e6..ca7a0223b9 100644 --- a/UnitsNet/Scripts/GenerateUnits.ps1 +++ b/UnitsNet/Scripts/GenerateUnits.ps1 @@ -197,16 +197,29 @@ function Add-PrefixUnits { FromUnitToBaseFunc="("+$unit.FromUnitToBaseFunc+") * $prefixFactor" FromBaseToUnitFunc="("+$unit.FromBaseToUnitFunc+") / $prefixFactor" - Localization=$unit.Localization | % { - $abbrev = $prefixAbbreviation + $_.Abbreviations[0] - if ($_.AbbreviationsWithPrefixes) { - $abbrev = $_.AbbreviationsWithPrefixes[$prefixIndex] - } - - New-Object PsObject -Property @{ - Culture=$_.Culture - Abbreviations= $abbrev - }} + Localization=$unit.Localization | % { + foreach ($abbrSyno in $_.Abbreviations) { + $abbrev = $prefixAbbreviation + $abbrSyno + if ($_.AbbreviationsWithPrefixes) { + if($_.AbbreviationsWithPrefixes[$prefixIndex] -isnot [System.String]){ + foreach($synoWithPrefix in $_.AbbreviationsWithPrefixes[$prefixIndex]){ + New-Object PsObject -Property @{ + Culture=$_.Culture + Abbreviations= $synoWithPrefix + } + } + continue + } + else{ + $abbrev = $_.AbbreviationsWithPrefixes[$prefixIndex] + } + } + New-Object PsObject -Property @{ + Culture=$_.Culture + Abbreviations= $abbrev + } + } + } } # Append prefix unit diff --git a/UnitsNet/Scripts/Types.psm1 b/UnitsNet/Scripts/Types.psm1 index c314e7e866..c94c9c2caa 100644 --- a/UnitsNet/Scripts/Types.psm1 +++ b/UnitsNet/Scripts/Types.psm1 @@ -40,7 +40,7 @@ class Localization { [string]$Culture [string[]]$Abbreviations = @() - [string[]]$AbbreviationsWithPrefixes = @() + [object[]]$AbbreviationsWithPrefixes = @() } class BaseDimensions