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

Skip to content

Localization broken for locales with partial month/day overrides #14948

@jmooring

Description

@jmooring

Reference: https://discourse.gohugo.io/t/only-september-rendering-with-date-format-jan/57153

Locales such as en-GB that only partially override month or day names return empty strings for the inherited names.

See:

Integration test:

// Issue 14948
func TestTimeFormatMonthAbbreviationsEnGB(t *testing.T) {
	t.Parallel()

	files := `
-- hugo.toml --
locale = 'en-GB'
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- layouts/home.html --
{{ $dates := slice
	"2025-01-17T10:42:00-08:00"
	"2025-02-17T10:42:00-08:00"
	"2025-03-17T10:42:00-07:00"
	"2025-04-17T10:42:00-07:00"
	"2025-05-17T10:42:00-07:00"
	"2025-06-17T10:42:00-07:00"
	"2025-07-17T10:42:00-07:00"
	"2025-08-17T10:42:00-07:00"
	"2025-09-17T10:42:00-07:00"
	"2025-10-17T10:42:00-07:00"
	"2025-11-17T10:42:00-08:00"
	"2025-12-17T10:42:00-08:00"
}}
{{- range $dates }}
	{{- time.Format "Jan" . }}|
{{- end }}
`

	b := hugolib.Test(t, files)

	b.AssertFileContent("public/index.html", "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec|")
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions