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/message: better documentation for catalog #26767
Comments
I'm already working on this documentation improvement. |
There is a bit of the discussion on #26766 After more reading of the documentation/code on the package and also the point raised by @kaskavalci, I believe that the best way of making this package example work is to pass the language directly to |
Change https://golang.org/cl/127598 mentions this issue: |
I think |
@kaskavalci I totally agree with you. I'm planning to extend the http example there to:
This way it will be more clear of how all those functions interact with each other. I hope to get it done by the end of this week. |
@belimawr Hey buddy :) Take a look at this repo https://github.com/nicksnyder/go-i18n |
Hey @beono ! Actually my use case is to contribute with the Golang project. So far I haven't used this package in production yet. |
@kaskavalci I finally had time to update the examples \0/ |
Thanks @belimawr ! |
Hey @belimawr I'm working with message again and hit another problem. This is not from catalog documentation but from message. https://godoc.org/golang.org/x/text/message#example-Printer--MVerb When you run the example it complains about
Changing it to string type
Another weird issue I noticed is in printer. See the following example. Is that the expected behavior? message.SetString(language.Dutch, "soccer", "voetbal")
p := message.NewPrinter(language.Make("nl"))
p.Printf("soccer\n") // prints soccer
fmt.Println(p.Sprint("soccer")) // prints soccer
fmt.Println(p.Sprintf("soccer")) // prints voetball |
Noticed one more problem. Dutch decimal separator is comma. When p := message.NewPrinter(message.MatchLanguage("nl"))
p.Printf("Hoogte: %.1f meter\n", 1244.9) // Prints Hoogte: 1,244.9 meter
m := message.NewPrinter(language.Dutch)
m.Printf("Hoogte: %.1f meter\n", 1244.9) // Prints Hoogte: 1.244,9 meter |
The documentation for this package could be clearer with regard to how catalogs should be used.
Specifically:
Repo commit: b0f49b06765e38644f97dff880167326a7ab0391
The text was updated successfully, but these errors were encountered: