diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-05-12 23:56:07 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-05-12 23:56:07 -0400 |
commit | 38ee83e45b4de7edf89bf9f0ef629eb4c6ad0fa8 (patch) | |
tree | a4fde09672192b97d453ad605b030bd5a10c5a45 /vendor/github.com/nicksnyder/go-i18n/goi18n | |
parent | 84d2482ddbff9564c9ad75b2d30af66e3ddfd44d (diff) | |
download | chat-38ee83e45b4de7edf89bf9f0ef629eb4c6ad0fa8.tar.gz chat-38ee83e45b4de7edf89bf9f0ef629eb4c6ad0fa8.tar.bz2 chat-38ee83e45b4de7edf89bf9f0ef629eb4c6ad0fa8.zip |
Moving to glide
Diffstat (limited to 'vendor/github.com/nicksnyder/go-i18n/goi18n')
22 files changed, 950 insertions, 0 deletions
diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/doc.go b/vendor/github.com/nicksnyder/go-i18n/goi18n/doc.go new file mode 100644 index 000000000..10d244217 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/doc.go @@ -0,0 +1,59 @@ +// The goi18n command formats and merges translation files. +// +// go get -u github.com/nicksnyder/go-i18n/goi18n +// goi18n -help +// +// Help documentation: +// +// goi18n formats and merges translation files. +// +// Usage: +// +// goi18n [options] [files...] +// +// Translation files: +// +// A translation file contains the strings and translations for a single language. +// +// Translation file names must have a suffix of a supported format (e.g. .json) and +// contain a valid language tag as defined by RFC 5646 (e.g. en-us, fr, zh-hant, etc.). +// +// For each language represented by at least one input translation file, goi18n will produce 2 output files: +// +// xx-yy.all.format +// This file contains all strings for the language (translated and untranslated). +// Use this file when loading strings at runtime. +// +// xx-yy.untranslated.format +// This file contains the strings that have not been translated for this language. +// The translations for the strings in this file will be extracted from the source language. +// After they are translated, merge them back into xx-yy.all.format using goi18n. +// +// Merging: +// +// goi18n will merge multiple translation files for the same language. +// Duplicate translations will be merged into the existing translation. +// Non-empty fields in the duplicate translation will overwrite those fields in the existing translation. +// Empty fields in the duplicate translation are ignored. +// +// Adding a new language: +// +// To produce translation files for a new language, create an empty translation file with the +// appropriate name and pass it in to goi18n. +// +// Options: +// +// -sourceLanguage tag +// goi18n uses the strings from this language to seed the translations for other languages. +// Default: en-us +// +// -outdir directory +// goi18n writes the output translation files to this directory. +// Default: . +// +// -format format +// goi18n encodes the output translation files in this format. +// Supported formats: json, yaml +// Default: json +// +package main diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/gendoc.sh b/vendor/github.com/nicksnyder/go-i18n/goi18n/gendoc.sh new file mode 100644 index 000000000..094f479a5 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/gendoc.sh @@ -0,0 +1,10 @@ +go install +echo "// The goi18n command formats and merges translation files." > doc.go +echo "//" >> doc.go +echo "// go get -u github.com/nicksnyder/go-i18n/goi18n" >> doc.go +echo "// goi18n -help" >> doc.go +echo "//" >> doc.go +echo "// Help documentation:" >> doc.go +echo "//" >> doc.go +goi18n -help | sed -e 's/^/\/\/ /' >> doc.go +echo "package main" >> doc.go diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/goi18n.go b/vendor/github.com/nicksnyder/go-i18n/goi18n/goi18n.go new file mode 100644 index 000000000..f57ea8175 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/goi18n.go @@ -0,0 +1,82 @@ +package main + +import ( + "flag" + "fmt" + "os" +) + +func usage() { + fmt.Printf(`goi18n formats and merges translation files. + +Usage: + + goi18n [options] [files...] + +Translation files: + + A translation file contains the strings and translations for a single language. + + Translation file names must have a suffix of a supported format (e.g. .json) and + contain a valid language tag as defined by RFC 5646 (e.g. en-us, fr, zh-hant, etc.). + + For each language represented by at least one input translation file, goi18n will produce 2 output files: + + xx-yy.all.format + This file contains all strings for the language (translated and untranslated). + Use this file when loading strings at runtime. + + xx-yy.untranslated.format + This file contains the strings that have not been translated for this language. + The translations for the strings in this file will be extracted from the source language. + After they are translated, merge them back into xx-yy.all.format using goi18n. + +Merging: + + goi18n will merge multiple translation files for the same language. + Duplicate translations will be merged into the existing translation. + Non-empty fields in the duplicate translation will overwrite those fields in the existing translation. + Empty fields in the duplicate translation are ignored. + +Adding a new language: + + To produce translation files for a new language, create an empty translation file with the + appropriate name and pass it in to goi18n. + +Options: + + -sourceLanguage tag + goi18n uses the strings from this language to seed the translations for other languages. + Default: en-us + + -outdir directory + goi18n writes the output translation files to this directory. + Default: . + + -format format + goi18n encodes the output translation files in this format. + Supported formats: json, yaml + Default: json + +`) + os.Exit(1) +} + +func main() { + flag.Usage = usage + sourceLanguage := flag.String("sourceLanguage", "en-us", "") + outdir := flag.String("outdir", ".", "") + format := flag.String("format", "json", "") + flag.Parse() + + mc := &mergeCommand{ + translationFiles: flag.Args(), + sourceLanguageTag: *sourceLanguage, + outdir: *outdir, + format: *format, + } + if err := mc.execute(); err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } +} diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/merge.go b/vendor/github.com/nicksnyder/go-i18n/goi18n/merge.go new file mode 100644 index 000000000..1317fe958 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/merge.go @@ -0,0 +1,127 @@ +package main + +import ( + "encoding/json" + "fmt" + "gopkg.in/yaml.v2" + "io/ioutil" + "path/filepath" + "reflect" + "sort" + + "github.com/nicksnyder/go-i18n/i18n/bundle" + "github.com/nicksnyder/go-i18n/i18n/language" + "github.com/nicksnyder/go-i18n/i18n/translation" +) + +type mergeCommand struct { + translationFiles []string + sourceLanguageTag string + outdir string + format string +} + +func (mc *mergeCommand) execute() error { + if len(mc.translationFiles) < 1 { + return fmt.Errorf("need at least one translation file to parse") + } + + if lang := language.Parse(mc.sourceLanguageTag); lang == nil { + return fmt.Errorf("invalid source locale: %s", mc.sourceLanguageTag) + } + + marshal, err := newMarshalFunc(mc.format) + if err != nil { + return err + } + + bundle := bundle.New() + for _, tf := range mc.translationFiles { + if err := bundle.LoadTranslationFile(tf); err != nil { + return fmt.Errorf("failed to load translation file %s because %s\n", tf, err) + } + } + + translations := bundle.Translations() + sourceLanguageTag := language.NormalizeTag(mc.sourceLanguageTag) + sourceTranslations := translations[sourceLanguageTag] + if sourceTranslations == nil { + return fmt.Errorf("no translations found for source locale %s", sourceLanguageTag) + } + for translationID, src := range sourceTranslations { + for _, localeTranslations := range translations { + if dst := localeTranslations[translationID]; dst == nil || reflect.TypeOf(src) != reflect.TypeOf(dst) { + localeTranslations[translationID] = src.UntranslatedCopy() + } + } + } + + for localeID, localeTranslations := range translations { + lang := language.MustParse(localeID)[0] + all := filter(localeTranslations, func(t translation.Translation) translation.Translation { + return t.Normalize(lang) + }) + if err := mc.writeFile("all", all, localeID, marshal); err != nil { + return err + } + + untranslated := filter(localeTranslations, func(t translation.Translation) translation.Translation { + if t.Incomplete(lang) { + return t.Normalize(lang).Backfill(sourceTranslations[t.ID()]) + } + return nil + }) + if err := mc.writeFile("untranslated", untranslated, localeID, marshal); err != nil { + return err + } + } + return nil +} + +type marshalFunc func(interface{}) ([]byte, error) + +func (mc *mergeCommand) writeFile(label string, translations []translation.Translation, localeID string, marshal marshalFunc) error { + sort.Sort(translation.SortableByID(translations)) + buf, err := marshal(marshalInterface(translations)) + if err != nil { + return fmt.Errorf("failed to marshal %s strings to %s because %s", localeID, mc.format, err) + } + filename := filepath.Join(mc.outdir, fmt.Sprintf("%s.%s.%s", localeID, label, mc.format)) + if err := ioutil.WriteFile(filename, buf, 0666); err != nil { + return fmt.Errorf("failed to write %s because %s", filename, err) + } + return nil +} + +func filter(translations map[string]translation.Translation, filter func(translation.Translation) translation.Translation) []translation.Translation { + filtered := make([]translation.Translation, 0, len(translations)) + for _, translation := range translations { + if t := filter(translation); t != nil { + filtered = append(filtered, t) + } + } + return filtered + +} + +func newMarshalFunc(format string) (marshalFunc, error) { + switch format { + case "json": + return func(v interface{}) ([]byte, error) { + return json.MarshalIndent(v, "", " ") + }, nil + case "yaml": + return func(v interface{}) ([]byte, error) { + return yaml.Marshal(v) + }, nil + } + return nil, fmt.Errorf("unsupported format: %s\n", format) +} + +func marshalInterface(translations []translation.Translation) []interface{} { + mi := make([]interface{}, len(translations)) + for i, translation := range translations { + mi[i] = translation.MarshalInterface() + } + return mi +} diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/merge_test.go b/vendor/github.com/nicksnyder/go-i18n/goi18n/merge_test.go new file mode 100644 index 000000000..f0d0d47a1 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/merge_test.go @@ -0,0 +1,74 @@ +package main + +import ( + "bytes" + "io/ioutil" + "os" + "testing" +) + +func TestMergeExecuteJSON(t *testing.T) { + files := []string{ + "testdata/input/en-us.one.json", + "testdata/input/en-us.two.json", + "testdata/input/fr-fr.json", + "testdata/input/ar-ar.one.json", + "testdata/input/ar-ar.two.json", + } + testMergeExecute(t, files) +} + +func TestMergeExecuteYAML(t *testing.T) { + files := []string{ + "testdata/input/yaml/en-us.one.yaml", + "testdata/input/yaml/en-us.two.json", + "testdata/input/yaml/fr-fr.json", + "testdata/input/yaml/ar-ar.one.json", + "testdata/input/yaml/ar-ar.two.json", + } + testMergeExecute(t, files) +} + +func testMergeExecute(t *testing.T, files []string) { + resetDir(t, "testdata/output") + + mc := &mergeCommand{ + translationFiles: files, + sourceLanguageTag: "en-us", + outdir: "testdata/output", + format: "json", + } + if err := mc.execute(); err != nil { + t.Fatal(err) + } + + expectEqualFiles(t, "testdata/output/en-us.all.json", "testdata/expected/en-us.all.json") + expectEqualFiles(t, "testdata/output/ar-ar.all.json", "testdata/expected/ar-ar.all.json") + expectEqualFiles(t, "testdata/output/fr-fr.all.json", "testdata/expected/fr-fr.all.json") + expectEqualFiles(t, "testdata/output/en-us.untranslated.json", "testdata/expected/en-us.untranslated.json") + expectEqualFiles(t, "testdata/output/ar-ar.untranslated.json", "testdata/expected/ar-ar.untranslated.json") + expectEqualFiles(t, "testdata/output/fr-fr.untranslated.json", "testdata/expected/fr-fr.untranslated.json") +} + +func resetDir(t *testing.T, dir string) { + if err := os.RemoveAll(dir); err != nil { + t.Fatal(err) + } + if err := os.Mkdir(dir, 0777); err != nil { + t.Fatal(err) + } +} + +func expectEqualFiles(t *testing.T, expectedName, actualName string) { + actual, err := ioutil.ReadFile(actualName) + if err != nil { + t.Fatal(err) + } + expected, err := ioutil.ReadFile(expectedName) + if err != nil { + t.Fatal(err) + } + if !bytes.Equal(actual, expected) { + t.Fatalf("contents of files did not match: %s, %s", expectedName, actualName) + } +} diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/en-us.yaml b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/en-us.yaml new file mode 100644 index 000000000..cdf9c8dc5 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/en-us.yaml @@ -0,0 +1,30 @@ +- id: program_greeting + translation: "Hello world" + +- id: person_greeting + translation: "Hello {{.Person}}" + +- id: my_height_in_meters + translation: + one: "I am {{.Count}} meter tall." + other: "I am {{.Count}} meters tall." + +- id: your_unread_email_count + translation: + one: "You have {{.Count}} unread email." + other: "You have {{.Count}} unread emails." + +- id: person_unread_email_count + translation: + one: "{{.Person}} has {{.Count}} unread email." + other: "{{.Person}} has {{.Count}} unread emails." + +- id: person_unread_email_count_timeframe + translation: + one: "{{.Person}} has {{.Count}} unread email in the past {{.Timeframe}}." + other: "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}." + +- id: d_days + translation: + one: "{{.Count}} day" + other: "{{.Count}} days" diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/ar-ar.all.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/ar-ar.all.json new file mode 100644 index 000000000..26a72ff30 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/ar-ar.all.json @@ -0,0 +1,65 @@ +[ + { + "id": "d_days", + "translation": { + "few": "new arabic few translation of d_days", + "many": "arabic many translation of d_days", + "one": "arabic one translation of d_days", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "my_height_in_meters", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "person_greeting", + "translation": "new arabic translation of person_greeting" + }, + { + "id": "person_unread_email_count", + "translation": { + "few": "arabic few translation of person_unread_email_count", + "many": "arabic many translation of person_unread_email_count", + "one": "arabic one translation of person_unread_email_count", + "other": "arabic other translation of person_unread_email_count", + "two": "arabic two translation of person_unread_email_count", + "zero": "arabic zero translation of person_unread_email_count" + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "program_greeting", + "translation": "" + }, + { + "id": "your_unread_email_count", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + } +]
\ No newline at end of file diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/ar-ar.untranslated.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/ar-ar.untranslated.json new file mode 100644 index 000000000..a19fa0bee --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/ar-ar.untranslated.json @@ -0,0 +1,50 @@ +[ + { + "id": "d_days", + "translation": { + "few": "new arabic few translation of d_days", + "many": "arabic many translation of d_days", + "one": "arabic one translation of d_days", + "other": "{{.Count}} days", + "two": "{{.Count}} days", + "zero": "{{.Count}} days" + } + }, + { + "id": "my_height_in_meters", + "translation": { + "few": "I am {{.Count}} meters tall.", + "many": "I am {{.Count}} meters tall.", + "one": "I am {{.Count}} meters tall.", + "other": "I am {{.Count}} meters tall.", + "two": "I am {{.Count}} meters tall.", + "zero": "I am {{.Count}} meters tall." + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "few": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}.", + "many": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}.", + "one": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}.", + "other": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}.", + "two": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}.", + "zero": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}." + } + }, + { + "id": "program_greeting", + "translation": "Hello world" + }, + { + "id": "your_unread_email_count", + "translation": { + "few": "You have {{.Count}} unread emails.", + "many": "You have {{.Count}} unread emails.", + "one": "You have {{.Count}} unread emails.", + "other": "You have {{.Count}} unread emails.", + "two": "You have {{.Count}} unread emails.", + "zero": "You have {{.Count}} unread emails." + } + } +]
\ No newline at end of file diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/en-us.all.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/en-us.all.json new file mode 100644 index 000000000..5aedc235a --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/en-us.all.json @@ -0,0 +1,45 @@ +[ + { + "id": "d_days", + "translation": { + "one": "{{.Count}} day", + "other": "{{.Count}} days" + } + }, + { + "id": "my_height_in_meters", + "translation": { + "one": "I am {{.Count}} meter tall.", + "other": "I am {{.Count}} meters tall." + } + }, + { + "id": "person_greeting", + "translation": "Hello {{.Person}}" + }, + { + "id": "person_unread_email_count", + "translation": { + "one": "{{.Person}} has {{.Count}} unread email.", + "other": "{{.Person}} has {{.Count}} unread emails." + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "one": "{{.Person}} has {{.Count}} unread email in the past {{.Timeframe}}.", + "other": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}." + } + }, + { + "id": "program_greeting", + "translation": "Hello world" + }, + { + "id": "your_unread_email_count", + "translation": { + "one": "You have {{.Count}} unread email.", + "other": "You have {{.Count}} unread emails." + } + } +]
\ No newline at end of file diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/en-us.untranslated.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/en-us.untranslated.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/en-us.untranslated.json @@ -0,0 +1 @@ +[]
\ No newline at end of file diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/fr-fr.all.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/fr-fr.all.json new file mode 100644 index 000000000..20e0b8736 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/fr-fr.all.json @@ -0,0 +1,45 @@ +[ + { + "id": "d_days", + "translation": { + "one": "", + "other": "" + } + }, + { + "id": "my_height_in_meters", + "translation": { + "one": "", + "other": "" + } + }, + { + "id": "person_greeting", + "translation": "" + }, + { + "id": "person_unread_email_count", + "translation": { + "one": "", + "other": "" + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "one": "", + "other": "" + } + }, + { + "id": "program_greeting", + "translation": "" + }, + { + "id": "your_unread_email_count", + "translation": { + "one": "", + "other": "" + } + } +]
\ No newline at end of file diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/fr-fr.untranslated.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/fr-fr.untranslated.json new file mode 100644 index 000000000..e2d3967c5 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/expected/fr-fr.untranslated.json @@ -0,0 +1,45 @@ +[ + { + "id": "d_days", + "translation": { + "one": "{{.Count}} days", + "other": "{{.Count}} days" + } + }, + { + "id": "my_height_in_meters", + "translation": { + "one": "I am {{.Count}} meters tall.", + "other": "I am {{.Count}} meters tall." + } + }, + { + "id": "person_greeting", + "translation": "Hello {{.Person}}" + }, + { + "id": "person_unread_email_count", + "translation": { + "one": "{{.Person}} has {{.Count}} unread emails.", + "other": "{{.Person}} has {{.Count}} unread emails." + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "one": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}.", + "other": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}." + } + }, + { + "id": "program_greeting", + "translation": "Hello world" + }, + { + "id": "your_unread_email_count", + "translation": { + "one": "You have {{.Count}} unread emails.", + "other": "You have {{.Count}} unread emails." + } + } +]
\ No newline at end of file diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/ar-ar.one.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/ar-ar.one.json new file mode 100644 index 000000000..f5af1d6f4 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/ar-ar.one.json @@ -0,0 +1,54 @@ +[ + { + "id": "d_days", + "translation": { + "few": "arabic few translation of d_days", + "many": "arabic many translation of d_days", + "one": "", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "person_greeting", + "translation": "arabic translation of person_greeting" + }, + { + "id": "person_unread_email_count", + "translation": { + "few": "arabic few translation of person_unread_email_count", + "many": "arabic many translation of person_unread_email_count", + "one": "arabic one translation of person_unread_email_count", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "program_greeting", + "translation": "" + }, + { + "id": "your_unread_email_count", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + } +] diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/ar-ar.two.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/ar-ar.two.json new file mode 100644 index 000000000..e98d7e9b2 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/ar-ar.two.json @@ -0,0 +1,54 @@ +[ + { + "id": "d_days", + "translation": { + "few": "new arabic few translation of d_days", + "many": "", + "one": "arabic one translation of d_days", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "person_greeting", + "translation": "new arabic translation of person_greeting" + }, + { + "id": "person_unread_email_count", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "arabic other translation of person_unread_email_count", + "two": "arabic two translation of person_unread_email_count", + "zero": "arabic zero translation of person_unread_email_count" + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "program_greeting", + "translation": "" + }, + { + "id": "your_unread_email_count", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + } +] diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/en-us.one.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/en-us.one.json new file mode 100644 index 000000000..63a9d6ffb --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/en-us.one.json @@ -0,0 +1,30 @@ +[ + { + "id": "program_greeting", + "translation": "Hello world" + }, + { + "id": "your_unread_email_count", + "translation": { + "one": "You have {{.Count}} unread email.", + "other": "You have {{.Count}} unread emails." + } + }, + { + "id": "my_height_in_meters", + "translation": { + "one": "I am {{.Count}} meter tall.", + "other": "I am {{.Count}} meters tall." + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "one": "{{.Person}} has {{.Count}} unread email in the past {{.Timeframe}}." + } + }, + { + "id": "d_days", + "translation": "this should get overwritten" + } +] diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/en-us.two.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/en-us.two.json new file mode 100644 index 000000000..dcc715c43 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/en-us.two.json @@ -0,0 +1,26 @@ +[ + { + "id": "person_greeting", + "translation": "Hello {{.Person}}" + }, + { + "id": "person_unread_email_count", + "translation": { + "one": "{{.Person}} has {{.Count}} unread email.", + "other": "{{.Person}} has {{.Count}} unread emails." + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "other": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}." + } + }, + { + "id": "d_days", + "translation": { + "one": "{{.Count}} day", + "other": "{{.Count}} days" + } + } +] diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/fr-fr.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/fr-fr.json new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/fr-fr.json diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/ar-ar.one.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/ar-ar.one.json new file mode 100644 index 000000000..f5af1d6f4 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/ar-ar.one.json @@ -0,0 +1,54 @@ +[ + { + "id": "d_days", + "translation": { + "few": "arabic few translation of d_days", + "many": "arabic many translation of d_days", + "one": "", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "person_greeting", + "translation": "arabic translation of person_greeting" + }, + { + "id": "person_unread_email_count", + "translation": { + "few": "arabic few translation of person_unread_email_count", + "many": "arabic many translation of person_unread_email_count", + "one": "arabic one translation of person_unread_email_count", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "program_greeting", + "translation": "" + }, + { + "id": "your_unread_email_count", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + } +] diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/ar-ar.two.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/ar-ar.two.json new file mode 100644 index 000000000..e98d7e9b2 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/ar-ar.two.json @@ -0,0 +1,54 @@ +[ + { + "id": "d_days", + "translation": { + "few": "new arabic few translation of d_days", + "many": "", + "one": "arabic one translation of d_days", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "person_greeting", + "translation": "new arabic translation of person_greeting" + }, + { + "id": "person_unread_email_count", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "arabic other translation of person_unread_email_count", + "two": "arabic two translation of person_unread_email_count", + "zero": "arabic zero translation of person_unread_email_count" + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + }, + { + "id": "program_greeting", + "translation": "" + }, + { + "id": "your_unread_email_count", + "translation": { + "few": "", + "many": "", + "one": "", + "other": "", + "two": "", + "zero": "" + } + } +] diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/en-us.one.yaml b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/en-us.one.yaml new file mode 100644 index 000000000..3ca8e380d --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/en-us.one.yaml @@ -0,0 +1,19 @@ +- id: program_greeting + translation: Hello world + +- id: your_unread_email_count + translation: + one: You have {{.Count}} unread email. + other: You have {{.Count}} unread emails. + +- id: my_height_in_meters + translation: + one: I am {{.Count}} meter tall. + other: I am {{.Count}} meters tall. + +- id: person_unread_email_count_timeframe + translation: + one: "{{.Person}} has {{.Count}} unread email in the past {{.Timeframe}}." + +- id: d_days + translation: this should get overwritten
\ No newline at end of file diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/en-us.two.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/en-us.two.json new file mode 100644 index 000000000..dcc715c43 --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/en-us.two.json @@ -0,0 +1,26 @@ +[ + { + "id": "person_greeting", + "translation": "Hello {{.Person}}" + }, + { + "id": "person_unread_email_count", + "translation": { + "one": "{{.Person}} has {{.Count}} unread email.", + "other": "{{.Person}} has {{.Count}} unread emails." + } + }, + { + "id": "person_unread_email_count_timeframe", + "translation": { + "other": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}." + } + }, + { + "id": "d_days", + "translation": { + "one": "{{.Count}} day", + "other": "{{.Count}} days" + } + } +] diff --git a/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/fr-fr.json b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/fr-fr.json new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/vendor/github.com/nicksnyder/go-i18n/goi18n/testdata/input/yaml/fr-fr.json |