diff --git a/domain/meta/endpoint.go b/domain/meta/endpoint.go index 7ebb22da..5bf95157 100644 --- a/domain/meta/endpoint.go +++ b/domain/meta/endpoint.go @@ -21,6 +21,7 @@ import ( "text/template" "github.com/documize/community/core/env" + "github.com/documize/community/core/i18n" "github.com/documize/community/core/response" "github.com/documize/community/core/stringutil" "github.com/documize/community/domain" @@ -67,7 +68,10 @@ func (h *Handler) Meta(w http.ResponseWriter, r *http.Request) { data.ConversionEndpoint = org.ConversionEndpoint data.Storage = h.Runtime.StoreProvider.Type() data.Location = h.Runtime.Flags.Location // reserved - data.Locale = "en-US" + data.Locale = org.Locale + if len(data.Locale) == 0 { + data.Locale = i18n.DefaultLocale + } // Is product setup complete? SMTP in this case. data.Configured = true diff --git a/domain/setting/endpoint.go b/domain/setting/endpoint.go index 4148e173..969798cf 100644 --- a/domain/setting/endpoint.go +++ b/domain/setting/endpoint.go @@ -19,6 +19,7 @@ import ( "net/http" "github.com/documize/community/core/env" + "github.com/documize/community/core/i18n" "github.com/documize/community/core/request" "github.com/documize/community/core/response" "github.com/documize/community/core/streamutil" @@ -98,7 +99,7 @@ func (h *Handler) SetSMTP(w http.ResponseWriter, r *http.Request) { Message string `json:"message"` } - result.Message = "Email sent successfully!" + result.Message = i18n.Localize(ctx.Locale, "server_smtp_test") u, err := h.Store.User.Get(ctx, ctx.UserID) if err != nil { @@ -113,8 +114,8 @@ func (h *Handler) SetSMTP(w http.ResponseWriter, r *http.Request) { h.Runtime.Log.Infof("%v", cfg) dialer, err := smtp.Connect(cfg) em := smtp.EmailMessage{} - em.Subject = "Documize SMTP Test" - em.BodyHTML = "
This is a test email from Documize using current SMTP settings.
" + em.Subject = i18n.Localize(ctx.Locale, "server_smtp_test_subject") + em.BodyHTML = "" + i18n.Localize(ctx.Locale, "server_smtp_test_body") + "
" em.ToEmail = u.Email em.ToName = u.Fullname() diff --git a/domain/template/endpoint.go b/domain/template/endpoint.go index 892b832d..c8033c05 100644 --- a/domain/template/endpoint.go +++ b/domain/template/endpoint.go @@ -22,6 +22,7 @@ import ( "github.com/documize/community/core/env" "github.com/documize/community/core/event" + "github.com/documize/community/core/i18n" "github.com/documize/community/core/request" "github.com/documize/community/core/response" "github.com/documize/community/core/secrets" @@ -296,7 +297,7 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) { var d = doc.Document{} d.Name = docTitle d.Location = fmt.Sprintf("template-%s", templateID) - d.Excerpt = "Add detailed description for document..." + d.Excerpt = i18n.Localize(ctx.Locale, "description") d.Slug = stringutil.MakeSlug(d.Name) d.Tags = "" d.SpaceID = spaceID diff --git a/gui/public/i18n/en-US.json b/gui/public/i18n/en-US.json index 3603f951..f2de4d85 100644 --- a/gui/public/i18n/en-US.json +++ b/gui/public/i18n/en-US.json @@ -702,6 +702,10 @@ "server_keycloak_error3": "Error: unable to fetch Keycloak users: {1}", "server_keycloak_summary": "Keycloak sync found {1} users, {2} new users added, {3} users with missing data ignored", + "server_smtp_success": "Email sent successfully", + "server_smtp_test_subject": "Documize Community SMTP Test", + "server_smtp_test_body": "This is a test email from Documize Community using current SMTP settings.", + "server_error_user": "Error: unable to fetch users", "server_error_org": "Error: unable to get organization record" } diff --git a/model/org/org.go b/model/org/org.go index f7710cc9..872479f0 100644 --- a/model/org/org.go +++ b/model/org/org.go @@ -32,6 +32,7 @@ type Organization struct { Active bool `json:"active"` Subscription string `json:"subscription"` Theme string `json:"theme"` + Locale string `json:"locale"` } // StripSecrets removes sensitive information.