PLT-1800 Load server side locale from the config.json (#3135)
* PLT-1800 Load server side locale from the config.json * Add support for locales with country specifics * Fix localization on served locale file as plain/text * Remove github.com/cloudfoundry/jibber_jabber as vendor dependency
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
7be2a05cf5
Коммит
b00a60ab71
@@ -204,20 +204,27 @@ type ComplianceSettings struct {
|
||||
EnableDaily *bool
|
||||
}
|
||||
|
||||
type LocalizationSettings struct {
|
||||
DefaultServerLocale *string
|
||||
DefaultClientLocale *string
|
||||
AvailableLocales *string
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
ServiceSettings ServiceSettings
|
||||
TeamSettings TeamSettings
|
||||
SqlSettings SqlSettings
|
||||
LogSettings LogSettings
|
||||
FileSettings FileSettings
|
||||
EmailSettings EmailSettings
|
||||
RateLimitSettings RateLimitSettings
|
||||
PrivacySettings PrivacySettings
|
||||
SupportSettings SupportSettings
|
||||
GitLabSettings SSOSettings
|
||||
GoogleSettings SSOSettings
|
||||
LdapSettings LdapSettings
|
||||
ComplianceSettings ComplianceSettings
|
||||
ServiceSettings ServiceSettings
|
||||
TeamSettings TeamSettings
|
||||
SqlSettings SqlSettings
|
||||
LogSettings LogSettings
|
||||
FileSettings FileSettings
|
||||
EmailSettings EmailSettings
|
||||
RateLimitSettings RateLimitSettings
|
||||
PrivacySettings PrivacySettings
|
||||
SupportSettings SupportSettings
|
||||
GitLabSettings SSOSettings
|
||||
GoogleSettings SSOSettings
|
||||
LdapSettings LdapSettings
|
||||
ComplianceSettings ComplianceSettings
|
||||
LocalizationSettings LocalizationSettings
|
||||
}
|
||||
|
||||
func (o *Config) ToJson() string {
|
||||
@@ -513,6 +520,21 @@ func (o *Config) SetDefaults() {
|
||||
o.LdapSettings.NicknameAttribute = new(string)
|
||||
*o.LdapSettings.NicknameAttribute = ""
|
||||
}
|
||||
|
||||
if o.LocalizationSettings.DefaultServerLocale == nil {
|
||||
o.LocalizationSettings.DefaultServerLocale = new(string)
|
||||
*o.LocalizationSettings.DefaultServerLocale = DEFAULT_LOCALE
|
||||
}
|
||||
|
||||
if o.LocalizationSettings.DefaultClientLocale == nil {
|
||||
o.LocalizationSettings.DefaultClientLocale = new(string)
|
||||
*o.LocalizationSettings.DefaultClientLocale = DEFAULT_LOCALE
|
||||
}
|
||||
|
||||
if o.LocalizationSettings.AvailableLocales == nil {
|
||||
o.LocalizationSettings.AvailableLocales = new(string)
|
||||
*o.LocalizationSettings.AvailableLocales = *o.LocalizationSettings.DefaultClientLocale
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Config) IsValid() *AppError {
|
||||
|
||||
@@ -136,7 +136,6 @@ func (u *User) PreSave() {
|
||||
|
||||
u.Username = strings.ToLower(u.Username)
|
||||
u.Email = strings.ToLower(u.Email)
|
||||
u.Locale = strings.ToLower(u.Locale)
|
||||
|
||||
u.CreateAt = GetMillis()
|
||||
u.UpdateAt = u.CreateAt
|
||||
@@ -166,7 +165,6 @@ func (u *User) PreSave() {
|
||||
func (u *User) PreUpdate() {
|
||||
u.Username = strings.ToLower(u.Username)
|
||||
u.Email = strings.ToLower(u.Email)
|
||||
u.Locale = strings.ToLower(u.Locale)
|
||||
u.UpdateAt = GetMillis()
|
||||
|
||||
if u.AuthData != nil && *u.AuthData == "" {
|
||||
|
||||
Ссылка в новой задаче
Block a user