Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea8b48a

Browse files
jmooringbep
authored andcommitted
tpl/time: Fix locale-specific month abbreviations
Closes #14948
1 parent 076dfe1 commit ea8b48a

3 files changed

Lines changed: 56 additions & 5 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/bep/goat v0.5.0
1313
github.com/bep/godartsass/v2 v2.5.0
1414
github.com/bep/golibsass v1.2.0
15-
github.com/bep/golocales v0.1.0
15+
github.com/bep/golocales v0.2.0
1616
github.com/bep/goportabletext v0.2.0
1717
github.com/bep/helpers v0.12.0
1818
github.com/bep/imagemeta v0.17.2

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ github.com/bep/godartsass/v2 v2.5.0 h1:tKRvwVdyjCIr48qgtLa4gHEdtRkPF8H1OeEhJAEv7
158158
github.com/bep/godartsass/v2 v2.5.0/go.mod h1:rjsi1YSXAl/UbsGL85RLDEjRKdIKUlMQHr6ChUNYOFU=
159159
github.com/bep/golibsass v1.2.0 h1:nyZUkKP/0psr8nT6GR2cnmt99xS93Ji82ZD9AgOK6VI=
160160
github.com/bep/golibsass v1.2.0/go.mod h1:DL87K8Un/+pWUS75ggYv41bliGiolxzDKWJAq3eJ1MA=
161-
github.com/bep/golocales v0.1.0 h1:rjWf1S4basIje+G+je5WMW8G+yzaoz4gEDFolrFVdvA=
162-
github.com/bep/golocales v0.1.0/go.mod h1:Hl78nje8mNL3LzLeJvYN9NsIZgyFJGrGfvgO9r1+mwE=
161+
github.com/bep/golocales v0.2.0 h1:4H1H5UPw3ainpj5zykeEfiMRQngyaIC/t+I4Dvn+fvE=
162+
github.com/bep/golocales v0.2.0/go.mod h1:Hl78nje8mNL3LzLeJvYN9NsIZgyFJGrGfvgO9r1+mwE=
163163
github.com/bep/goportabletext v0.2.0 h1:CZ9f8jADBWqHwBymQiJJPCTSV/tHSA+PYzlUf86Yze0=
164164
github.com/bep/goportabletext v0.2.0/go.mod h1:xDeA5+qcgKzJq6Q6XjAiBKtxLD3Yn7f6XP4joD3J3qU=
165165
github.com/bep/helpers v0.12.0 h1:tD6V2DQW0B+FUynF2etR/106S/TO9akm+vA/Hk24GxY=
@@ -502,8 +502,6 @@ github.com/tdewolff/parse/v2 v2.8.12/go.mod h1:Hwlni2tiVNKyzR1o6nUs4FOF07URA+JLB
502502
github.com/tdewolff/test v1.0.11/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8=
503503
github.com/tdewolff/test v1.0.12 h1:7F21DqIajswxuche0geHdrUZRCWE4oko4b7bcmkkrxk=
504504
github.com/tdewolff/test v1.0.12/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8=
505-
github.com/tetratelabs/wazero v1.11.0 h1:+gKemEuKCTevU4d7ZTzlsvgd1uaToIDtlQlmNbwqYhA=
506-
github.com/tetratelabs/wazero v1.11.0/go.mod h1:eV28rsN8Q+xwjogd7f4/Pp4xFxO7uOGbLcD/LzB1wiU=
507505
github.com/tetratelabs/wazero v1.11.1-0.20260521072212-475a1f8f0dc3 h1:0Jpp+tPkvALC9hcZUYOj/6yWYvUIV/kKoxRDj0a6zk4=
508506
github.com/tetratelabs/wazero v1.11.1-0.20260521072212-475a1f8f0dc3/go.mod h1:LvKtzl2RqO4gyF27BiXU+nKAjcV8f38U+kP/q2vgxh0=
509507
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=

tpl/time/time_integration_test.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright 2017 The Hugo Authors. All rights reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
package time_test
15+
16+
import (
17+
"testing"
18+
19+
"github.com/gohugoio/hugo/hugolib"
20+
)
21+
22+
// See issue 14948.
23+
func TestTimeFormatMonthAbbreviationsEnGB(t *testing.T) {
24+
t.Parallel()
25+
26+
files := `
27+
-- hugo.toml --
28+
locale = 'en-GB'
29+
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
30+
-- layouts/home.html --
31+
{{ $dates := slice
32+
"2025-01-17T10:42:00-08:00"
33+
"2025-02-17T10:42:00-08:00"
34+
"2025-03-17T10:42:00-07:00"
35+
"2025-04-17T10:42:00-07:00"
36+
"2025-05-17T10:42:00-07:00"
37+
"2025-06-17T10:42:00-07:00"
38+
"2025-07-17T10:42:00-07:00"
39+
"2025-08-17T10:42:00-07:00"
40+
"2025-09-17T10:42:00-07:00"
41+
"2025-10-17T10:42:00-07:00"
42+
"2025-11-17T10:42:00-08:00"
43+
"2025-12-17T10:42:00-08:00"
44+
}}
45+
{{- range $dates }}
46+
{{- time.Format "Jan" . }}|
47+
{{- end }}
48+
`
49+
50+
b := hugolib.Test(t, files)
51+
52+
b.AssertFileContent("public/index.html", "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec|")
53+
}

0 commit comments

Comments
 (0)