doc.go 1.1 KB

12345678910111213141516171819202122232425262728
  1. // Copyright 2017 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package number formats numbers according to the customs of different locales.
  5. //
  6. // The number formats of this package allow for greater formatting flexibility
  7. // than passing values to message.Printf calls as is. It currently supports the
  8. // builtin Go types and anything that implements the Convert interface
  9. // (currently internal).
  10. //
  11. // p := message.NewPrinter(language.English)
  12. //
  13. // p.Printf("%v bottles of beer on the wall.", number.Decimal(1234))
  14. // // Prints: 1,234 bottles of beer on the wall.
  15. //
  16. // p.Printf("%v of gophers lose too much fur", number.Percent(0.12))
  17. // // Prints: 12% of gophers lose too much fur.
  18. //
  19. // p := message.NewPrinter(language.Dutch)
  20. //
  21. // p.Printf("There are %v bikes per household.", number.Decimal(1.2))
  22. // // Prints: Er zijn 1,2 fietsen per huishouden.
  23. //
  24. //
  25. // The width and scale specified in the formatting directives override the
  26. // configuration of the formatter.
  27. package number