github.com/go-xe2/third@v1.0.3/golang.org/x/text/internal/format/format.go (about)

     1  // Copyright 2015 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  
     5  // Package format contains types for defining language-specific formatting of
     6  // values.
     7  //
     8  // This package is internal now, but will eventually be exposed after the API
     9  // settles.
    10  package format // import "github.com/go-xe2/third/golang.org/x/text/internal/format"
    11  
    12  import (
    13  	"fmt"
    14  
    15  	"github.com/go-xe2/third/golang.org/x/text/language"
    16  )
    17  
    18  // State represents the printer state passed to custom formatters. It provides
    19  // access to the fmt.State interface and the sentence and language-related
    20  // context.
    21  type State interface {
    22  	fmt.State
    23  
    24  	// Language reports the requested language in which to render a message.
    25  	Language() language.Tag
    26  
    27  	// TODO: consider this and removing rune from the Format method in the
    28  	// Formatter interface.
    29  	//
    30  	// Verb returns the format variant to render, analogous to the types used
    31  	// in fmt. Use 'v' for the default or only variant.
    32  	// Verb() rune
    33  
    34  	// TODO: more info:
    35  	// - sentence context such as linguistic features passed by the translator.
    36  }
    37  
    38  // Formatter is analogous to fmt.Formatter.
    39  type Formatter interface {
    40  	Format(state State, verb rune)
    41  }