File: main.go

package info (click to toggle)
golang-golang-x-text 0.16.0-1~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 41,608 kB
  • sloc: xml: 1,022; makefile: 6
file content (37 lines) | stat: -rw-r--r-- 840 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package main

import (
	"fmt"

	"golang.org/x/text/language"
	"golang.org/x/text/message"
)

func main() {
	var nPizzas = 4
	// The following call gets replaced by a call to the globally
	// defined printer.
	fmt.Println("We ate", nPizzas, "pizzas.")

	p := message.NewPrinter(language.English)

	// Prevent build failure, although it is okay for gotext.
	p.Println(1024)

	// Replaced by a call to p.
	fmt.Println("Example punctuation:", "$%^&!")

	{
		q := message.NewPrinter(language.French)

		const leaveAnIdentBe = "Don't expand me."
		fmt.Print(leaveAnIdentBe)
		q.Println() // Prevent build failure, although it is okay for gotext.
	}

	fmt.Printf("Hello %s\n", "City")
}