Length, Energy and Mass formatters should definitely use the ICU backing. It might be a good idea to funnel them all into one unit formatter access point. I personally find it is sometimes easier to interface to C APIs in C and expose them back up as simple funnel methods but it depends on which APIs you are interfacing with so ymmv. The formatters are locale independent in that they should probably just have a simple callout to uameasfmt_format when creating strings from values given a certain unit type.
On Jan 5, 2016, at 1:23 PM, Johan Jensen via swift-corelibs-dev <firstname.lastname@example.org> wrote:
I was having a quick look at implementing some of the not-yet-implemented formatters but quickly realized that some of them are highly locale dependent.
After a quick look I found uameasureformat.h <https://github.com/apple/swift-corelibs-foundation/blob/88424c8c533ce903d10b8be2a8b9f30a4c2011aa/bootstrap/x86_64-apple-darwin/usr/local/include/unicode/uameasureformat.h> and uameasfmt_format() which looks quite interesting.
Is it possible to use these functions?
If so, should a Swift wrapper be made?
If not, how is locale dependent formatters expected to be implemented?
swift-corelibs-dev mailing list