Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/text/currency: position of the ISO code or sign in amounts #14308

Open
arvenil opened this issue Feb 12, 2016 · 4 comments
Open

x/text/currency: position of the ISO code or sign in amounts #14308

arvenil opened this issue Feb 12, 2016 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@arvenil
Copy link

arvenil commented Feb 12, 2016

    currencyCode = "PLN"
    unit, _ := currency.ParseISO(currencyCode)
    p := message.NewPrinter(language.Polish)
    amount := float64(100)
    p.Print(currency.Symbol(unit.Amount(amount)))

The result is zł 100 but I would expect 100 zł.
https://en.wikipedia.org/wiki/ISO_4217#Position_of_ISO_4217_code_in_amounts
http://publications.europa.eu/code/en/en-370303.htm#position

I would expect 100 zł but maybe there is "other" library/func/method that handles order?
Or if this is on TODO list, any idea how could I workaround the problem?

@arvenil
Copy link
Author

arvenil commented Feb 12, 2016

Looks like position is hard coded :/ https://github.com/golang/text/blob/3fe38e9bb80a6f7a308692511ffdbae1537f0505/currency/format.go#L77-L89

@jarifibrahim
Copy link

I would like to work on this but I'm not sure how to find the correct position for the currency symbol. Can someone help me out?

@arvenil
Copy link
Author

arvenil commented Dec 10, 2018

@jarifibrahim Do you mean this?

  1. https://en.wikipedia.org/wiki/ISO_4217#Position_of_ISO_4217_code_in_amounts
  2. http://publications.europa.eu/code/en/en-370303.htm#position

Note that, as illustrated, the order is determined not by the currency, but by the native language of the document context.

@bojanz
Copy link

bojanz commented May 15, 2020

x/text/currency is missing number formats, which are provided by CLDR.

Here's how such a list would look: https://github.com/bojanz/currency/blob/master/data.go#L795

@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants