go-playground / locales

:earth_americas: a set of locales generated from the CLDR Project which can be used independently or within an i18n package; these were built for use with, but not exclusive to https://github.com/go-playground/universal-translator
MIT License
266 stars 55 forks source link

Update to CLDR v39 #32

Open bojanz opened 3 years ago

bojanz commented 3 years ago

The current data is 6 CLDR releases behind, so let's track the update here.

bojanz commented 3 years ago

I have tried to download the latest data to cmd/data/core, but "go run generate_resources.go" fails with:

Writing Data: yo_BJ
2020/11/06 13:11:32 failed execute "goimports" for file ../yo_BJ/yo_BJ.go: exit status 2
panic: failed execute "goimports" for file ../yo_BJ/yo_BJ.go: exit status 2

Running goimports on yo_BJ.go manually gave me:

❯ goimports -w ../yo_BJ/yo_BJ.go 
../yo_BJ/yo_BJ.go:559:35: expected ';', found b
../yo_BJ/yo_BJ.go:571:35: expected ';', found b

Here are the two offending functions in the file:

func(yo *yo_BJ) FmtTimeShort(t time.Time) string {

    b := make([]byte, 0, 32)

    b = strconv.AppendInt(b, int64(t.Hour()), 10)
b = append(b, yo.timeSeparator...)b = strconv.AppendInt(b, int64(t.Minute()), 10)

    return string(b)
}

and

// FmtTimeMedium returns the medium time representation of 't' for 'yo_BJ'
func(yo *yo_BJ) FmtTimeMedium(t time.Time) string {

    b := make([]byte, 0, 32)

    b = strconv.AppendInt(b, int64(t.Hour()), 10)
b = append(b, yo.timeSeparator...)b = strconv.AppendInt(b, int64(t.Minute()), 10)
b = append(b, yo.timeSeparator...)b = strconv.AppendInt(b, int64(t.Second()), 10)

    return string(b)
}

This means that generate_resources.go has a bug in parseDateTimeFormat().

To be continued.

EDIT: Tracked down to a missing newline on line 1344.

bojanz commented 3 years ago

Out of time. The v38 PR will need further work.

Opened #35 which gets us to CLDR v36.1 cleanly. Probably best to merge that and then chase the next two updates.

bojanz commented 2 years ago

35 has been merged, v0.14 now has CLDR v36.1.

38 brings us up to v37, since that one passed cleanly.

Updating to v38.1 still requires fixing additional bugs in the scripts.