forked from TrueCloudLab/restic
Update vendored library golang.org/x/text
This commit is contained in:
parent
d8dd79eb0b
commit
5b6568875c
46 changed files with 610 additions and 2739 deletions
46
vendor/golang.org/x/text/message/pipeline/message.go
generated
vendored
46
vendor/golang.org/x/text/message/pipeline/message.go
generated
vendored
|
@ -6,7 +6,6 @@ package pipeline
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/text/language"
|
||||
|
@ -24,8 +23,28 @@ import (
|
|||
// the format string "%d file(s) remaining".
|
||||
// See the examples directory for examples of extracted messages.
|
||||
|
||||
// Messages is used to store translations for a single language.
|
||||
type Messages struct {
|
||||
// Config contains configuration for the translation pipeline.
|
||||
type Config struct {
|
||||
SourceLanguage language.Tag
|
||||
|
||||
// Supported indicates the languages for which data should be generated.
|
||||
// If unspecified, it will attempt to derive the set of supported languages
|
||||
// from the context.
|
||||
Supported []language.Tag
|
||||
|
||||
Packages []string
|
||||
|
||||
// TODO:
|
||||
// - Printf-style configuration
|
||||
// - Template-style configuration
|
||||
// - Extraction options
|
||||
// - Rewrite options
|
||||
// - Generation options
|
||||
}
|
||||
|
||||
// A Locale is used to store all information for a single locale. This type is
|
||||
// used both for extraction and injection.
|
||||
type Locale struct {
|
||||
Language language.Tag `json:"language"`
|
||||
Messages []Message `json:"messages"`
|
||||
Macros map[string]Text `json:"macros,omitempty"`
|
||||
|
@ -36,7 +55,7 @@ type Message struct {
|
|||
// ID contains a list of identifiers for the message.
|
||||
ID IDList `json:"id"`
|
||||
// Key is the string that is used to look up the message at runtime.
|
||||
Key string `json:"key,omitempty"`
|
||||
Key string `json:"key"`
|
||||
Meaning string `json:"meaning,omitempty"`
|
||||
Message Text `json:"message"`
|
||||
Translation Text `json:"translation"`
|
||||
|
@ -46,11 +65,6 @@ type Message struct {
|
|||
|
||||
Placeholders []Placeholder `json:"placeholders,omitempty"`
|
||||
|
||||
// Fuzzy indicates that the provide translation needs review by a
|
||||
// translator, for instance because it was derived from automated
|
||||
// translation.
|
||||
Fuzzy bool `json:"fuzzy,omitempty"`
|
||||
|
||||
// TODO: default placeholder syntax is {foo}. Allow alternative escaping
|
||||
// like `foo`.
|
||||
|
||||
|
@ -100,20 +114,6 @@ func (m *Message) Substitute(msg string) (sub string, err error) {
|
|||
return sub, err
|
||||
}
|
||||
|
||||
var errIncompatibleMessage = errors.New("messages incompatible")
|
||||
|
||||
func checkEquivalence(a, b *Message) error {
|
||||
for _, v := range a.ID {
|
||||
for _, w := range b.ID {
|
||||
if v == w {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: canonicalize placeholders and check for type equivalence.
|
||||
return errIncompatibleMessage
|
||||
}
|
||||
|
||||
// A Placeholder is a part of the message that should not be changed by a
|
||||
// translator. It can be used to hide or prettify format strings (e.g. %d or
|
||||
// {{.Count}}), hide HTML, or mark common names that should not be translated.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue