mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
langs/i18n: Fix multiple unknown language codes
This fixes a bug upstream by temporarily using a patched version of go-i18n. Closes #7838
This commit is contained in:
parent
78c1a6a7c6
commit
7eb80a9e6f
5 changed files with 28 additions and 3 deletions
3
go.mod
3
go.mod
|
@ -26,6 +26,8 @@ require (
|
|||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/gobuffalo/flect v0.2.2
|
||||
github.com/gobwas/glob v0.2.3
|
||||
github.com/gohugoio/go-i18n v2.1.3-0.20210430103248-4c28c89f8013+incompatible // indirect
|
||||
github.com/gohugoio/go-i18n/v2 v2.1.3-0.20210430103248-4c28c89f8013
|
||||
github.com/gohugoio/testmodBuilder/mods v0.0.0-20190520184928-c56af20f2e95
|
||||
github.com/google/go-cmp v0.5.5
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
|
@ -39,7 +41,6 @@ require (
|
|||
github.com/mitchellh/mapstructure v1.3.3
|
||||
github.com/muesli/smartcrop v0.3.0
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
||||
github.com/nicksnyder/go-i18n/v2 v2.1.2
|
||||
github.com/niklasfasching/go-org v1.5.0
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/pelletier/go-toml v1.9.0
|
||||
|
|
4
go.sum
4
go.sum
|
@ -227,6 +227,10 @@ github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
|
|||
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/gohugoio/go-i18n v2.1.3-0.20210430103248-4c28c89f8013+incompatible h1:0d/CxRl9eRy8UOO86f80axTI2TcP1hEEgExnhFKXIkw=
|
||||
github.com/gohugoio/go-i18n v2.1.3-0.20210430103248-4c28c89f8013+incompatible/go.mod h1:KyP0P5LEhJdtIq9PYxFiaxeWtFngJO5zLkDvEiqG8gI=
|
||||
github.com/gohugoio/go-i18n/v2 v2.1.3-0.20210430103248-4c28c89f8013 h1:Nj29Qbkt0bZ/bJl8eccfxQp3NlU/0IW1v9eyYtQ53XQ=
|
||||
github.com/gohugoio/go-i18n/v2 v2.1.3-0.20210430103248-4c28c89f8013/go.mod h1:3Ltoo9Banwq0gOtcOwxuHG6omk+AwsQPADyw2vQYOJQ=
|
||||
github.com/gohugoio/testmodBuilder/mods v0.0.0-20190520184928-c56af20f2e95 h1:sgew0XCnZwnzpWxTt3V8LLiCO7OQi3C6dycaE67wfkU=
|
||||
github.com/gohugoio/testmodBuilder/mods v0.0.0-20190520184928-c56af20f2e95/go.mod h1:bOlVlCa1/RajcHpXkrUXPSHB/Re1UnlXxD1Qp8SKOd8=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
|
|
|
@ -24,7 +24,7 @@ import (
|
|||
"github.com/gohugoio/hugo/config"
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"github.com/gohugoio/go-i18n/v2/i18n"
|
||||
)
|
||||
|
||||
type translateFunc func(translationID string, templateData interface{}) string
|
||||
|
|
|
@ -271,6 +271,26 @@ other = "{{ .Count }} minuttar lesing"`),
|
|||
expected: "3 minuttar lesing",
|
||||
expectedFlag: "3 minuttar lesing",
|
||||
},
|
||||
// Issue #7838
|
||||
{
|
||||
name: "unknown-language-codes",
|
||||
data: map[string][]byte{
|
||||
"en.toml": []byte(`[readingTime]
|
||||
one ="en one"
|
||||
other = "en count {{.Count}}"`),
|
||||
"a1.toml": []byte(`[readingTime]
|
||||
one = "a1 one"
|
||||
other = "a1 count {{ .Count }}"`),
|
||||
"a2.toml": []byte(`[readingTime]
|
||||
one = "a2 one"
|
||||
other = "a2 count {{ .Count }}"`),
|
||||
},
|
||||
args: 3,
|
||||
lang: "a2",
|
||||
id: "readingTime",
|
||||
expected: "a2 count 3",
|
||||
expectedFlag: "a2 count 3",
|
||||
},
|
||||
// https://github.com/gohugoio/hugo/issues/7798
|
||||
{
|
||||
name: "known-language-missing-plural",
|
||||
|
|
|
@ -22,7 +22,7 @@ import (
|
|||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"github.com/gohugoio/hugo/helpers"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"github.com/gohugoio/go-i18n/v2/i18n"
|
||||
toml "github.com/pelletier/go-toml"
|
||||
|
||||
"github.com/gohugoio/hugo/deps"
|
||||
|
|
Loading…
Reference in a new issue