From b07437fa45a15d73c73359f490d9cfb1c7a12a35 Mon Sep 17 00:00:00 2001 From: Nick Snyder Date: Mon, 4 Dec 2023 21:20:17 -0800 Subject: [PATCH] format code --- v2/goi18n/main.go | 46 ++++++++++++++++++++++++--------------------- v2/i18n/bundlefs.go | 1 + v2/i18n/doc.go | 30 ++++++++++++++++------------- 3 files changed, 43 insertions(+), 34 deletions(-) diff --git a/v2/goi18n/main.go b/v2/goi18n/main.go index f2f3d2c1..86a44880 100644 --- a/v2/goi18n/main.go +++ b/v2/goi18n/main.go @@ -1,34 +1,38 @@ // Command goi18n manages message files used by the i18n package. // -// go get -u github.com/nicksnyder/go-i18n/v2/goi18n -// goi18n -help +// go get -u github.com/nicksnyder/go-i18n/v2/goi18n +// goi18n -help // // Use `goi18n extract` to create a message file that contains the messages defined in your Go source files. -// # en.toml -// [PersonCats] -// description = "The number of cats a person has" -// one = "{{.Name}} has {{.Count}} cat." -// other = "{{.Name}} has {{.Count}} cats." +// +// # en.toml +// [PersonCats] +// description = "The number of cats a person has" +// one = "{{.Name}} has {{.Count}} cat." +// other = "{{.Name}} has {{.Count}} cats." // // Use `goi18n merge` to create message files for translation. -// # translate.es.toml -// [PersonCats] -// description = "The number of cats a person has" -// hash = "sha1-f937a0e05e19bfe6cd70937c980eaf1f9832f091" -// one = "{{.Name}} has {{.Count}} cat." -// other = "{{.Name}} has {{.Count}} cats." +// +// # translate.es.toml +// [PersonCats] +// description = "The number of cats a person has" +// hash = "sha1-f937a0e05e19bfe6cd70937c980eaf1f9832f091" +// one = "{{.Name}} has {{.Count}} cat." +// other = "{{.Name}} has {{.Count}} cats." // // Use `goi18n merge` to merge translated message files with your existing message files. -// # active.es.toml -// [PersonCats] -// description = "The number of cats a person has" -// hash = "sha1-f937a0e05e19bfe6cd70937c980eaf1f9832f091" -// one = "{{.Name}} tiene {{.Count}} gato." -// other = "{{.Name}} tiene {{.Count}} gatos." +// +// # active.es.toml +// [PersonCats] +// description = "The number of cats a person has" +// hash = "sha1-f937a0e05e19bfe6cd70937c980eaf1f9832f091" +// one = "{{.Name}} tiene {{.Count}} gato." +// other = "{{.Name}} tiene {{.Count}} gatos." // // Load the active messages into your bundle. -// bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal) -// bundle.MustLoadMessageFile("active.es.toml") +// +// bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal) +// bundle.MustLoadMessageFile("active.es.toml") package main import ( diff --git a/v2/i18n/bundlefs.go b/v2/i18n/bundlefs.go index 50c794b6..4e636294 100644 --- a/v2/i18n/bundlefs.go +++ b/v2/i18n/bundlefs.go @@ -1,3 +1,4 @@ +//go:build go1.16 // +build go1.16 package i18n diff --git a/v2/i18n/doc.go b/v2/i18n/doc.go index 73d7a069..709b59a5 100644 --- a/v2/i18n/doc.go +++ b/v2/i18n/doc.go @@ -2,23 +2,27 @@ // according to a set of locale preferences. // // Create a Bundle to use for the lifetime of your application. -// bundle := i18n.NewBundle(language.English) +// +// bundle := i18n.NewBundle(language.English) // // Load translations into your bundle during initialization. -// bundle.LoadMessageFile("en-US.yaml") +// +// bundle.LoadMessageFile("en-US.yaml") // // Create a Localizer to use for a set of language preferences. -// func(w http.ResponseWriter, r *http.Request) { -// lang := r.FormValue("lang") -// accept := r.Header.Get("Accept-Language") -// localizer := i18n.NewLocalizer(bundle, lang, accept) -// } +// +// func(w http.ResponseWriter, r *http.Request) { +// lang := r.FormValue("lang") +// accept := r.Header.Get("Accept-Language") +// localizer := i18n.NewLocalizer(bundle, lang, accept) +// } // // Use the Localizer to lookup messages. -// localizer.MustLocalize(&i18n.LocalizeConfig{ -// DefaultMessage: &i18n.Message{ -// ID: "HelloWorld", -// Other: "Hello World!", -// }, -// }) +// +// localizer.MustLocalize(&i18n.LocalizeConfig{ +// DefaultMessage: &i18n.Message{ +// ID: "HelloWorld", +// Other: "Hello World!", +// }, +// }) package i18n