You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=......\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=.....\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=.....\AppData\Local\Temp\go-build844154330=/tmp/go-build -gno-record-gcc-switches
What did you do?
I am developing a web app that should support multiple languages (days and months names should also change when user selects a languag). I am using "github.com/beego/i18n" to achieve i18n on my front-end. All days and months (long and short names) are configured for each language in the locale.ini specified for that language. Even when I read the days and months for each language, I am not able to pass it so the time module uses it instead of the hard-coded English long/short days and months names.
Suggesting
var longDayNames
var shortDayNames
var shortMonthNames
var longMonthNames
be changed to
var ShortDayNames
var LongDayNames
var ShortMonthNames
var LongMonthNames
ianlancetaylor
changed the title
go/scr/time: Long/Short day and month names should start with Upper case to allow customization
proposal: time: Long/Short day and month names should start with Upper case to allow customization
Oct 4, 2019
This is an API change, so I turned it into a proposal.
Personally I think this is simply beyond the scope of the time package. The time package provides simple functionality, using some English words, with no support for internationalization. Serious internationalization support should be done using a different package, such as https://godoc.org/gitlab.com/variadico/lctime (note that I have never tried that package myself and I don't know its quality).
Yes, this is definitely beyond the scope of the time package.
For better or worse, time prints English names.
Internationalized time support is meant to be in golang.org/x/text/date, but it hasn't been completed.
There's already an answer (use x/text/date), and the suggested approach is not safe for use by multiple goroutines: what if you have a server that wants to format dates differently in different requests? Modifying globals is not safe there.
This seems like a likely decline (unsafe, functionality started elsewhere).
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am developing a web app that should support multiple languages (days and months names should also change when user selects a languag). I am using "github.com/beego/i18n" to achieve i18n on my front-end. All days and months (long and short names) are configured for each language in the locale.ini specified for that language. Even when I read the days and months for each language, I am not able to pass it so the time module uses it instead of the hard-coded English long/short days and months names.
Suggesting
var longDayNames
var shortDayNames
var shortMonthNames
var longMonthNames
be changed to
var ShortDayNames
var LongDayNames
var ShortMonthNames
var LongMonthNames
func (c *ExtendedController) UpdateDaysAndMonthsToUserLocale() {
}
What did you expect to see?
var LongDayNames = []string{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", }
var ShortDayNames = []string{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", }
var ShortMonthNames = []string{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }
var LongMonthNames = []string{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }
What did you see instead?
var longDayNames = []string{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", }
var shortDayNames = []string{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", }
var shortMonthNames = []string{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", }
var longMonthNames = []string{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", }
The text was updated successfully, but these errors were encountered: