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

Added proper formatting for different currencies. #89

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

domgolonka
Copy link

@domgolonka domgolonka commented Jun 11, 2021

CHF: The thousands- separator should be an apostroph ' not a comma , see eg.
http://www.thefinancials.com/Default.aspx?SubSectionID=curformat

SEK: The decimal should be a comma , and thousand should be a dot .
https://www.edufukunari.com.br/en/world-currency-formats-iso-4217-information/
http://www.thefinancials.com/Default.aspx?SubSectionID=curformat

CZK: The decimal should be a comma , and thousand should be a dot .
https://www.edufukunari.com.br/en/world-currency-formats-iso-4217-information/

LTL: The decimal should be a comma , and thousand should be a dot .
https://www.edufukunari.com.br/en/world-currency-formats-iso-4217-information/

NOK: The decimal should be a comma , and thousand should be a dot .
https://www.edufukunari.com.br/en/world-currency-formats-iso-4217-information/

PLN: The decimal should be a comma , and thousand should be a dot .
https://www.edufukunari.com.br/en/world-currency-formats-iso-4217-information/

DKK: The decimal should be a comma , and thousand should be a comma ,
https://www.edufukunari.com.br/en/world-currency-formats-iso-4217-information/

RON: The decimal should be a comma , and thousand should be a dot .
https://www.edufukunari.com.br/en/world-currency-formats-iso-4217-information/

@domgolonka domgolonka changed the title Added proper chf format Added proper formatting for different currencies. Jun 11, 2021
@dthuering
Copy link

+1

@gsempe
Copy link

gsempe commented May 1, 2022

As a library user, I think that is a great improvement to the library but I believe it is missing tests covering the changes.

DJF: {Decimal: ".", Thousand: ",", Code: DJF, Fraction: 0, NumericCode: "262", Grapheme: "Fdj", Template: "1 $"},
DKK: {Decimal: ",", Thousand: ".", Code: DKK, Fraction: 2, NumericCode: "208", Grapheme: "kr", Template: "$ 1"},
DKK: {Decimal: ",", Thousand: ",", Code: DKK, Fraction: 2, NumericCode: "208", Grapheme: "kr", Template: "$ 1"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reference document (https://www.edufukunari.com.br/en/world-currency-formats-iso-4217-information/) says "#.###,##" for DKK (dot for thousands)

@@ -106,7 +106,7 @@ var currencies = map[string]*Currency{
LKR: {Decimal: ".", Thousand: ",", Code: LKR, Fraction: 2, NumericCode: "144", Grapheme: "\u20a8", Template: "$1"},
LRD: {Decimal: ".", Thousand: ",", Code: LRD, Fraction: 2, NumericCode: "430", Grapheme: "$", Template: "$1"},
LSL: {Decimal: ".", Thousand: ",", Code: LSL, Fraction: 2, NumericCode: "426", Grapheme: "L", Template: "$1"},
LTL: {Decimal: ".", Thousand: ",", Code: LTL, Fraction: 2, NumericCode: "", Grapheme: "Lt", Template: "$1"},
LTL: {Decimal: ",", Thousand: ".", Code: LTL, Fraction: 2, NumericCode: "", Grapheme: "Lt", Template: "$1"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -133,10 +133,10 @@ var currencies = map[string]*Currency{
PGK: {Decimal: ".", Thousand: ",", Code: PGK, Fraction: 2, NumericCode: "598", Grapheme: "K", Template: "1 $"},
PHP: {Decimal: ".", Thousand: ",", Code: PHP, Fraction: 2, NumericCode: "608", Grapheme: "\u20b1", Template: "$1"},
PKR: {Decimal: ".", Thousand: ",", Code: PKR, Fraction: 2, NumericCode: "586", Grapheme: "\u20a8", Template: "$1"},
PLN: {Decimal: ".", Thousand: ",", Code: PLN, Fraction: 2, NumericCode: "985", Grapheme: "z\u0142", Template: "1 $"},
PLN: {Decimal: ",", Thousand: ".", Code: PLN, Fraction: 2, NumericCode: "985", Grapheme: "z\u0142", Template: "1 $"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referenced document says "# ###,##" for PLN. Space for thousand.

@@ -145,7 +145,7 @@ var currencies = map[string]*Currency{
SBD: {Decimal: ".", Thousand: ",", Code: SBD, Fraction: 2, NumericCode: "090", Grapheme: "$", Template: "$1"},
SCR: {Decimal: ".", Thousand: ",", Code: SCR, Fraction: 2, NumericCode: "690", Grapheme: "\u20a8", Template: "$1"},
SDG: {Decimal: ".", Thousand: ",", Code: SDG, Fraction: 2, NumericCode: "938", Grapheme: "\u00a3", Template: "$1"},
SEK: {Decimal: ".", Thousand: ",", Code: SEK, Fraction: 2, NumericCode: "752", Grapheme: "kr", Template: "1 $"},
SEK: {Decimal: ",", Thousand: ".", Code: SEK, Fraction: 2, NumericCode: "752", Grapheme: "kr", Template: "1 $"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referenced document says "# ###,##" for SEK. Space for thousand.

Also described in https://www.freeformatter.com/sweden-standards-code-snippets.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants