mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
i18n server-side strings
This commit is contained in:
parent
df534f72fa
commit
7255eb4f56
5 changed files with 16 additions and 5 deletions
|
@ -21,6 +21,7 @@ import (
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/documize/community/core/env"
|
"github.com/documize/community/core/env"
|
||||||
|
"github.com/documize/community/core/i18n"
|
||||||
"github.com/documize/community/core/response"
|
"github.com/documize/community/core/response"
|
||||||
"github.com/documize/community/core/stringutil"
|
"github.com/documize/community/core/stringutil"
|
||||||
"github.com/documize/community/domain"
|
"github.com/documize/community/domain"
|
||||||
|
@ -67,7 +68,10 @@ func (h *Handler) Meta(w http.ResponseWriter, r *http.Request) {
|
||||||
data.ConversionEndpoint = org.ConversionEndpoint
|
data.ConversionEndpoint = org.ConversionEndpoint
|
||||||
data.Storage = h.Runtime.StoreProvider.Type()
|
data.Storage = h.Runtime.StoreProvider.Type()
|
||||||
data.Location = h.Runtime.Flags.Location // reserved
|
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.
|
// Is product setup complete? SMTP in this case.
|
||||||
data.Configured = true
|
data.Configured = true
|
||||||
|
|
|
@ -19,6 +19,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/documize/community/core/env"
|
"github.com/documize/community/core/env"
|
||||||
|
"github.com/documize/community/core/i18n"
|
||||||
"github.com/documize/community/core/request"
|
"github.com/documize/community/core/request"
|
||||||
"github.com/documize/community/core/response"
|
"github.com/documize/community/core/response"
|
||||||
"github.com/documize/community/core/streamutil"
|
"github.com/documize/community/core/streamutil"
|
||||||
|
@ -98,7 +99,7 @@ func (h *Handler) SetSMTP(w http.ResponseWriter, r *http.Request) {
|
||||||
Message string `json:"message"`
|
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)
|
u, err := h.Store.User.Get(ctx, ctx.UserID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -113,8 +114,8 @@ func (h *Handler) SetSMTP(w http.ResponseWriter, r *http.Request) {
|
||||||
h.Runtime.Log.Infof("%v", cfg)
|
h.Runtime.Log.Infof("%v", cfg)
|
||||||
dialer, err := smtp.Connect(cfg)
|
dialer, err := smtp.Connect(cfg)
|
||||||
em := smtp.EmailMessage{}
|
em := smtp.EmailMessage{}
|
||||||
em.Subject = "Documize SMTP Test"
|
em.Subject = i18n.Localize(ctx.Locale, "server_smtp_test_subject")
|
||||||
em.BodyHTML = "<p>This is a test email from Documize using current SMTP settings.</p>"
|
em.BodyHTML = "<p>" + i18n.Localize(ctx.Locale, "server_smtp_test_body") + "</p>"
|
||||||
em.ToEmail = u.Email
|
em.ToEmail = u.Email
|
||||||
em.ToName = u.Fullname()
|
em.ToName = u.Fullname()
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import (
|
||||||
|
|
||||||
"github.com/documize/community/core/env"
|
"github.com/documize/community/core/env"
|
||||||
"github.com/documize/community/core/event"
|
"github.com/documize/community/core/event"
|
||||||
|
"github.com/documize/community/core/i18n"
|
||||||
"github.com/documize/community/core/request"
|
"github.com/documize/community/core/request"
|
||||||
"github.com/documize/community/core/response"
|
"github.com/documize/community/core/response"
|
||||||
"github.com/documize/community/core/secrets"
|
"github.com/documize/community/core/secrets"
|
||||||
|
@ -296,7 +297,7 @@ func (h *Handler) Use(w http.ResponseWriter, r *http.Request) {
|
||||||
var d = doc.Document{}
|
var d = doc.Document{}
|
||||||
d.Name = docTitle
|
d.Name = docTitle
|
||||||
d.Location = fmt.Sprintf("template-%s", templateID)
|
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.Slug = stringutil.MakeSlug(d.Name)
|
||||||
d.Tags = ""
|
d.Tags = ""
|
||||||
d.SpaceID = spaceID
|
d.SpaceID = spaceID
|
||||||
|
|
|
@ -702,6 +702,10 @@
|
||||||
"server_keycloak_error3": "Error: unable to fetch Keycloak users: {1}",
|
"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_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_user": "Error: unable to fetch users",
|
||||||
"server_error_org": "Error: unable to get organization record"
|
"server_error_org": "Error: unable to get organization record"
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ type Organization struct {
|
||||||
Active bool `json:"active"`
|
Active bool `json:"active"`
|
||||||
Subscription string `json:"subscription"`
|
Subscription string `json:"subscription"`
|
||||||
Theme string `json:"theme"`
|
Theme string `json:"theme"`
|
||||||
|
Locale string `json:"locale"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripSecrets removes sensitive information.
|
// StripSecrets removes sensitive information.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue