Closed mrdavey closed 8 years ago
Hi @mrdavey thanks for the feedback. Have you seen a bug where the placement is incorrect?
Yes, when I use let amount = EUR(floatLiteral: money)
as per our recent Twitter conversation.
It shows € 300.80
when it should be 300,80 €
(if you were to follow the Euro standards currently in use).
Hmm. In Settings, what is your language set to?
Sorry for not explaining the use case properly. The app I'm creating shows multiple currencies (USD, EUR, CNY, etc) and the user can switch between the different currencies by selecting a button.
So at the moment, the simulator is set to US English. However I want users to be able to see the correct currency format and placement, no matter what language their device is set to.
It's more of a nitpick than a serious issue. :)
Yeah, I've considered this use case. At the moment, the implementation of CustomStringRepresentable
uses standard NSNumberFormatter
and NSLocale
, so you get the representation of the currency in the current system language - which I think is the correct for most use cases.
To be able to display the language localized representation, without changing the language in settings is possible (I think) with NSLocale
. Not immediately obvious what would be the best way to expose it on the type. Maybe as a money.localizedDescription
? What do you think?
Regardless, I will update the README to make it clear at the top that those are in English language locale.
Yes money.localizedDescription
could work well in this case. Thanks for taking the feedback on board @danthorpe . Much appreciated!
No props - will look into it today - look out for version 1.4.0.
Clearly, the tricky thing with this, is say for example EUR
which is used in many countries with different languages - it might require more information to say print out the Spanish localized description, versus the French localized description...
See #26 for work on this.
Hi @mrdavey - I've merged #26 into development, if you have time, please take a look, I think your use case should now be covered. The README has been updated to include the changes.
You can use the development branch in CocoaPods by doing:
pod 'Money', :git => 'https://github.com/danthorpe/Money', :branch => 'development'
or for Carthage:
github 'danthorpe/Money' 'development'
Please get back to me here if you have any issues - I really want to make sure that the formatting is bulletproof!
In some countries, such as France/Germany/Italy/Spain, the Euro sign is placed after the amount. E.g. 3,50 € (note that they also use a ',' instead of '.' for sub units). More information can be found here: https://en.wikipedia.org/wiki/Euro_sign#Use