diff --git a/core/database/scripts/mysql/db_00034.sql b/core/database/scripts/mysql/db_00034.sql new file mode 100644 index 00000000..463f7d7e --- /dev/null +++ b/core/database/scripts/mysql/db_00034.sql @@ -0,0 +1,5 @@ +/* Community Edition */ + +-- Local aware. +ALTER TABLE dmz_org ADD COLUMN `c_locale` VARCHAR(20) NOT NULL DEFAULT 'en-US'; +ALTER TABLE dmz_user ADD COLUMN `c_locale` VARCHAR(20) NOT NULL DEFAULT 'en-US'; diff --git a/core/database/scripts/postgresql/db_00010.sql b/core/database/scripts/postgresql/db_00010.sql new file mode 100644 index 00000000..08c86e8a --- /dev/null +++ b/core/database/scripts/postgresql/db_00010.sql @@ -0,0 +1,5 @@ +/* Community Edition */ + +-- Local aware. +ALTER TABLE dmz_org ADD COLUMN c_locale VARCHAR(20) NOT NULL DEFAULT 'en-US'; +ALTER TABLE dmz_user ADD COLUMN c_locale VARCHAR(20) NOT NULL DEFAULT 'en-US'; diff --git a/core/database/scripts/sqlserver/db_00007.sql b/core/database/scripts/sqlserver/db_00007.sql new file mode 100644 index 00000000..7ca5e1dd --- /dev/null +++ b/core/database/scripts/sqlserver/db_00007.sql @@ -0,0 +1,5 @@ +/* Community edition */ + +-- Local aware. +ALTER TABLE dmz_org ADD c_locale NVARCHAR(20) NOT NULL DEFAULT 'en-US'; +ALTER TABLE dmz_user ADD c_locale NVARCHAR(20) NOT NULL DEFAULT 'en-US'; diff --git a/core/i18n/localize.go b/core/i18n/localize.go index 36be7303..82513154 100644 --- a/core/i18n/localize.go +++ b/core/i18n/localize.go @@ -25,6 +25,7 @@ var localeMap map[string]map[string]string // SupportedLocales returns array of locales. func SupportedLocales() (locales []string) { locales = append(locales, "en-US") + locales = append(locales, "de-DE") return } diff --git a/domain/auth/add.go b/domain/auth/add.go index 16c6a39f..bb6654cb 100644 --- a/domain/auth/add.go +++ b/domain/auth/add.go @@ -48,6 +48,7 @@ func AddExternalUser(ctx domain.RequestContext, rt *env.Runtime, store *store.St if addUser { userID = uniqueid.Generate() u.RefID = userID + u.Locale = ctx.OrgLocale err = store.User.Add(ctx, u) if err != nil { diff --git a/domain/backup/backup.go b/domain/backup/backup.go index e401fca1..d3c4bdc3 100644 --- a/domain/backup/backup.go +++ b/domain/backup/backup.go @@ -244,7 +244,7 @@ func (b backerHandler) dmzOrg(files *[]backupItem) (err error) { c_anonaccess AS allowanonymousaccess, c_authprovider AS authprovider, coalesce(c_sub,`+b.Runtime.StoreProvider.JSONEmpty()+`) AS subscription, coalesce(c_authconfig,`+b.Runtime.StoreProvider.JSONEmpty()+`) AS authconfig, c_maxtags AS maxtags, - c_theme AS theme, c_logo AS logo, c_created AS created, c_revised AS revised + c_theme AS theme, c_logo AS logo, c_locale as locale, c_created AS created, c_revised AS revised FROM dmz_org`+w) if err != nil { return @@ -308,7 +308,7 @@ func (b backerHandler) dmzUserAccount(files *[]backupItem) (err error) { err = b.Runtime.Db.Select(&u, `SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised FROM dmz_user u`+w) if err != nil { diff --git a/domain/backup/restore.go b/domain/backup/restore.go index 3e524d48..73a5edf5 100644 --- a/domain/backup/restore.go +++ b/domain/backup/restore.go @@ -370,14 +370,14 @@ func (r *restoreHandler) dmzOrg() (err error) { INSERT INTO dmz_org (c_refid, c_company, c_title, c_message, c_domain, c_service, c_email, c_anonaccess, c_authprovider, c_authconfig, c_maxtags, c_verified, c_serial, c_sub, c_active, - c_theme, c_logo, c_created, c_revised) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`), + c_theme, c_logo, c_locale, c_created, c_revised) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`), org[i].RefID, org[i].Company, org[i].Title, org[i].Message, strings.ToLower(org[i].Domain), org[i].ConversionEndpoint, strings.ToLower(org[i].Email), org[i].AllowAnonymousAccess, org[i].AuthProvider, org[i].AuthConfig, org[i].MaxTags, r.Runtime.StoreProvider.IsTrue(), org[i].Serial, org[i].Subscription, org[i].Active, - org[i].Theme, org[i].Logo, + org[i].Theme, org[i].Logo, org[i].Locale, org[i].Created, org[i].Revised) if err != nil { r.Context.Transaction.Rollback() @@ -412,6 +412,7 @@ func (r *restoreHandler) dmzOrg() (err error) { org[0].Title = r.Spec.Org.Title org[0].Subscription = r.Spec.Org.Subscription org[0].Theme = r.Spec.Org.Theme + org[0].Locale = r.Spec.Org.Locale } _, err = r.Context.Transaction.NamedExec(`UPDATE dmz_org SET @@ -425,7 +426,8 @@ func (r *restoreHandler) dmzOrg() (err error) { c_message=:message, c_title=:title, c_serial=:serial, - c_sub=:subscription + c_sub=:subscription, + c_locale=:locale, WHERE c_refid=:refid`, &org[0]) if err != nil { r.Context.Transaction.Rollback() @@ -1735,11 +1737,11 @@ func (r *restoreHandler) dmzUser() (err error) { _, err = r.Context.Transaction.Exec(r.Runtime.Db.Rebind(` INSERT INTO dmz_user (c_refid, c_firstname, c_lastname, c_email, c_initials, c_globaladmin, - c_password, c_salt, c_reset, c_active, c_lastversion, c_created, c_revised) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`), + c_password, c_salt, c_reset, c_active, c_lastversion, c_locale, c_created, c_revised) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`), r.remapUser(u[i].RefID), u[i].Firstname, u[i].Lastname, strings.ToLower(u[i].Email), u[i].Initials, u[i].GlobalAdmin, u[i].Password, u[i].Salt, u[i].Reset, u[i].Active, - u[i].LastVersion, u[i].Created, u[i].Revised) + u[i].LastVersion, u[i].Locale, u[i].Created, u[i].Revised) if err != nil { r.Context.Transaction.Rollback() diff --git a/domain/context.go b/domain/context.go index 57c55bb0..1f245886 100644 --- a/domain/context.go +++ b/domain/context.go @@ -45,6 +45,7 @@ type RequestContext struct { ViewUsers bool Subscription Subscription Locale string + OrgLocale string } //GetAppURL returns full HTTP url for the app diff --git a/domain/meta/endpoint.go b/domain/meta/endpoint.go index 5bf95157..8ddf0997 100644 --- a/domain/meta/endpoint.go +++ b/domain/meta/endpoint.go @@ -69,6 +69,7 @@ func (h *Handler) Meta(w http.ResponseWriter, r *http.Request) { data.Storage = h.Runtime.StoreProvider.Type() data.Location = h.Runtime.Flags.Location // reserved data.Locale = org.Locale + data.Locales = i18n.SupportedLocales() if len(data.Locale) == 0 { data.Locale = i18n.DefaultLocale } diff --git a/domain/organization/store.go b/domain/organization/store.go index 3c3cf156..0734e215 100644 --- a/domain/organization/store.go +++ b/domain/organization/store.go @@ -52,7 +52,7 @@ func (s Store) GetOrganization(ctx domain.RequestContext, id string) (org org.Or c_anonaccess AS allowanonymousaccess, c_authprovider AS authprovider, coalesce(c_authconfig,`+s.EmptyJSON()+`) AS authconfig, coalesce(c_sub,`+s.EmptyJSON()+`) AS subscription, - c_maxtags AS maxtags, c_theme AS theme, c_created AS created, c_revised AS revised + c_maxtags AS maxtags, c_theme AS theme, c_locale as locale, c_created AS created, c_revised AS revised FROM dmz_org WHERE c_refid=?`), id) @@ -84,7 +84,7 @@ func (s Store) GetOrganizationByDomain(subdomain string) (o org.Organization, er c_anonaccess AS allowanonymousaccess, c_authprovider AS authprovider, coalesce(c_authconfig,`+s.EmptyJSON()+`) AS authconfig, coalesce(c_sub,`+s.EmptyJSON()+`) AS subscription, - c_maxtags AS maxtags, c_created AS created, c_revised AS revised, c_theme AS theme + c_maxtags AS maxtags, c_theme AS theme, c_locale as locale, c_created AS created, c_revised AS revised, c_theme AS theme FROM dmz_org WHERE c_domain=? AND c_active=`+s.IsTrue()), subdomain) @@ -99,7 +99,7 @@ func (s Store) GetOrganizationByDomain(subdomain string) (o org.Organization, er c_anonaccess AS allowanonymousaccess, c_authprovider AS authprovider, coalesce(c_authconfig,`+s.EmptyJSON()+`) AS authconfig, coalesce(c_sub,`+s.EmptyJSON()+`) AS subscription, - c_maxtags AS maxtags, c_created AS created, c_revised AS revised, c_theme AS theme + c_maxtags AS maxtags, c_theme AS theme, c_locale as locale, c_created AS created, c_revised AS revised, c_theme AS theme FROM dmz_org WHERE c_domain='' AND c_active=`+s.IsTrue())) @@ -116,7 +116,7 @@ func (s Store) UpdateOrganization(ctx domain.RequestContext, org org.Organizatio _, err = ctx.Transaction.NamedExec(`UPDATE dmz_org SET c_title=:title, c_message=:message, c_service=:conversionendpoint, c_email=:email, c_domain=:domain, - c_anonaccess=:allowanonymousaccess, c_maxtags=:maxtags, c_theme=:theme, c_revised=:revised + c_anonaccess=:allowanonymousaccess, c_maxtags=:maxtags, c_theme=:theme, c_locale=:locale, c_revised=:revised WHERE c_refid=:refid`, &org) diff --git a/domain/space/space.go b/domain/space/space.go index 051fddb9..99aa3707 100644 --- a/domain/space/space.go +++ b/domain/space/space.go @@ -42,6 +42,7 @@ func inviteNewUserToSharedSpace(ctx domain.RequestContext, rt *env.Runtime, s *s u.Password = secrets.GeneratePassword(requestedPassword, u.Salt) userID := uniqueid.Generate() u.RefID = userID + u.Locale = ctx.OrgLocale err = s.User.Add(ctx, u) if err != nil { diff --git a/domain/user/endpoint.go b/domain/user/endpoint.go index ab9110cd..de67f102 100644 --- a/domain/user/endpoint.go +++ b/domain/user/endpoint.go @@ -136,6 +136,7 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) { if addUser { userID = uniqueid.Generate() userModel.RefID = userID + userModel.Locale = ctx.OrgLocale err = h.Store.User.Add(ctx, userModel) if err != nil { @@ -781,6 +782,7 @@ func (h *Handler) BulkImport(w http.ResponseWriter, r *http.Request) { userModel.Firstname = strings.TrimSpace(v[0]) userModel.Lastname = strings.TrimSpace(v[1]) userModel.Email = strings.ToLower(strings.TrimSpace(v[2])) + userModel.Locale = ctx.OrgLocale if len(userModel.Email) == 0 || len(userModel.Firstname) == 0 || len(userModel.Lastname) == 0 { h.Runtime.Log.Info(method + " missing firstname, lastname, or email") diff --git a/domain/user/store.go b/domain/user/store.go index 4aef43b9..f6bf7083 100644 --- a/domain/user/store.go +++ b/domain/user/store.go @@ -38,8 +38,8 @@ func (s Store) Add(ctx domain.RequestContext, u user.User) (err error) { u.Created = time.Now().UTC() u.Revised = time.Now().UTC() - _, err = ctx.Transaction.Exec(s.Bind("INSERT INTO dmz_user (c_refid, c_firstname, c_lastname, c_email, c_initials, c_password, c_salt, c_reset, c_lastversion, c_created, c_revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"), - u.RefID, u.Firstname, u.Lastname, strings.TrimSpace(strings.ToLower(u.Email)), u.Initials, u.Password, u.Salt, "", u.LastVersion, u.Created, u.Revised) + _, err = ctx.Transaction.Exec(s.Bind("INSERT INTO dmz_user (c_refid, c_firstname, c_lastname, c_email, c_initials, c_password, c_salt, c_reset, c_lastversion, c_locale, c_created, c_revised) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"), + u.RefID, u.Firstname, u.Lastname, strings.TrimSpace(strings.ToLower(u.Email)), u.Initials, u.Password, u.Salt, "", u.LastVersion, u.Locale, u.Created, u.Revised) if err != nil { err = errors.Wrap(err, "execute user insert") @@ -53,7 +53,7 @@ func (s Store) Get(ctx domain.RequestContext, id string) (u user.User, err error err = s.Runtime.Db.Get(&u, s.Bind(` SELECT id, c_refid AS refid, c_firstname AS firstname, c_lastname AS lastname, c_email AS email, c_initials AS initials, c_globaladmin AS globaladmin, c_password AS password, c_salt AS salt, c_reset AS reset, - c_lastversion AS lastversion, c_created AS created, c_revised AS revised + c_lastversion AS lastversion, c_locale as locale, c_created AS created, c_revised AS revised FROM dmz_user WHERE c_refid=?`), id) @@ -72,7 +72,7 @@ func (s Store) GetByDomain(ctx domain.RequestContext, domain, email string) (u u err = s.Runtime.Db.Get(&u, s.Bind(`SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised FROM dmz_user u, dmz_user_account a, dmz_org o WHERE LOWER(u.c_email)=? AND u.c_refid=a.c_userid AND a.c_orgid=o.c_refid AND LOWER(o.c_domain)=?`), @@ -92,7 +92,7 @@ func (s Store) GetByEmail(ctx domain.RequestContext, email string) (u user.User, err = s.Runtime.Db.Get(&u, s.Bind(`SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised FROM dmz_user u WHERE LOWER(u.c_email)=?`), @@ -110,7 +110,7 @@ func (s Store) GetByToken(ctx domain.RequestContext, token string) (u user.User, err = s.Runtime.Db.Get(&u, s.Bind(`SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised FROM dmz_user u WHERE u.c_reset=?`), @@ -130,7 +130,7 @@ func (s Store) GetBySerial(ctx domain.RequestContext, serial string) (u user.Use err = s.Runtime.Db.Get(&u, s.Bind(`SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised FROM dmz_user u WHERE u.c_salt=?`), @@ -151,7 +151,7 @@ func (s Store) GetActiveUsersForOrganization(ctx domain.RequestContext) (u []use err = s.Runtime.Db.Select(&u, s.Bind(`SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised, a.c_active AS active, a.c_editor AS editor, a.c_admin AS admin, a.c_users AS viewusers, a.c_analytics AS analytics FROM dmz_user u, dmz_user_account a @@ -176,7 +176,7 @@ func (s Store) GetSpaceUsers(ctx domain.RequestContext, spaceID string) (u []use err = s.Runtime.Db.Select(&u, s.Bind(`SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised, a.c_active AS active, a.c_editor AS editor, a.c_admin AS admin, a.c_users AS viewusers, a.c_analytics AS analytics FROM dmz_user u, dmz_user_account a @@ -210,7 +210,7 @@ func (s Store) GetUsersForSpaces(ctx domain.RequestContext, spaces []string) (u SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised, a.c_active AS active, a.c_editor AS editor, a.c_admin AS admin, a.c_users AS viewusers, a.c_analytics AS analytics FROM dmz_user u, dmz_user_account a @@ -244,7 +244,7 @@ func (s Store) UpdateUser(ctx domain.RequestContext, u user.User) (err error) { u.Revised = time.Now().UTC() u.Email = strings.ToLower(u.Email) - _, err = ctx.Transaction.NamedExec("UPDATE dmz_user SET c_firstname=:firstname, c_lastname=:lastname, c_email=:email, c_revised=:revised, c_initials=:initials, c_lastversion=:lastversion WHERE c_refid=:refid", &u) + _, err = ctx.Transaction.NamedExec("UPDATE dmz_user SET c_firstname=:firstname, c_lastname=:lastname, c_email=:email, c_revised=:revised, c_initials=:initials, c_lastversion=:lastversion, c_locale=:locale WHERE c_refid=:refid", &u) if err != nil { err = errors.Wrap(err, fmt.Sprintf("execute user update %s", u.RefID)) } @@ -313,7 +313,7 @@ func (s Store) GetUsersForOrganization(ctx domain.RequestContext, filter string, err = s.Runtime.Db.Select(&u, s.Bind(`SELECT TOP(`+strconv.Itoa(limit)+`) u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised, a.c_active AS active, a.c_editor AS editor, a.c_admin AS admin, a.c_users AS viewusers, a.c_analytics AS analytics FROM dmz_user u, dmz_user_account a @@ -323,7 +323,7 @@ func (s Store) GetUsersForOrganization(ctx domain.RequestContext, filter string, err = s.Runtime.Db.Select(&u, s.Bind(`SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised, a.c_active AS active, a.c_editor AS editor, a.c_admin AS admin, a.c_users AS viewusers, a.c_analytics AS analytics FROM dmz_user u, dmz_user_account a @@ -357,7 +357,7 @@ func (s Store) MatchUsers(ctx domain.RequestContext, text string, maxMatches int err = s.Runtime.Db.Select(&u, s.Bind(`SELECT TOP(`+strconv.Itoa(maxMatches)+`) u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised, a.c_active AS active, a.c_editor AS editor, a.c_admin AS admin, a.c_users AS viewusers, a.c_analytics AS analytics FROM dmz_user u, dmz_user_account a @@ -367,7 +367,7 @@ func (s Store) MatchUsers(ctx domain.RequestContext, text string, maxMatches int err = s.Runtime.Db.Select(&u, s.Bind(`SELECT u.id, u.c_refid AS refid, u.c_firstname AS firstname, u.c_lastname AS lastname, u.c_email AS email, u.c_initials AS initials, u.c_globaladmin AS globaladmin, - u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, + u.c_password AS password, u.c_salt AS salt, u.c_reset AS reset, u.c_lastversion AS lastversion, u.c_locale as locale, u.c_created AS created, u.c_revised AS revised, a.c_active AS active, a.c_editor AS editor, a.c_admin AS admin, a.c_users AS viewusers, a.c_analytics AS analytics FROM dmz_user u, dmz_user_account a diff --git a/edition/community.go b/edition/community.go index c6ebba7d..7812bb5e 100644 --- a/edition/community.go +++ b/edition/community.go @@ -39,10 +39,10 @@ func main() { // Specify the product edition. rt.Product = domain.Product{} - rt.Product.Major = "4" - rt.Product.Minor = "2" - rt.Product.Patch = "3" - rt.Product.Revision = "220301191336" + rt.Product.Major = "5" + rt.Product.Minor = "0" + rt.Product.Patch = "0" + rt.Product.Revision = "220318131033" rt.Product.Version = fmt.Sprintf("%s.%s.%s", rt.Product.Major, rt.Product.Minor, rt.Product.Patch) rt.Product.Edition = domain.CommunityEdition rt.Product.Title = "Community" diff --git a/gui/app/components/customize/general-settings.js b/gui/app/components/customize/general-settings.js index 4cd85041..fcc0a5f5 100644 --- a/gui/app/components/customize/general-settings.js +++ b/gui/app/components/customize/general-settings.js @@ -30,12 +30,28 @@ export default Component.extend(Notifier, { hasTitleInputError: and('titleEmpty', 'titleError'), hasMessageInputError: and('messageEmpty', 'messageError'), hasConversionEndpointInputError: and('conversionEndpointEmpty', 'conversionEndpointError'), + locale: {}, + locales: null, + + init() { + this._super(...arguments); + + let l = this.get('appMeta.locales'); + let t = []; + + l.forEach((locale) => { + t.pushObject( {name: locale} ); + }); + + this.set('locales', t); + }, didReceiveAttrs() { this._super(...arguments); this.set('maxTags', this.get('model.general.maxTags')); this.set('domain', this.get('model.general.domain')); + this.set('locale', { name: this.get('model.general.locale') }); }, didInsertElement() { @@ -149,6 +165,10 @@ export default Component.extend(Notifier, { }, actions: { + onSelectLocale(locale) { + this.set('model.general.locale', locale.name); + }, + change() { const selectEl = $('#maxTags')[0]; const selection = selectEl.selectedOptions[0].value; diff --git a/gui/app/components/user/user-profile.js b/gui/app/components/user/user-profile.js index 91347f84..dda617c4 100644 --- a/gui/app/components/user/user-profile.js +++ b/gui/app/components/user/user-profile.js @@ -46,13 +46,34 @@ export default Component.extend(AuthProvider, { return ''; } }), + locale: {}, + locales: null, init() { this._super(...arguments); this.password = { password: "", confirmation: "" }; + + let l = this.get('appMeta.locales'); + let t = []; + + l.forEach((locale) => { + t.pushObject( {name: locale} ); + }); + + this.set('locales', t); + }, + + didReceiveAttrs() { + this._super(...arguments); + + this.set('locale', { name: this.get('model.locale') }); }, actions: { + onSelectLocale(locale) { + this.set('model.locale', locale.name); + }, + save() { let password = this.get('password.password'); let confirmation = this.get('password.confirmation'); diff --git a/gui/app/models/organization.js b/gui/app/models/organization.js index 77888908..e326d801 100644 --- a/gui/app/models/organization.js +++ b/gui/app/models/organization.js @@ -21,6 +21,7 @@ export default Model.extend({ allowAnonymousAccess: attr('boolean', { defaultValue: false }), maxTags: attr('number', {defaultValue: 3}), theme: attr('string'), + locale: attr('string', { defaultValue: "en-US" }), created: attr(), revised: attr() }); diff --git a/gui/app/pods/customize/general/controller.js b/gui/app/pods/customize/general/controller.js index 6c5f53fb..f2648e57 100644 --- a/gui/app/pods/customize/general/controller.js +++ b/gui/app/pods/customize/general/controller.js @@ -17,8 +17,7 @@ export default Controller.extend({ actions: { onUpdate() { - return this.get('orgService').save(this.model.general).then(() => { - }); + return this.get('orgService').save(this.model.general).then(() => {}); }, onDefaultLogo(orgId) { diff --git a/gui/app/pods/setup/route.js b/gui/app/pods/setup/route.js index adeb2fca..3d5db134 100644 --- a/gui/app/pods/setup/route.js +++ b/gui/app/pods/setup/route.js @@ -31,7 +31,7 @@ export default Route.extend({ dbname: document.head.querySelector("[property=dbname]").content, dbhash: pwd, title: "", - message: this.i18n.localize('setup_default_message'), + message: "Documize Community instance contains all our documentation", allowAnonymousAccess: false, firstname: "", lastname: "", diff --git a/gui/app/services/app-meta.js b/gui/app/services/app-meta.js index 9c11cea0..fb44b935 100644 --- a/gui/app/services/app-meta.js +++ b/gui/app/services/app-meta.js @@ -45,6 +45,7 @@ export default Service.extend({ // empty theme uses default theme theme: '', locale: '', + locales: null, getBaseUrl(endpoint) { return [this.get('endpoint'), endpoint].join('/'); diff --git a/gui/app/services/organization.js b/gui/app/services/organization.js index 80696f26..e9013f02 100644 --- a/gui/app/services/organization.js +++ b/gui/app/services/organization.js @@ -35,7 +35,8 @@ export default Service.extend({ message: org.get('message'), title: org.get('title'), maxTags: org.get('maxTags'), - conversionEndpoint: org.get('conversionEndpoint') + conversionEndpoint: org.get('conversionEndpoint'), + locale: org.get('locale') }); return this.get('ajax').request(`organization/${id}`, { diff --git a/gui/app/templates/components/customize/general-settings.hbs b/gui/app/templates/components/customize/general-settings.hbs index 304fff3a..6aa20c71 100644 --- a/gui/app/templates/components/customize/general-settings.hbs +++ b/gui/app/templates/components/customize/general-settings.hbs @@ -58,6 +58,10 @@ {{localize 'customize_tags_explain'}} +
+ + {{ui/ui-select content=locales selection=locale optionValuePath="name" optionLabelPath="name" action=(action "onSelectLocale")}} +
{{ui/ui-button color=constants.Color.Green light=true icon=constants.Icon.Settings label=(localize 'save') onClick=(action "save")}} diff --git a/gui/app/templates/components/document/document-toolbar.hbs b/gui/app/templates/components/document/document-toolbar.hbs index b8a63adf..fd153466 100644 --- a/gui/app/templates/components/document/document-toolbar.hbs +++ b/gui/app/templates/components/document/document-toolbar.hbs @@ -97,7 +97,7 @@