mirror of
https://github.com/documize/community.git
synced 2025-07-19 05:09:42 +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"
|
||||
|
||||
"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
|
||||
|
|
|
@ -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 = "<p>This is a test email from Documize using current SMTP settings.</p>"
|
||||
em.Subject = i18n.Localize(ctx.Locale, "server_smtp_test_subject")
|
||||
em.BodyHTML = "<p>" + i18n.Localize(ctx.Locale, "server_smtp_test_body") + "</p>"
|
||||
em.ToEmail = u.Email
|
||||
em.ToName = u.Fullname()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue