localization of quantity descriptions

Jul 9, 2013 at 8:42 AM
First off: nice library.
I was wondering what your ideas are/were about implementation of localization of the unit descriptions. As an example there is provided for the quantity time the unit "h" for hour. This maybe a valid description in english but for instance in another language you would prefer "u" for instance. Should that go through the unitprovider?
Coordinator
Feb 23, 2014 at 7:27 PM
Yes, create a new UnitProvider and register all your localized units and set the 'display' units. You can then set UnitProvider.Default if you want this to be used as default unit resolver.

Try
            var up = new UnitProvider();
            up.RegisterUnit(Time.Hour, "u");
            up.TrySetDisplayUnit<Time>("u");
            UnitProvider.Default = up;
            Console.WriteLine(Time.Parse("3 u"));
            Console.WriteLine(3 * Time.Hour);