You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
840 B

  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 main
  5. import (
  6. "fmt"
  7. "golang.org/x/text/language"
  8. "golang.org/x/text/message"
  9. )
  10. func main() {
  11. var nPizzas = 4
  12. // The following call gets replaced by a call to the globally
  13. // defined printer.
  14. fmt.Println("We ate", nPizzas, "pizzas.")
  15. p := message.NewPrinter(language.English)
  16. // Prevent build failure, although it is okay for gotext.
  17. p.Println(1024)
  18. // Replaced by a call to p.
  19. fmt.Println("Example punctuation:", "$%^&!")
  20. {
  21. q := message.NewPrinter(language.French)
  22. const leaveAnIdentBe = "Don't expand me."
  23. fmt.Print(leaveAnIdentBe)
  24. q.Println() // Prevent build failure, although it is okay for gotext.
  25. }
  26. fmt.Printf("Hello %s\n", "City")
  27. }