From 706de4d62744efe60826df166b27bed86c38c49a Mon Sep 17 00:00:00 2001 From: bel Date: Sun, 15 Oct 2023 10:57:46 -0600 Subject: [PATCH] golang.org/x/text seems to fit FormatUSD requirement and is also pretty cool --- todo.yaml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/todo.yaml b/todo.yaml index 80ae2ca..7ea17fd 100755 --- a/todo.yaml +++ b/todo.yaml @@ -22,6 +22,27 @@ todo: arabic => non-digits azerbaijan => xxx.yyy,zz hindi => ww,xx,yyy.zz + + https://dev.to/theodesp/a-step-by-step-guide-to-go-internationalization-i18n--localization-l10n-4ig2 + solved problem? + * golang.org/x/text + p := message.NewPrinter(language.BritishEnglish) + p.Printf("There are %v flowers in our garden.", 1500) + language.Greek, language.BrazilianPortuguese + language.Make("el"), language.Parse("en-UK") + ja, _ := language.ParseBase("ja")
 + jp, _ := language.ParseRegion("JP")
 + jpLngTag, _ := language.Compose(ja, jp)
 + fmt.Println(jpLngTag) // prints ja-JP + * reminds me of language of like C_LANG env variable I've seen... + * neato all under golang.org/x/text + p := message.NewPrinter(language.English) + p.Printf("%d", currency.Symbol(currency.USD.Amount(0.1))) + fmt.Println() + p.Printf("%d", currency.NarrowSymbol(currency.JPY.Amount(1.6))) + fmt.Println() + p.Printf("%d", currency.ISO.Kind(currency.Cash)(currency.EUR.Amount(12.255))) + fmt.Println() - TestTransaction_String - TestTransaction_String/MCCOLLOMS_INC - TestTransaction_String/QUANTUM_ELECTRIC_INC @@ -176,3 +197,37 @@ done: - TestAnalyzer_TransactionsFromURLs - TestAnalyzer_TransactionsFromURLsConcurrent ts: Sun Oct 15 10:54:35 MDT 2023 +- todo: go test + subtasks: + - my `go mod tidy` actually cleared `go.mod` file, probably weird localhost backwards + compatilble stuff + - todo: TestFormatUSD + subtasks: + - TestFormatUSD/zero + - TestFormatUSD/positive + - TestFormatUSD/negative + - TestFormatUSD/large + - no implementation + - naive `-$xx,yyy.zz` + - todo: comment emphasizes localization, which is minimum `-xx.yyy,zz` + details: | + BUT no indicator of what is "local". Could use system timezone/location stuff but that's weird. + + https://phrase.com/blog/posts/number-localization/ + english => xxx,yyy.zz + french => xxx yyy.zz + arabic => non-digits + azerbaijan => xxx.yyy,zz + hindi => ww,xx,yyy.zz + - TestTransaction_String + - TestTransaction_String/MCCOLLOMS_INC + - TestTransaction_String/QUANTUM_ELECTRIC_INC + - TestTransaction_String/MARRIOTT_33716_NEW_ORLEAN + - TestAnalyzer_TransctionsSum + - TestAnalyzer_LargestTransaction + - TestAnalyzer_DuplicatesExcluded + - TestAnalyzer_GroupByCategory + - TestAnalyzer_BigSpendersReport + - TestAnalyzer_TransactionsFromURLs + - TestAnalyzer_TransactionsFromURLsConcurrent + ts: Sun Oct 15 10:57:33 MDT 2023