From bddcfd911ca03cca63a2c56dcbc158015ac38c20 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 18 Feb 2022 09:17:29 -0800 Subject: [PATCH] deps: Update github.com/gohugoio/localescompressed v0.14.0 => v0.15.0 Fixes #9446 --- go.mod | 4 ++-- go.sum | 9 ++------- tpl/lang/lang_test.go | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index ee2ce497436..df37a22dcc6 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/gobwas/glob v0.2.3 github.com/gohugoio/go-i18n/v2 v2.1.3-0.20210430103248-4c28c89f8013 github.com/gohugoio/locales v0.14.0 - github.com/gohugoio/localescompressed v0.14.0 + github.com/gohugoio/localescompressed v0.15.0 github.com/gohugoio/testmodBuilder/mods v0.0.0-20190520184928-c56af20f2e95 github.com/google/go-cmp v0.5.6 github.com/gorilla/websocket v1.4.2 @@ -63,7 +63,7 @@ require ( golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/text v0.3.7 - golang.org/x/tools v0.1.9 // indirect + golang.org/x/tools v0.1.9 google.golang.org/api v0.63.0 gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index dd8e6eff6a4..e4bdfa05d93 100644 --- a/go.sum +++ b/go.sum @@ -111,8 +111,6 @@ github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkK github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.2-0.20200305040604-4f3623dce67a/go.mod h1:fv5SzZPFJbwp2NXJWpFIX7DZS4HgV1K4ew4Pc2OZD9s= github.com/alecthomas/chroma v0.8.2/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= -github.com/alecthomas/chroma v0.9.4 h1:YL7sOAE3p8HS96T9km7RgvmsZIctqbK1qJ0b7hzed44= -github.com/alecthomas/chroma v0.9.4/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= @@ -227,8 +225,6 @@ github.com/envoyproxy/go-control-plane v0.10.1/go.mod h1:AY7fTTXNdv/aJ2O5jwpxAPO github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.2 h1:JiO+kJTpmYGjEodY7O1Zk8oZcNz1+f30UtwtXoFUPzE= github.com/envoyproxy/protoc-gen-validate v0.6.2/go.mod h1:2t7qjJNvHPx8IjnBOzl9E9/baC+qXE/TeeyBRzgJDws= -github.com/evanw/esbuild v0.14.11 h1:bw50N4v70Dqf/B6Wn+3BM6BVttz4A6tHn8m8Ydj9vxk= -github.com/evanw/esbuild v0.14.11/go.mod h1:GG+zjdi59yh3ehDn4ZWfPcATxjPDUH53iU4ZJbp7dkY= github.com/evanw/esbuild v0.14.22 h1:XAP8PsfWJtxyPRBmh6slpSPZbAlClk/MCVPw7qGuC4Q= github.com/evanw/esbuild v0.14.22/go.mod h1:GG+zjdi59yh3ehDn4ZWfPcATxjPDUH53iU4ZJbp7dkY= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -275,8 +271,8 @@ github.com/gohugoio/go-i18n/v2 v2.1.3-0.20210430103248-4c28c89f8013 h1:Nj29Qbkt0 github.com/gohugoio/go-i18n/v2 v2.1.3-0.20210430103248-4c28c89f8013/go.mod h1:3Ltoo9Banwq0gOtcOwxuHG6omk+AwsQPADyw2vQYOJQ= github.com/gohugoio/locales v0.14.0 h1:Q0gpsZwfv7ATHMbcTNepFd59H7GoykzWJIxi113XGDc= github.com/gohugoio/locales v0.14.0/go.mod h1:ip8cCAv/cnmVLzzXtiTpPwgJ4xhKZranqNqtoIu0b/4= -github.com/gohugoio/localescompressed v0.14.0 h1:gP4zzgfF3NFr2rNzwxReD/tDXz98pAGVmrPy3ZCLRDc= -github.com/gohugoio/localescompressed v0.14.0/go.mod h1:jBF6q8D7a0vaEmcWPNcAjUZLJaIVNiwvM3WlmTvooB0= +github.com/gohugoio/localescompressed v0.15.0 h1:KG+mPzRdPs7eklbZ7KsIikzwvd4wcyA9vv2MniUrFQ8= +github.com/gohugoio/localescompressed v0.15.0/go.mod h1:jBF6q8D7a0vaEmcWPNcAjUZLJaIVNiwvM3WlmTvooB0= 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= @@ -748,7 +744,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d h1:LO7XpTYMwTqxjLcGWPijK3vRXg1aWdlNOVOHRq45d7c= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= diff --git a/tpl/lang/lang_test.go b/tpl/lang/lang_test.go index 3a1f66df74a..8d5430f6f0e 100644 --- a/tpl/lang/lang_test.go +++ b/tpl/lang/lang_test.go @@ -3,9 +3,9 @@ package lang import ( "testing" - translators "github.com/gohugoio/localescompressed" qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/deps" + translators "github.com/gohugoio/localescompressed" ) func TestNumFmt(t *testing.T) { @@ -105,3 +105,36 @@ func TestFormatNumbers(t *testing.T) { }) } + +// Issue 9446 +func TestLanguageKeyFormat(t *testing.T) { + + c := qt.New(t) + + nsUnderscoreUpper := New(&deps.Deps{}, translators.GetTranslator("es_ES")) + nsUnderscoreLower := New(&deps.Deps{}, translators.GetTranslator("es_es")) + nsHyphenUpper := New(&deps.Deps{}, translators.GetTranslator("es-ES")) + nsHyphenLower := New(&deps.Deps{}, translators.GetTranslator("es-es")) + pi := 3.14159265359 + + c.Run("FormatNumber", func(c *qt.C) { + c.Parallel() + got, err := nsUnderscoreUpper.FormatNumber(3, pi) + c.Assert(err, qt.IsNil) + c.Assert(got, qt.Equals, "3,142") + + got, err = nsUnderscoreLower.FormatNumber(3, pi) + c.Assert(err, qt.IsNil) + c.Assert(got, qt.Equals, "3,142") + + got, err = nsHyphenUpper.FormatNumber(3, pi) + c.Assert(err, qt.IsNil) + c.Assert(got, qt.Equals, "3,142") + + got, err = nsHyphenLower.FormatNumber(3, pi) + c.Assert(err, qt.IsNil) + c.Assert(got, qt.Equals, "3,142") + + }) + +}