i18n: Update internationalization/dates.ts to use locale (#103731)

This commit is contained in:
Laura Fernández
2025-04-11 11:24:40 +02:00
committed by GitHub
parent c303cd3a8b
commit 3607356f65
6 changed files with 27 additions and 17 deletions
+2 -1
View File
@@ -69,7 +69,7 @@ func (hs *HTTPServer) setIndexViewData(c *contextmodel.ReqContext) (*dtos.IndexV
// Locale is used for some number and date/time formatting, whereas language is used just for
// translating words in the interface
acceptLangHeader := c.Req.Header.Get("Accept-Language")
locale := "en-US" // default to en-US formatting, but use the accept-lang header or user's preference
locale := "en-US" // default to en formatting, but use the accept-lang header or user's preference
language := "" // frontend will set the default language
urlPrefs := getURLPrefs(c)
@@ -85,6 +85,7 @@ func (hs *HTTPServer) setIndexViewData(c *contextmodel.ReqContext) (*dtos.IndexV
}
if hs.Features.IsEnabled(c.Req.Context(), featuremgmt.FlagLocaleFormatPreference) {
locale = "en" // default to "en", not "en-US", matching the locale code
if urlPrefs.Locale != "" {
locale = urlPrefs.Locale
} else if prefs.JSONData.Locale != "" {