Open platform to collect and prioritize feedback
feature: translate all public pages to Portuguese and French (#978)
Guilherme Oenningc7a3f926d4c8
diff --git a/app/actions/invite.go b/app/actions/invite.goindex fbff682a4..a1645e318 100644--- a/app/actions/invite.go+++ b/app/actions/invite.go@@ -58,7 +58,7 @@ func (action *InviteUsers) Validate(ctx context.Context, user *entity.User) *valfor _, email := range action.Recipients {if email != "" {- messages := validate.Email(email)+ messages := validate.Email(ctx, email)result.AddFieldFailure("recipients", messages...)}}diff --git a/app/actions/messages.go b/app/actions/messages.gonew file mode 100644index 000000000..e63e12016--- /dev/null+++ b/app/actions/messages.go@@ -0,0 +1,26 @@+package actions++import (+ "context"+ "fmt"++ "github.com/getfider/fider/app/pkg/i18n"+)++func propertyIsRequired(ctx context.Context, fieldName string) string {+ displayName := i18n.T(ctx, fmt.Sprintf("property.%s", fieldName))+ return i18n.T(ctx, "validation.required", i18n.Params{"name": displayName})+}++func propertyIsInvalid(ctx context.Context, fieldName string) string {+ displayName := i18n.T(ctx, fmt.Sprintf("property.%s", fieldName))+ return i18n.T(ctx, "validation.invalid", i18n.Params{"name": displayName})+}++func propertyMaxStringLen(ctx context.Context, fieldName string, maxLen int) string {+ displayName := i18n.T(ctx, fmt.Sprintf("property.%s", fieldName))+ return i18n.T(ctx, "validation.maxstringlen",+ i18n.Params{"name": displayName},+ i18n.Params{"len": maxLen},+ )+}diff --git a/app/actions/oauth.go b/app/actions/oauth.goindex 49b3106aa..66cfa1ebb 100644--- a/app/actions/oauth.go+++ b/app/actions/oauth.go@@ -63,7 +63,7 @@ func (action *CreateEditOAuthConfig) Validate(ctx context.Context, user *entity.action.Provider = "_" + strings.ToLower(rand.String(10))}- messages, err := validate.ImageUpload(action.Logo, validate.ImageUploadOpts{+ messages, err := validate.ImageUpload(ctx, action.Logo, validate.ImageUploadOpts{IsRequired: false,MinHeight: 24,MinWidth: 24,@@ -106,18 +106,18 @@ func (action *CreateEditOAuthConfig) Validate(ctx context.Context, user *entity.if action.AuthorizeURL == "" {result.AddFieldFailure("authorizeURL", "Authorize URL is required.")- } else if messages := validate.URL(action.AuthorizeURL); len(messages) > 0 {+ } else if messages := validate.URL(ctx, action.AuthorizeURL); len(messages) > 0 {result.AddFieldFailure("authorizeURL", messages...)}if action.TokenURL == "" {result.AddFieldFailure("tokenURL", "Token URL is required.")- } else if messages := validate.URL(action.TokenURL); len(messages) > 0 {+ } else if messages := validate.URL(ctx, action.TokenURL); len(messages) > 0 {result.AddFieldFailure("tokenURL", messages...)}if action.ProfileURL != "" {- if messages := validate.URL(action.ProfileURL); len(messages) > 0 {+ if messages := validate.URL(ctx, action.ProfileURL); len(messages) > 0 {result.AddFieldFailure("profileURL", messages...)}}diff --git a/app/actions/post.go b/app/actions/post.goindex 35d13c84c..fa7ba65a7 100644--- a/app/actions/post.go+++ b/app/actions/post.go@@ -9,6 +9,7 @@ import ("github.com/getfider/fider/app/models/enum""github.com/getfider/fider/app/models/query""github.com/getfider/fider/app/pkg/bus"+ "github.com/getfider/fider/app/pkg/i18n""github.com/gosimple/slug""github.com/getfider/fider/app"@@ -33,21 +34,21 @@ func (action *CreateNewPost) Validate(ctx context.Context, user *entity.User) *vresult := validate.Success()if action.Title == "" {- result.AddFieldFailure("title", "Title is required.")+ result.AddFieldFailure("title", propertyIsRequired(ctx, "title"))} else if len(action.Title) < 10 {- result.AddFieldFailure("title", "Title needs to be more descriptive.")+ result.AddFieldFailure("title", i18n.T(ctx, "validation.custom.descriptivetitle"))} else if len(action.Title) > 100 {- result.AddFieldFailure("title", "Title must have less than 100 characters.")+ result.AddFieldFailure("title", propertyMaxStringLen(ctx, "title", 100))} else {err := bus.Dispatch(ctx, &query.GetPostBySlug{Slug: slug.Make(action.Title)})if err != nil && errors.Cause(err) != app.ErrNotFound {return validate.Error(err)} else if err == nil {- result.AddFieldFailure("title", "This has already been posted before.")+ result.AddFieldFailure("title", i18n.T(ctx, "validation.custom.duplicatetitle"))}}- messages, err := validate.MultiImageUpload(nil, action.Attachments, validate.MultiImageUploadOpts{+ messages, err := validate.MultiImageUpload(ctx, nil, action.Attachments, validate.MultiImageUploadOpts{MaxUploads: 3,MaxKilobytes: 5120,ExactRatio: false,@@ -96,13 +97,11 @@ func (action *UpdatePost) Validate(ctx context.Context, user *entity.User) *valiresult := validate.Success()if action.Title == "" {- result.AddFieldFailure("title", "Title is required.")+ result.AddFieldFailure("title", propertyIsRequired(ctx, "title"))} else if len(action.Title) < 10 {- result.AddFieldFailure("title", "Title needs to be more descriptive.")- }-- if len(action.Title) > 100 {- result.AddFieldFailure("title", "Title must have less than 100 characters.")+ result.AddFieldFailure("title", i18n.T(ctx, "validation.custom.descriptivetitle"))+ } else if len(action.Title) > 100 {+ result.AddFieldFailure("title", propertyMaxStringLen(ctx, "title", 100))}postBySlug := &query.GetPostBySlug{Slug: slug.Make(action.Title)}@@ -110,7 +109,7 @@ func (action *UpdatePost) Validate(ctx context.Context, user *entity.User) *valiif err != nil && errors.Cause(err) != app.ErrNotFound {return validate.Error(err)} else if err == nil && postBySlug.Result.ID != action.Post.ID {- result.AddFieldFailure("title", "This has already been posted before.")+ result.AddFieldFailure("title", i18n.T(ctx, "validation.custom.duplicatetitle"))}if len(action.Attachments) > 0 {@@ -120,7 +119,7 @@ func (action *UpdatePost) Validate(ctx context.Context, user *entity.User) *valireturn validate.Error(err)}- messages, err := validate.MultiImageUpload(getAttachments.Result, action.Attachments, validate.MultiImageUploadOpts{+ messages, err := validate.MultiImageUpload(ctx, getAttachments.Result, action.Attachments, validate.MultiImageUploadOpts{MaxUploads: 3,MaxKilobytes: 5120,ExactRatio: false,@@ -151,10 +150,10 @@ func (action *AddNewComment) Validate(ctx context.Context, user *entity.User) *vresult := validate.Success()if action.Content == "" {- result.AddFieldFailure("content", "Comment is required.")+ result.AddFieldFailure("content", propertyIsRequired(ctx, "comment"))}- messages, err := validate.MultiImageUpload(nil, action.Attachments, validate.MultiImageUploadOpts{+ messages, err := validate.MultiImageUpload(ctx, nil, action.Attachments, validate.MultiImageUploadOpts{MaxUploads: 2,MaxKilobytes: 5120,ExactRatio: false,@@ -187,19 +186,19 @@ func (action *SetResponse) Validate(ctx context.Context, user *entity.User) *valresult := validate.Success()if action.Status < enum.PostOpen || action.Status > enum.PostDuplicate {- result.AddFieldFailure("status", "Status is invalid.")+ result.AddFieldFailure("status", propertyIsInvalid(ctx, "status"))}if action.Status == enum.PostDuplicate {if action.OriginalNumber == action.Number {- result.AddFieldFailure("originalNumber", "Cannot be a duplicate of itself")+ result.AddFieldFailure("originalNumber", i18n.T(ctx, "validation.custom.selfduplicate"))}getOriginaPost := &query.GetPostByNumber{Number: action.OriginalNumber}err := bus.Dispatch(ctx, getOriginaPost)if err != nil {if errors.Cause(err) == app.ErrNotFound {- result.AddFieldFailure("originalNumber", "Original post not found")+ result.AddFieldFailure("originalNumber", i18n.T(ctx, "validation.custom.originalpostnotfound"))} else {return validate.Error(err)}@@ -241,7 +240,7 @@ func (action *DeletePost) Validate(ctx context.Context, user *entity.User) *vali}if isReferencedQuery.Result {- return validate.Failed("This post cannot be deleted because it's being referenced by a duplicated post.")+ return validate.Failed(i18n.T(ctx, "validation.custom.cannotdeleteduplicatepost"))}return validate.Success()@@ -276,7 +275,7 @@ func (action *EditComment) Validate(ctx context.Context, user *entity.User) *valresult := validate.Success()if action.Content == "" {- result.AddFieldFailure("content", "Comment is required.")+ result.AddFieldFailure("content", propertyIsRequired(ctx, "comment"))}if len(action.Attachments) > 0 {@@ -286,7 +285,7 @@ func (action *EditComment) Validate(ctx context.Context, user *entity.User) *valreturn validate.Error(err)}- messages, err := validate.MultiImageUpload(getAttachments.Result, action.Attachments, validate.MultiImageUploadOpts{+ messages, err := validate.MultiImageUpload(ctx, getAttachments.Result, action.Attachments, validate.MultiImageUploadOpts{MaxUploads: 2,MaxKilobytes: 5120,ExactRatio: false,diff --git a/app/actions/settings.go b/app/actions/settings.goindex 490ee3887..936e07685 100644--- a/app/actions/settings.go+++ b/app/actions/settings.go@@ -2,7 +2,6 @@ package actionsimport ("context"- "fmt""github.com/getfider/fider/app/models/dto""github.com/getfider/fider/app/models/entity"@@ -35,19 +34,19 @@ func (action *UpdateUserSettings) Validate(ctx context.Context, user *entity.Useresult := validate.Success()if action.Name == "" {- result.AddFieldFailure("name", "Name is required.")+ result.AddFieldFailure("name", propertyIsRequired(ctx, "name"))}if action.AvatarType < 1 || action.AvatarType > 3 {- result.AddFieldFailure("avatarType", "Invalid avatar type.")+ result.AddFieldFailure("avatarType", propertyIsInvalid(ctx, "avatarType"))}if len(action.Name) > 50 {- result.AddFieldFailure("name", "Name must have less than 50 characters.")+ result.AddFieldFailure("name", propertyMaxStringLen(ctx, "name", 50))}action.Avatar.BlobKey = user.AvatarBlobKey- messages, err := validate.ImageUpload(action.Avatar, validate.ImageUploadOpts{+ messages, err := validate.ImageUpload(ctx, action.Avatar, validate.ImageUploadOpts{IsRequired: action.AvatarType == enum.AvatarTypeCustom,MinHeight: 50,MinWidth: 50,@@ -66,12 +65,12 @@ func (action *UpdateUserSettings) Validate(ctx context.Context, user *entity.Useif e.UserSettingsKeyName == k {ok = trueif !e.Validate(v) {- result.AddFieldFailure("settings", fmt.Sprintf("Settings %s has an invalid value %s.", k, v))+ result.AddFieldFailure("settings", i18n.T(ctx, "validation.invalidvalue", i18n.Params{"name": k}, i18n.Params{"value": v}))}}}if !ok {- result.AddFieldFailure("settings", i18n.T(ctx, "validation.settings.unknown", i18n.Params{"name": k}))+ result.AddFieldFailure("settings", i18n.T(ctx, "validation.custom.unknownsettings", i18n.Params{"name": k}))}}}diff --git a/app/actions/signin.go b/app/actions/signin.goindex 07a132586..0c99d52eb 100644--- a/app/actions/signin.go+++ b/app/actions/signin.go@@ -32,15 +32,11 @@ func (action *SignInByEmail) Validate(ctx context.Context, user *entity.User) *vresult := validate.Success()if action.Email == "" {- result.AddFieldFailure("email", "Email is required.")+ result.AddFieldFailure("email", propertyIsRequired(ctx, "email"))return result}- if len(action.Email) > 200 {- result.AddFieldFailure("email", "Email must have less than 200 characters.")- }-- messages := validate.Email(action.Email)+ messages := validate.Email(ctx, action.Email)result.AddFieldFailure("email", messages...)return result@@ -83,15 +79,13 @@ func (action *CompleteProfile) Validate(ctx context.Context, user *entity.User)result := validate.Success()if action.Name == "" {- result.AddFieldFailure("name", "Name is required.")- }-- if len(action.Name) > 50 {- result.AddFieldFailure("name", "Name must have less than 50 characters.")+ result.AddFieldFailure("name", propertyIsRequired(ctx, "name"))+ } else if len(action.Name) > 50 {+ result.AddFieldFailure("name", propertyMaxStringLen(ctx, "name", 50))}if action.Key == "" {- result.AddFieldFailure("key", "Key is required.")+ result.AddFieldFailure("key", propertyIsRequired(ctx, "key"))} else {findBySignIn := &query.GetVerificationByKey{Kind: enum.EmailVerificationKindSignIn, Key: action.Key}err1 := bus.Dispatch(ctx, findBySignIn)@@ -104,7 +98,7 @@ func (action *CompleteProfile) Validate(ctx context.Context, user *entity.User)} else if err2 == nil {action.Email = findByUserInvitation.Result.Email} else {- result.AddFieldFailure("key", "Key is invalid.")+ result.AddFieldFailure("key", propertyIsInvalid(ctx, "key"))}}diff --git a/app/actions/tenant.go b/app/actions/tenant.goindex 690271a7c..bc3906ca2 100644--- a/app/actions/tenant.go+++ b/app/actions/tenant.go@@ -53,7 +53,7 @@ func (action *CreateTenant) Validate(ctx context.Context, user *entity.User) *vaif action.Email == "" {result.AddFieldFailure("email", "Email is required.")} else {- messages := validate.Email(action.Email)+ messages := validate.Email(ctx, action.Email)result.AddFieldFailure("email", messages...)}@@ -113,7 +113,7 @@ type UpdateTenantSettings struct {Title string `json:"title"`Invitation string `json:"invitation"`WelcomeMessage string `json:"welcomeMessage"`- Locale string `json:"locale"`+ Locale string `json:"locale"`CNAME string `json:"cname" format:"lower"`}@@ -137,7 +137,7 @@ func (action *UpdateTenantSettings) Validate(ctx context.Context, user *entity.Uaction.Logo.BlobKey = tenant.LogoBlobKey}- messages, err := validate.ImageUpload(action.Logo, validate.ImageUploadOpts{+ messages, err := validate.ImageUpload(ctx, action.Logo, validate.ImageUploadOpts{IsRequired: false,MinHeight: 200,MinWidth: 200,diff --git a/app/actions/user.go b/app/actions/user.goindex 321098477..0d611f3bc 100644--- a/app/actions/user.go+++ b/app/actions/user.go@@ -9,6 +9,7 @@ import ("github.com/getfider/fider/app/models/query""github.com/getfider/fider/app/pkg/bus""github.com/getfider/fider/app/pkg/errors"+ "github.com/getfider/fider/app/pkg/i18n""github.com/getfider/fider/app/pkg/validate")@@ -38,7 +39,7 @@ func (action *CreateUser) Validate(ctx context.Context, user *entity.User) *valiresult.AddFieldFailure("", "Either email or reference is required")} else {if action.Email != "" {- messages := validate.Email(action.Email)+ messages := validate.Email(ctx, action.Email)if len(messages) > 0 {result.AddFieldFailure("email", messages...)}@@ -114,21 +115,16 @@ func (action *ChangeUserEmail) Validate(ctx context.Context, user *entity.User)result := validate.Success()if action.Email == "" {- result.AddFieldFailure("email", "Email is required.")- return result- }-- if len(action.Email) > 200 {- result.AddFieldFailure("email", "Email must have less than 200 characters.")+ result.AddFieldFailure("email", propertyIsRequired(ctx, "email"))return result}if user.Email == action.Email {- result.AddFieldFailure("email", "Choose a different email.")+ result.AddFieldFailure("email", i18n.T(ctx, "validation.custom.differentemail"))return result}- messages := validate.Email(action.Email)+ messages := validate.Email(ctx, action.Email)if len(messages) > 0 {result.AddFieldFailure("email", messages...)return result@@ -140,7 +136,7 @@ func (action *ChangeUserEmail) Validate(ctx context.Context, user *entity.User)return validate.Error(err)}if err == nil && userByEmail.Result.ID != user.ID {- result.AddFieldFailure("email", "This email is already in use by someone else")+ result.AddFieldFailure("email", i18n.T(ctx, "validation.custom.emailtaken"))return result}action.Requestor = userdiff --git a/app/cmd/routes.go b/app/cmd/routes.goindex eb8b3593c..62353cf15 100644--- a/app/cmd/routes.go+++ b/app/cmd/routes.go@@ -133,9 +133,13 @@ func routes(r *web.Engine) *web.Engine {ui.Post("/_api/notifications/read-all", handlers.ReadAllNotifications())ui.Get("/_api/notifications/unread/total", handlers.TotalUnreadNotifications())- //From this step, only Collaborators and Administrators are allowed+ // From this step, only Collaborators and Administrators are allowedui.Use(middlewares.IsAuthorized(enum.RoleCollaborator, enum.RoleAdministrator))+ // locale is forced to English for administrative pages.+ // This is meant to be removed when all pages are translated.+ ui.Use(middlewares.SetLocale("en"))+ui.Get("/admin", handlers.GeneralSettingsPage())ui.Get("/admin/advanced", handlers.AdvancedSettingsPage())ui.Get("/admin/privacy", handlers.Page("Privacy · Site Settings", "", "PrivacySettings.page"))@@ -184,6 +188,10 @@ func routes(r *web.Engine) *web.Engine {//From this step, only Collaborators and Administrators are allowedapi.Use(middlewares.IsAuthorized(enum.RoleCollaborator, enum.RoleAdministrator))+ // locale is forced to English for administrative API.+ // This is meant to be removed when all API are translated.+ ui.Use(middlewares.SetLocale("en"))+api.Get("/api/v1/users", apiv1.ListUsers())api.Get("/api/v1/posts/:number/votes", apiv1.ListVotes())api.Post("/api/v1/invitations/send", apiv1.SendInvites())diff --git a/app/handlers/apiv1/invite.go b/app/handlers/apiv1/invite.goindex 4d92bf84d..5ce9374c0 100644--- a/app/handlers/apiv1/invite.go+++ b/app/handlers/apiv1/invite.go@@ -52,7 +52,7 @@ func SendInvites() web.HandlerFunc {}log.Warnf(c, "@{Tenant:magenta} sent @{TotalInvites:magenta} invites", dto.Props{- "Tenant": c.Tenant().Subdomain,+ "Tenant": c.Tenant().Subdomain,"TotalInvites": len(action.Invitations),})c.Enqueue(tasks.SendInvites(action.Subject, action.Message, action.Invitations))diff --git a/app/middlewares/locale.go b/app/middlewares/locale.gonew file mode 100644index 000000000..901d6b99b--- /dev/null+++ b/app/middlewares/locale.go@@ -0,0 +1,16 @@+package middlewares++import (+ "github.com/getfider/fider/app"+ "github.com/getfider/fider/app/pkg/web"+)++// SetLocale defines given locale in context for all subsequent operations+func SetLocale(locale string) web.MiddlewareFunc {+ return func(next web.HandlerFunc) web.HandlerFunc {+ return func(c *web.Context) error {+ c.Set(app.LocaleCtxKey, locale)+ return next(c)+ }+ }+}diff --git a/app/pkg/i18n/i18n.go b/app/pkg/i18n/i18n.goindex 39d9a6291..3a60f1cff 100644--- a/app/pkg/i18n/i18n.go+++ b/app/pkg/i18n/i18n.go@@ -17,6 +17,7 @@ import (var localeToPlurals = map[string]string{"en": "en","pt-BR": "pt",+ "fr": "fr",}type Params map[string]interface{}diff --git a/app/pkg/i18n/i18n_test.go b/app/pkg/i18n/i18n_test.goindex a115cc358..f2a720b27 100644--- a/app/pkg/i18n/i18n_test.go+++ b/app/pkg/i18n/i18n_test.go@@ -32,16 +32,16 @@ func TestValidMessage(t *testing.T) {func TestEnglish_ValidMessage_WithParams(t *testing.T) {RegisterT(t)- key := "validation.settings.unknown"+ key := "email.greetings_name"- translated := i18n.T(emptyContext, key, i18n.Params{"name": "Notification"})- Expect(translated).Equals("Unknown settings named 'Notification'")+ translated := i18n.T(emptyContext, key, i18n.Params{"name": "Jon"})+ Expect(translated).Equals("Hello, Jon!")- translated = i18n.T(enContext, key, i18n.Params{"name": "Notification"})- Expect(translated).Equals("Unknown settings named 'Notification'")+ translated = i18n.T(enContext, key, i18n.Params{"name": "Jon"})+ Expect(translated).Equals("Hello, Jon!")- translated = i18n.T(ptBRContext, key, i18n.Params{"name": "Notification"})- Expect(translated).Equals("Configuração 'Notification' é desconhecida")+ translated = i18n.T(ptBRContext, key, i18n.Params{"name": "Jon"})+ Expect(translated).Equals("Olá, Jon!")}func TestEnglish_InvalidMessage(t *testing.T) {diff --git a/app/pkg/validate/general.go b/app/pkg/validate/general.goindex ed73963e2..0843c49ed 100644--- a/app/pkg/validate/general.go+++ b/app/pkg/validate/general.go@@ -2,13 +2,13 @@ package validateimport ("context"- "fmt""net/url""regexp""strings""github.com/getfider/fider/app/models/query""github.com/getfider/fider/app/pkg/bus"+ "github.com/getfider/fider/app/pkg/i18n""github.com/getfider/fider/app/pkg/env")@@ -17,29 +17,39 @@ var emailRegex = regexp.MustCompile("^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?var hostnameRegex = regexp.MustCompile(`^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$`)//Email validates given email address-func Email(email string) []string {+func Email(ctx context.Context, email string) []string {email = strings.ToLower(email)if len(email) > 200 {- return []string{"Email address must have less than 200 characters."}+ return []string{i18n.T(ctx, "validation.maxstringlen",+ i18n.Params{"name": i18n.T(ctx, "property.email")},+ i18n.Params{"len": 200},+ )}}if !emailRegex.MatchString(email) {- return []string{fmt.Sprintf("'%s' is not a valid email address.", email)}+ return []string{i18n.T(ctx, "validation.custom.invalidemail",+ i18n.Params{"email": email},+ )}}return []string{}}//URL validates given URL-func URL(rawurl string) []string {+func URL(ctx context.Context, rawurl string) []string {if len(rawurl) > 300 {- return []string{"URL address must have less than 300 characters."}+ return []string{i18n.T(ctx, "validation.maxstringlen",+ i18n.Params{"name": "URL"},+ i18n.Params{"len": 300},+ )}}_, err := url.ParseRequestURI(rawurl)if err != nil {- return []string{fmt.Sprintf("'%s' is not a valid URL address.", rawurl)}+ return []string{i18n.T(ctx, "validation.custom.invalidurl",+ i18n.Params{"url": rawurl},+ )}}return []string{}@@ -52,22 +62,29 @@ func CNAME(ctx context.Context, cname string) []string {if !env.IsSingleHostMode() {domain := env.MultiTenantDomain()if strings.HasSuffix(cname, domain) || cname == domain[1:] {- return []string{fmt.Sprintf("'%s' is not a valid custom domain.", cname)}+ return []string{i18n.T(ctx, "validation.custom.invalidcustomdomain",+ i18n.Params{"domain": cname},+ )}}}if len(cname) > 100 {- return []string{"Custom domain name must have less than 100 characters."}+ return []string{i18n.T(ctx, "validation.maxstringlen",+ i18n.Params{"name": i18n.T(ctx, "property.customdomain")},+ i18n.Params{"len": 100},+ )}}if !hostnameRegex.MatchString(cname) || !strings.Contains(cname, ".") {- return []string{fmt.Sprintf("'%s' is not a valid custom domain.", cname)}+ return []string{i18n.T(ctx, "validation.custom.invalidcustomdomain",+ i18n.Params{"domain": cname},+ )}}isAvailable := &query.IsCNAMEAvailable{CNAME: cname}bus.MustDispatch(ctx, isAvailable)if !isAvailable.Result {- return []string{"This custom domain is already in use by someone else."}+ return []string{i18n.T(ctx, "validation.custom.customdomaintaken")}}return []string{}diff --git a/app/pkg/validate/general_test.go b/app/pkg/validate/general_test.goindex 09c71fac3..67291e51a 100644--- a/app/pkg/validate/general_test.go+++ b/app/pkg/validate/general_test.go@@ -26,7 +26,7 @@ func TestInvalidEmail(t *testing.T) {"my@[email protected]",rand.String(200) + "@gmail.com",} {- messages := validate.Email(email)+ messages := validate.Email(context.Background(), email)Expect(len(messages) > 0).IsTrue()}}@@ -39,7 +39,7 @@ func TestValidEmail(t *testing.T) {} {- messages := validate.Email(email)+ messages := validate.Email(context.Background(), email)Expect(messages).HasLen(0)}}@@ -54,7 +54,7 @@ func TestInvalidURL(t *testing.T) {rand.String(301),"my@company",} {- messages := validate.URL(rawurl)+ messages := validate.URL(context.Background(), rawurl)Expect(len(messages) > 0).IsTrue()}}@@ -67,7 +67,7 @@ func TestValidURL(t *testing.T) {"https://example.org/oauth","https://example.org/oauth?test=abc",} {- messages := validate.URL(rawurl)+ messages := validate.URL(context.Background(), rawurl)Expect(messages).HasLen(0)}}diff --git a/app/pkg/validate/upload.go b/app/pkg/validate/upload.goindex 361744c1a..7038b8b29 100644--- a/app/pkg/validate/upload.go+++ b/app/pkg/validate/upload.go@@ -1,9 +1,10 @@package validateimport (- "fmt"+ "context""github.com/getfider/fider/app/models/dto"+ "github.com/getfider/fider/app/pkg/i18n""github.com/goenning/imagic")@@ -30,7 +31,7 @@ type ImageUploadOpts struct {}//MultiImageUpload validates multiple image uploads-func MultiImageUpload(currentAttachments []string, uploads []*dto.ImageUpload, opts MultiImageUploadOpts) ([]string, error) {+func MultiImageUpload(ctx context.Context, currentAttachments []string, uploads []*dto.ImageUpload, opts MultiImageUploadOpts) ([]string, error) {if currentAttachments == nil {currentAttachments = []string{}}@@ -48,7 +49,7 @@ func MultiImageUpload(currentAttachments []string, uploads []*dto.ImageUpload, ototalCount++}- messages, err := ImageUpload(upload, ImageUploadOpts{+ messages, err := ImageUpload(ctx, upload, ImageUploadOpts{IsRequired: opts.IsRequired,MinWidth: opts.MinWidth,MinHeight: opts.MinHeight,@@ -64,19 +65,21 @@ func MultiImageUpload(currentAttachments []string, uploads []*dto.ImageUpload, o}if totalCount > opts.MaxUploads {- return []string{fmt.Sprintf("A maximum of %d attachments are allowed per post.", opts.MaxUploads)}, nil+ return []string{i18n.T(ctx, "validation.custom.maxattachments", i18n.Params{"number": opts.MaxUploads})}, nil}return []string{}, nil}//ImageUpload validates given image upload-func ImageUpload(upload *dto.ImageUpload, opts ImageUploadOpts) ([]string, error) {+func ImageUpload(ctx context.Context, upload *dto.ImageUpload, opts ImageUploadOpts) ([]string, error) {messages := []string{}if opts.IsRequired {if upload == nil || (upload.BlobKey == "" && upload.Upload == nil) || upload.Remove {- messages = append(messages, "An image is required.")+ messages = append(messages, i18n.T(ctx, "validation.required",+ i18n.Params{"name": i18n.T(ctx, "property.image")},+ ))}}@@ -84,22 +87,27 @@ func ImageUpload(upload *dto.ImageUpload, opts ImageUploadOpts) ([]string, errorlogo, err := imagic.Parse(upload.Upload.Content)if err != nil {if err == imagic.ErrNotSupported {- messages = append(messages, "This file format not supported.")+ messages = append(messages, i18n.T(ctx, "validation.custom.unsupportedfileformat"))} else {return nil, err}} else {if logo.Width < opts.MinWidth || logo.Height < opts.MinHeight {- messages = append(messages, fmt.Sprintf("The image must have minimum dimensions of %dx%d pixels.", opts.MinWidth, opts.MinHeight))+ messages = append(messages, i18n.T(ctx, "validation.custom.minimagedimensions",+ i18n.Params{"width": opts.MinWidth},+ i18n.Params{"height": opts.MinHeight},+ ))}if opts.ExactRatio && logo.Width != logo.Height {- messages = append(messages, "The image must have an aspect ratio of 1:1.")+ messages = append(messages, i18n.T(ctx, "validation.custom.imagesquareratio"))}if logo.Size > (opts.MaxKilobytes * 1024) {- messages = append(messages, fmt.Sprintf("The image size must be smaller than %dKB.", opts.MaxKilobytes))+ messages = append(messages, i18n.T(ctx, "validation.custom.maximagesize",+ i18n.Params{"kilobytes": opts.MaxKilobytes},+ ))}if logo.Height > MaxDimensionSize && logo.Width > MaxDimensionSize {diff --git a/app/pkg/validate/upload_test.go b/app/pkg/validate/upload_test.goindex 58b8bf682..9f3f24ad3 100644--- a/app/pkg/validate/upload_test.go+++ b/app/pkg/validate/upload_test.go@@ -1,6 +1,7 @@package validate_testimport (+ "context""io/ioutil""testing"@@ -34,7 +35,7 @@ func TestValidateImageUpload(t *testing.T) {Content: img,},}- messages, err := validate.ImageUpload(upload, validate.ImageUploadOpts{+ messages, err := validate.ImageUpload(context.Background(), upload, validate.ImageUploadOpts{MinHeight: 200,MinWidth: 200,MaxKilobytes: 100,@@ -60,12 +61,12 @@ func TestValidateImageUpload_ExactRatio(t *testing.T) {},}opts.ExactRatio = true- messages, err := validate.ImageUpload(upload, opts)+ messages, err := validate.ImageUpload(context.Background(), upload, opts)Expect(messages).HasLen(1)Expect(err).IsNil()opts.ExactRatio = false- messages, err = validate.ImageUpload(upload, opts)+ messages, err = validate.ImageUpload(context.Background(), upload, opts)Expect(messages).HasLen(0)Expect(err).IsNil()}@@ -73,7 +74,7 @@ func TestValidateImageUpload_ExactRatio(t *testing.T) {func TestValidateImageUpload_Nil(t *testing.T) {RegisterT(t)- messages, err := validate.ImageUpload(nil, validate.ImageUploadOpts{+ messages, err := validate.ImageUpload(context.Background(), nil, validate.ImageUploadOpts{IsRequired: false,MinHeight: 200,MinWidth: 200,@@ -83,7 +84,7 @@ func TestValidateImageUpload_Nil(t *testing.T) {Expect(messages).HasLen(0)Expect(err).IsNil()- messages, err = validate.ImageUpload(&dto.ImageUpload{}, validate.ImageUploadOpts{+ messages, err = validate.ImageUpload(context.Background(), &dto.ImageUpload{}, validate.ImageUploadOpts{IsRequired: false,MinHeight: 200,MinWidth: 200,@@ -110,7 +111,7 @@ func TestValidateImageUpload_Required(t *testing.T) {}for _, testCase := range testCases {- messages, err := validate.ImageUpload(testCase.upload, validate.ImageUploadOpts{+ messages, err := validate.ImageUpload(context.Background(), testCase.upload, validate.ImageUploadOpts{IsRequired: true,MinHeight: 200,MinWidth: 200,@@ -145,7 +146,7 @@ func TestValidateMultiImageUpload(t *testing.T) {},}- messages, err := validate.MultiImageUpload(nil, uploads, validate.MultiImageUploadOpts{+ messages, err := validate.MultiImageUpload(context.Background(), nil, uploads, validate.MultiImageUploadOpts{MaxUploads: 2,MaxKilobytes: 500,})@@ -180,7 +181,7 @@ func TestValidateMultiImageUpload_Existing(t *testing.T) {}currentAttachments := []string{"attachments/file1.png", "attachments/file2.png"}- messages, err := validate.MultiImageUpload(currentAttachments, uploads, validate.MultiImageUploadOpts{+ messages, err := validate.MultiImageUpload(context.Background(), currentAttachments, uploads, validate.MultiImageUploadOpts{MaxUploads: 2,MaxKilobytes: 500,})diff --git a/app/pkg/web/react_test.go b/app/pkg/web/react_test.goindex 3c28af69d..4cbf2e5ad 100644--- a/app/pkg/web/react_test.go+++ b/app/pkg/web/react_test.go@@ -80,7 +80,7 @@ func TestReactRenderer_RenderEmptyHomeHTML_Portuguese(t *testing.T) {})Expect(html).ContainsSubstring(`<div class="c-dev-banner">DEV</div>`)Expect(html).ContainsSubstring(`<input type="text" class="c-input" id="input-title"`)- Expect(html).ContainsSubstring(`What can we do better? This is the place for you to vote, discuss and share ideas.`)+ Expect(html).ContainsSubstring(`O que podemos fazer melhor? Este é o lugar para você votar, discutir e compartilhar ideias.`)Expect(html).ContainsSubstring(`Nenhuma postagem foi criada ainda.`)Expect(html).ContainsSubstring(`Powered by Fider`)Expect(err).IsNil()diff --git a/app/pkg/web/renderer_test.go b/app/pkg/web/renderer_test.goindex 99df7a030..dc5098aa1 100644--- a/app/pkg/web/renderer_test.go+++ b/app/pkg/web/renderer_test.go@@ -127,7 +127,7 @@ func TestRenderer_Home_SSR(t *testing.T) {renderer.Render(buf, http.StatusOK, "index.html", web.Props{Title: "My Page Title",Description: "My Page Description",- ChunkName: "Test.page",+ ChunkName: "Test.page",Data: web.Map{"posts": make([]web.Map, 0),"tags": make([]web.Map, 0),diff --git a/app/pkg/web/testdata/home_ssr.html b/app/pkg/web/testdata/home_ssr.htmlindex af4dde071..8f7c8a60e 100755--- a/app/pkg/web/testdata/home_ssr.html+++ b/app/pkg/web/testdata/home_ssr.html@@ -35,7 +35,7 @@-<div id="root"><div class="c-dev-banner">DEV</div><div id="c-header"><div class="c-menu shadow p-2 w-full flex flex flex-x flex--spacing-1 flex-items-center"><div class="container"><div class="flex flex flex-x flex--spacing-1 flex-items-center justify-between"><a href="/" class="flex flex-x flex-items-center flex--spacing-2 h-8"><h1 class="text-title"></h1></a><a href="#" class="uppercase text-sm">Sign in</a></div></div></div></div><div id="p-home" class="page container"><div class="p-home__welcome-col"><div class="flex flex flex-y flex--spacing-2"><div class="c-markdown "><p>We'd love to hear what you're thinking about. </p>+<div id="root"><div class="c-dev-banner">DEV</div><div id="c-header"><div class="c-menu shadow p-2 w-full flex flex flex-x flex--spacing-1 flex-items-center"><div class="container"><div class="flex flex flex-x flex--spacing-1 flex-items-center justify-between"><a href="/" class="flex flex-x flex-items-center flex--spacing-2 h-8"><h1 class="text-title"></h1></a><a href="#" class="uppercase text-sm">Sign in</a></div></div></div></div><div id="p-home" class="page container"><div class="p-home__welcome-col"><div class="flex flex flex-y flex--spacing-2"><div class="c-markdown "><p>We'd love to hear what you're thinking about.</p><p>What can we do better? This is the place for you to vote, discuss and share ideas.</p></div><form autoComplete="off" class="c-form"><div class="c-form-field"><div class="relative flex flex flex-x"><input type="text" class="c-input" id="input-title" tabindex="-1" maxLength="100" value="" placeholder="Enter your suggestion here..."/></div></div></form><div class="c-powered sm:hidden md:hidden lg:block"><a rel="noopener" href="https://getfider.com" target="_blank">Powered by Fider</a></div></div></div><div class="p-home__posts-col"><div class="text-center"><img style="height:120px" height="120" class="mt-6 mb-2" src="data:image/svg+xml;base64,PHN2ZyBpZD0iYjIxNjEzYzktMmJmMC00ZDM3LWJlZjAtM2IxOTNkMzRmYzVkIiBkYXRhLW5hbWU9IkxheWVyIDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjY0Ny42MzYyNiIgaGVpZ2h0PSI2MzIuMTczODMiIHZpZXdCb3g9IjAgMCA2NDcuNjM2MjYgNjMyLjE3MzgzIj48cGF0aCBkPSJNNjg3LjMyNzksMjc2LjA4NjkxSDUxMi44MTgxM2ExNS4wMTgyOCwxNS4wMTgyOCwwLDAsMC0xNSwxNXYzODcuODVsLTIsLjYxMDA1LTQyLjgxMDA2LDEzLjExYTguMDA2NzYsOC4wMDY3NiwwLDAsMS05Ljk4OTc0LTUuMzFMMzE1LjY3OCwyNzEuMzk2OTFhOC4wMDMxMyw4LjAwMzEzLDAsMCwxLDUuMzEwMDYtOS45OWw2NS45NzAyMi0yMC4yLDE5MS4yNS01OC41NCw2NS45Njk3Mi0yMC4yYTcuOTg5MjcsNy45ODkyNywwLDAsMSw5Ljk5MDI0LDUuM2wzMi41NDk4LDEwNi4zMloiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNzYuMTgxODcgLTEzMy45MTMwOSkiIGZpbGw9IiNmMmYyZjIiLz48cGF0aCBkPSJNNzI1LjQwOCwyNzQuMDg2OTFsLTM5LjIzLTEyOC4xNGExNi45OTM2OCwxNi45OTM2OCwwLDAsMC0yMS4yMy0xMS4yOGwtOTIuNzUsMjguMzlMMzgwLjk1ODI3LDIyMS42MDY5M2wtOTIuNzUsMjguNGExNy4wMTUyLDE3LjAxNTIsMCwwLDAtMTEuMjgwMjgsMjEuMjNsMTM0LjA4MDA4LDQzNy45M2ExNy4wMjY2MSwxNy4wMjY2MSwwLDAsMCwxNi4yNjAyNiwxMi4wMywxNi43ODkyNiwxNi43ODkyNiwwLDAsMCw0Ljk2OTcyLS43NWw2My41ODAwOC0xOS40NiwyLS42MnYtMi4wOWwtMiwuNjEtNjQuMTY5OTIsMTkuNjVhMTUuMDE0ODksMTUuMDE0ODksMCwwLDEtMTguNzMtOS45NWwtMTM0LjA2OTgzLTQzNy45NGExNC45NzkzNSwxNC45NzkzNSwwLDAsMSw5Ljk0OTcxLTE4LjczbDkyLjc1LTI4LjQsMTkxLjI0MDI0LTU4LjU0LDkyLjc1LTI4LjRhMTUuMTU1NTEsMTUuMTU1NTEsMCwwLDEsNC40MDk2Ni0uNjYsMTUuMDE0NjEsMTUuMDE0NjEsMCwwLDEsMTQuMzIwMzIsMTAuNjFsMzkuMDQ5OCwxMjcuNTYuNjIwMTIsMmgyLjA4MDA4WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI3Ni4xODE4NyAtMTMzLjkxMzA5KSIgZmlsbD0iIzNmM2Q1NiIvPjxwYXRoIGQ9Ik0zOTguODYyNzksMjYxLjczMzg5YTkuMDE1Nyw5LjAxNTcsMCwwLDEtOC42MTEzMy02LjM2NjdsLTEyLjg4MDM3LTQyLjA3MTc4YTguOTk4ODQsOC45OTg4NCwwLDAsMSw1Ljk3MTItMTEuMjQwMjNsMTc1LjkzOS01My44NjM3N2E5LjAwODY3LDkuMDA4NjcsMCwwLDEsMTEuMjQwNzIsNS45NzA3bDEyLjg4MDM3LDQyLjA3MjI3YTkuMDEwMjksOS4wMTAyOSwwLDAsMS01Ljk3MDcsMTEuMjQwNzJMNDAxLjQ5MjE5LDI2MS4zMzg4N0E4Ljk3Niw4Ljk3NiwwLDAsMSwzOTguODYyNzksMjYxLjczMzg5WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI3Ni4xODE4NyAtMTMzLjkxMzA5KSIgZmlsbD0iIzQzMzhjYSIvPjxjaXJjbGUgY3g9IjE5MC4xNTM1MSIgY3k9IjI0Ljk1NDY1IiByPSIyMCIgZmlsbD0iIzQzMzhjYSIvPjxjaXJjbGUgY3g9IjE5MC4xNTM1MSIgY3k9IjI0Ljk1NDY1IiByPSIxMi42NjQ2MiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik04NzguODE4MzYsNzE2LjA4NjkxaC0zMzhhOC41MDk4MSw4LjUwOTgxLDAsMCwxLTguNS04LjV2LTQwNWE4LjUwOTUxLDguNTA5NTEsMCwwLDEsOC41LTguNWgzMzhhOC41MDk4Miw4LjUwOTgyLDAsMCwxLDguNSw4LjV2NDA1QTguNTEwMTMsOC41MTAxMywwLDAsMSw4NzguODE4MzYsNzE2LjA4NjkxWiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI3Ni4xODE4NyAtMTMzLjkxMzA5KSIgZmlsbD0iI2U2ZTZlNiIvPjxwYXRoIGQ9Ik03MjMuMzE4MTMsMjc0LjA4NjkxaC0yMTAuNWExNy4wMjQxMSwxNy4wMjQxMSwwLDAsMC0xNywxN3Y0MDcuOGwyLS42MXYtNDA3LjE5YTE1LjAxODI4LDE1LjAxODI4LDAsMCwxLDE1LTE1SDcyMy45MzgyNVptMTgzLjUsMGgtMzk0YTE3LjAyNDExLDE3LjAyNDExLDAsMCwwLTE3LDE3djQ1OGExNy4wMjQxLDE3LjAyNDEsMCwwLDAsMTcsMTdoMzk0YTE3LjAyNDEsMTcuMDI0MSwwLDAsMCwxNy0xN3YtNDU4QTE3LjAyNDExLDE3LjAyNDExLDAsMCwwLDkwNi44MTgxMywyNzQuMDg2OTFabTE1LDQ3NWExNS4wMTgyOCwxNS4wMTgyOCwwLDAsMS0xNSwxNWgtMzk0YTE1LjAxODI4LDE1LjAxODI4LDAsMCwxLTE1LTE1di00NThhMTUuMDE4MjgsMTUuMDE4MjgsMCwwLDEsMTUtMTVoMzk0YTE1LjAxODI4LDE1LjAxODI4LDAsMCwxLDE1LDE1WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTI3Ni4xODE4NyAtMTMzLjkxMzA5KSIgZmlsbD0iIzNmM2Q1NiIvPjxwYXRoIGQ9Ik04MDEuODE4MzYsMzE4LjA4NjkxaC0xODRhOS4wMTAxNSw5LjAxMDE1LDAsMCwxLTktOXYtNDRhOS4wMTAxNiw5LjAxMDE2LDAsMCwxLDktOWgxODRhOS4wMTAxNiw5LjAxMDE2LDAsMCwxLDksOXY0NEE5LjAxMDE1LDkuMDEwMTUsMCwwLDEsODAxLjgxODM2LDMxOC4wODY5MVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNzYuMTgxODcgLTEzMy45MTMwOSkiIGZpbGw9IiM0MzM4Y2EiLz48Y2lyY2xlIGN4PSI0MzMuNjM2MjYiIGN5PSIxMDUuMTczODMiIHI9IjIwIiBmaWxsPSIjNDMzOGNhIi8+PGNpcmNsZSBjeD0iNDMzLjYzNjI2IiBjeT0iMTA1LjE3MzgzIiByPSIxMi4xODE4NyIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg=="/><p class="text-muted">No posts have been created yet.</p></div><div class="c-powered lg:hidden xl:hidden mt-8"><a rel="noopener" href="https://getfider.com" target="_blank">Powered by Fider</a></div></div></div></div>diff --git a/app/services/oauth/oauth.go b/app/services/oauth/oauth.goindex 8f18287e9..b0b042ef6 100644--- a/app/services/oauth/oauth.go+++ b/app/services/oauth/oauth.go@@ -131,7 +131,7 @@ func parseOAuthRawProfile(ctx context.Context, c *cmd.ParseOAuthRawProfile) erroprofile.Name = "Anonymous"}- if len(validate.Email(profile.Email)) != 0 {+ if len(validate.Email(ctx, profile.Email)) != 0 {profile.Email = ""}diff --git a/app/tasks/tasks.go b/app/tasks/tasks.goindex dcfeb5e76..4cf3dd361 100644--- a/app/tasks/tasks.go+++ b/app/tasks/tasks.go@@ -276,7 +276,7 @@ func NotifyAboutStatusChange(post *entity.Post, prevStatus enum.PostStatus) work"postLink": linkWithText(fmt.Sprintf("#%d", post.Number), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),"siteName": c.Tenant().Name,"content": markdown.Full(post.Response.Text),- "status": i18n.T(c, fmt.Sprintf("post_status.%s", post.Status.Name())),+ "status": i18n.T(c, fmt.Sprintf("enum.poststatus.%s", post.Status.Name())),"duplicate": duplicate,"view": linkWithText(i18n.T(c, "email.subscription.view"), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),"unsubscribe": linkWithText(i18n.T(c, "email.subscription.unsubscribe"), web.BaseURL(c), "/posts/%d/%s", post.Number, post.Slug),diff --git a/locale/README.md b/locale/README.mdnew file mode 100644index 000000000..1e5aebe40--- /dev/null+++ b/locale/README.md@@ -0,0 +1,31 @@+# How to localize Fider++English files `en/client.json` and `en/server.json` are the only files that should be modified during development.++All other locale files are sourced from [Crowdin](https://crowdin.com/project/fider). If you're looking to contribute with a new translation, a correction or improvement, please use Crowdin.++# How to sync Git with Crowdin++*Note:* This section is a how-to process for Fider admins only.+*Note 2:* Would be great to automate this...++## Source Strings++1. Visit https://crowdin.com/project/fider/settings#files+2. For each file, click Update and upload the respective file++## Sync English from Git to Crowdin++1. Visit https://crowdin.com/project/fider/en#+2. For each file, select Upload translations+ - Mark `Allow target translation to match source`+ - Mark `Approve added translations`++## Sync other locales from Crowdin to Git++1. Review and approve translations+2. Visit https://crowdin.com/project/fider/settings#translations+3. Select build and download+4. Copy files to locale folder+5. Update percentages on `locales.ts` based on Crowdin numbers+6. Create PR\ No newline at end of filediff --git a/locale/en/client.json b/locale/en/client.jsonindex 447aafd00..317cac10a 100644--- a/locale/en/client.json+++ b/locale/en/client.json@@ -1,7 +1,131 @@{+ "action.cancel": "Cancel",+ "action.close": "Close",+ "action.confirm": "Confirm",+ "action.delete": "Delete",+ "action.edit": "Edit",+ "action.markallasread": "Mark All as Read",+ "action.ok": "OK",+ "action.respond": "Respond",+ "action.save": "Save",+ "action.signin": "Sign in",+ "action.submit": "Submit",+ "enum.poststatus.completed": "Completed",+ "enum.poststatus.declined": "Declined",+ "enum.poststatus.deleted": "Deleted",+ "enum.poststatus.duplicate": "Duplicate",+ "enum.poststatus.open": "Open",+ "enum.poststatus.planned": "Planned",+ "enum.poststatus.started": "Started",+ "home.form.defaultinvitation": "Enter your suggestion here...",+ "home.form.defaultwelcomemessage": "We'd love to hear what you're thinking about.\n\nWhat can we do better? This is the place for you to vote, discuss and share ideas.","home.lonely.suggestion": "It's recommended that you create <0>at least 3</0> suggestions here before sharing this site. The initial content is important to start engaging your audience.","home.lonely.text": "No posts have been created yet.",+ "home.postfilter.label.view": "View",+ "home.postfilter.option.mostdiscussed": "Most Discussed",+ "home.postfilter.option.mostwanted": "Most Wanted",+ "home.postfilter.option.myvotes": "My Votes",+ "home.postfilter.option.recent": "Recent",+ "home.postfilter.option.trending": "Trending",+ "home.postinput.description.placeholder": "Describe your suggestion (optional)",+ "home.postscontainer.label.noresults": "No results matched your search, try something different.",+ "home.postscontainer.label.viewmore": "View more posts",+ "home.postscontainer.query.placeholder": "Search","home.similar.subtitle": "Consider voting on existing posts instead.","home.similar.title": "Similar posts",- "invitations.submit": "{0, plural, one {Send # invite} other {Send # invites}}"+ "home.tagsfilter.label.with": "with",+ "home.tagsfilter.selected.none": "Any tag",+ "label.actions": "Actions",+ "label.avatar": "Avatar",+ "label.custom": "Custom",+ "label.description": "Description",+ "label.discussion": "Discussion",+ "label.gravatar": "Gravatar",+ "label.letter": "Letter",+ "label.moderation": "Moderation",+ "label.name": "Name",+ "label.none": "None",+ "label.notifications": "Notifications",+ "label.subscribe": "Subscribe",+ "label.tags": "Tags",+ "label.unread": "Unread",+ "label.unsubscribe": "Unsubscribe",+ "label.voters": "Voters",+ "legal.agreement": "I have read and agree to the <0/> and <1/>.",+ "legal.notice": "By signing in, you agree to the <0/> and <1/>.",+ "legal.privacypolicy": "Privacy Policy",+ "legal.termsofservice": "Terms of Service",+ "menu.administration": "Administration",+ "menu.mysettings": "My Settings",+ "menu.signout": "Sign out",+ "menu.sitesettings": "Site Settings",+ "modal.changeemail.header": "Confirm your new email",+ "modal.changeemail.text": "We have just sent a confirmation link to <0>{0}</0>. <1/> Click the link to update your email.",+ "modal.completeprofile.header": "Complete your profile",+ "modal.completeprofile.name.placeholder": "Name",+ "modal.completeprofile.text": "Because this is your first sign in, please enter your name.",+ "modal.deleteaccount.header": "Delete account",+ "modal.deleteaccount.text": "<0>When you choose to delete your account, we will erase all your personal information forever. The content you have published will remain, but it will be anonymised.</0><1>This process is irreversible. <2>Are you sure?</2></1>",+ "modal.deletecomment.header": "Delete Comment",+ "modal.deletecomment.text": "This process is irreversible. <0>Are you sure?</0>",+ "modal.showvotes.message.zeromatches": "No users found matching '{0}'.",+ "modal.showvotes.query.placeholder": "Search for users by name...",+ "mynotifications.label.readrecently": "Read on last 30 days.",+ "mynotifications.message.nounread": "No unread notifications.",+ "mynotifications.page.subtitle": "Stay up to date with what's happening",+ "mynotifications.page.title": "Notifications",+ "mysettings.apikey.documentation": "To learn how to use the API, read the <0>official documentation</0>.",+ "mysettings.apikey.generate": "Regenerate API Key",+ "mysettings.apikey.newkey": "Your new API Key is: <0>{0}</0>",+ "mysettings.apikey.newkeynotice": "Store it securely on your servers and never store it in the client side of your app.",+ "mysettings.apikey.notice": "The API Key is only shown whenever generated. If your Key is lost or has been compromised, generated a new one and take note of it.",+ "mysettings.apikey.title": "API Key",+ "mysettings.dangerzone.delete": "Delete My Account",+ "mysettings.dangerzone.notice": "This process is irreversible. Please be certain.",+ "mysettings.dangerzone.text": "When you choose to delete your account, we will erase all your personal information forever. The content you have published will remain, but it will be anonymised.",+ "mysettings.dangerzone.title": "Delete account",+ "mysettings.message.avatar.custom": "We accept JPG, GIF and PNG images, smaller than 100KB and with an aspect ratio of 1:1 with minimum dimensions of 50x50 pixels.",+ "mysettings.message.avatar.gravatar": "A <0>Gravatar</0> will be used based on your email. If you don't have a Gravatar, a letter avatar based on your initials is generated for you.",+ "mysettings.message.avatar.letter": "A letter avatar based on your initials is generated for you.",+ "mysettings.message.noemail": "Your account doesn't have an email.",+ "mysettings.message.privateemail": "Your email is private and will never be publicly displayed.",+ "mysettings.notification.channelemail": "Email",+ "mysettings.notification.channelweb": "Web",+ "mysettings.notification.event.discussion": "Discussion",+ "mysettings.notification.event.discussion.staff": "comments on all posts unless individually unsubscribed",+ "mysettings.notification.event.discussion.visitors": "comments on posts you've subscribed to",+ "mysettings.notification.event.newpost": "New Post",+ "mysettings.notification.event.newpost.staff": "new posts on this site",+ "mysettings.notification.event.newpost.visitors": "new posts on this site",+ "mysettings.notification.event.statuschanged": "Status Changed",+ "mysettings.notification.event.statuschanged.staff": "status change on all posts unless individually unsubscribed",+ "mysettings.notification.event.statuschanged.visitors": "status change on posts you've subscribed to",+ "mysettings.notification.message.emailonly": "You'll receive <0>email</0> notifications about {about}.",+ "mysettings.notification.message.none": "You'll <0>NOT</0> receive any notification about this event.",+ "mysettings.notification.message.webandemail": "You'll receive <0>web</0> and <1>email</1> notifications about {about}.",+ "mysettings.notification.message.webonly": "You'll receive <0>web</0> notifications about {about}.",+ "mysettings.notification.title": "Use following panel to choose which events you'd like to receive notification",+ "mysettings.page.subtitle": "Manage your profile settings",+ "mysettings.page.title": "Settings",+ "showpost.commentinput.placeholder": "Leave a comment",+ "showpost.discussionpanel.emptymessage": "No one has commented yet.",+ "showpost.label.author": "Posted by <0/> · <1/>",+ "showpost.message.nodescription": "No description provided.",+ "showpost.moderationpanel.text.help": "This operation <0>cannot</0> be undone.",+ "showpost.moderationpanel.text.placeholder": "Why are you deleting this post? (optional)",+ "showpost.notificationspanel.message.subscribed": "You’re receiving notifications about activity on this post.",+ "showpost.notificationspanel.message.unsubscribed": "You'll not receive any notification about this post.",+ "showpost.postsearch.numofvotes": "{0} votes",+ "showpost.postsearch.query.placeholder": "Search original post...",+ "showpost.responseform.message.mergedvotes": "Votes from this post will be merged into original post.",+ "showpost.responseform.text.placeholder": "What's going on with this post? Let your users know what are your plans...",+ "showpost.votespanel.more": "+{extraVotesCount} more",+ "showpost.votespanel.seedetails": "see details",+ "signin.message.email": "Enter your email address to sign in",+ "signin.message.emailsent": "We have just sent a confirmation link to <0>{email}</0>. Click the link and you’ll be signed in.",+ "signin.message.locked.text": "To reactivate this site, sign in with an administrator account and update the required settings.",+ "signin.message.locked.title": "<0>{0}</0> is currently locked.",+ "signin.message.private.text": "If you have an account or an invitation, you may use following options to sign in.",+ "signin.message.private.title": "<0>{0}</0> is a private space and requires an invitation to join it.",+ "{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/en/server.json b/locale/en/server.jsonindex d44cc55aa..7f31904d6 100644--- a/locale/en/server.json+++ b/locale/en/server.json@@ -1,11 +1,41 @@{- "post_status.open": "Open",- "post_status.started": "Started",- "post_status.completed": "Completed",- "post_status.declined": "Declined",- "post_status.planned": "Planned",- "post_status.duplicate": "Duplicate",- "post_status.deleted": "Deleted",+ "property.avatarType": "Avatar Type",+ "property.name": "Name",+ "property.image": "Image",+ "property.customdomain": "Custom Domain",+ "property.key": "Key",+ "property.email": "Email",+ "property.title": "Title",+ "property.comment": "Comment",+ "property.status": "Status",+ "validation.required": "{name} is required.",+ "validation.invalid": "{name} is invalid.",+ "validation.invalidvalue": "{name} has an invalid value '{value}'.",+ "validation.maxstringlen": "{name} must have less than {len} characters.",+ "validation.custom.maxattachments": "A maximum of {number} attachments are allowed per post.",+ "validation.custom.differentemail": "Choose a different email.",+ "validation.custom.emailtaken": "This email is already in use by someone else",+ "validation.custom.descriptivetitle": "Title needs to be more descriptive.",+ "validation.custom.duplicatetitle": "This has already been posted before.",+ "validation.custom.selfduplicate": "Cannot be a duplicate of itself.",+ "validation.custom.originalpostnotfound": "Original post not found.",+ "validation.custom.cannotdeleteduplicatepost": "This post cannot be deleted because it's being referenced by a duplicated post.",+ "validation.custom.unknownsettings": "Unknown settings named '{name}'",+ "validation.custom.invalidemail": "'{email}' is not a valid email address.",+ "validation.custom.invalidurl": "'{url}' is not a valid URL.",+ "validation.custom.invalidcustomdomain": "'{domain}' is not a valid Custom Domain.",+ "validation.custom.customdomaintaken": "This custom domain is already in use by someone else.",+ "validation.custom.unsupportedfileformat": "This file format not supported.",+ "validation.custom.minimagedimensions": "The image must have minimum dimensions of {width}x{height} pixels.",+ "validation.custom.imagesquareratio": "The image must have an aspect ratio of 1:1.",+ "validation.custom.maximagesize": "The image size must be smaller than {kilobytes}KB.",+ "enum.poststatus.open": "Open",+ "enum.poststatus.started": "Started",+ "enum.poststatus.completed": "Completed",+ "enum.poststatus.declined": "Declined",+ "enum.poststatus.planned": "Planned",+ "enum.poststatus.duplicate": "Duplicate",+ "enum.poststatus.deleted": "Deleted","error.pagenotfound.title": "Page not found","error.pagenotfound.text": "The link you clicked may be broken or the page may have been removed.","error.unauthorized.title": "Not Authorized",@@ -20,7 +50,6 @@"page.pendingactivation.text": "We sent you a confirmation email with a link to activate your site.","page.pendingactivation.text2": "Please check your inbox to activate it.","page.backhome": "Take me back to <a class=\"{className}\" href=\"{url}\">{url}</a> home page.",- "validation.settings.unknown": "Unknown settings named '{name}'","email.change_emailaddress.subject": "Confirm your new email","email.change_emailaddress.request": "You have requested to change your email from {oldEmail} to {newEmail}.","email.subscription.view": "view it on your browser",diff --git a/locale/fr/client.json b/locale/fr/client.jsonnew file mode 100644index 000000000..89ea81608--- /dev/null+++ b/locale/fr/client.json@@ -0,0 +1,131 @@+{+ "action.cancel": "Annuler",+ "action.close": "Fermer",+ "action.confirm": "Confirmer",+ "action.delete": "Supprimer",+ "action.edit": "Modifier",+ "action.markallasread": "Tout marquer comme lu",+ "action.ok": "OK",+ "action.respond": "Répondre",+ "action.save": "Enregistrer",+ "action.signin": "Se connecter",+ "action.submit": "Valider",+ "enum.poststatus.completed": "Terminé",+ "enum.poststatus.declined": "Refusé",+ "enum.poststatus.deleted": "Supprimé",+ "enum.poststatus.duplicate": "Doublon",+ "enum.poststatus.open": "Ouvert",+ "enum.poststatus.planned": "Planifié",+ "enum.poststatus.started": "Démarré",+ "home.form.defaultinvitation": "Entrez votre suggestion ici...",+ "home.form.defaultwelcomemessage": "Nous aimerions savoir ce que vous pensez.\n\nQue pouvons-nous faire de mieux ? C'est ici que vous pouvez voter, discuter et partager vos idées.",+ "home.lonely.suggestion": "Il est recommandé de créer <0>au moins 3</0> suggestions avant de partager ce site. Le contenu initial est important pour commencer à engager votre public.",+ "home.lonely.text": "Aucun message n'a encore été créé.",+ "home.postfilter.label.view": "Afficher",+ "home.postfilter.option.mostdiscussed": "Les plus discutés",+ "home.postfilter.option.mostwanted": "Les plus votées",+ "home.postfilter.option.myvotes": "Mes votes",+ "home.postfilter.option.recent": "Récent",+ "home.postfilter.option.trending": "Populaire",+ "home.postinput.description.placeholder": "Décrivez votre suggestion (facultatif)",+ "home.postscontainer.label.noresults": "Aucun résultat ne correspond à votre recherche, essayez quelque chose de différent.",+ "home.postscontainer.label.viewmore": "Voir plus de messages",+ "home.postscontainer.query.placeholder": "Rechercher",+ "home.similar.subtitle": "Envisagez de voter sur les messages existants.",+ "home.similar.title": "Messages similaires",+ "home.tagsfilter.label.with": "avec",+ "home.tagsfilter.selected.none": "N'importe quel tag",+ "label.actions": "Actions",+ "label.avatar": "Avatar",+ "label.custom": "Personnalisé",+ "label.description": "Description",+ "label.discussion": "Discussion",+ "label.gravatar": "Gravatar",+ "label.letter": "Lettre",+ "label.moderation": "Modération",+ "label.name": "Nom",+ "label.none": "Aucun",+ "label.notifications": "Notifications",+ "label.subscribe": "S'abonner",+ "label.tags": "Tags",+ "label.unread": "Non lu",+ "label.unsubscribe": "Se désabonner",+ "label.voters": "Votants",+ "legal.agreement": "J'ai lu et j'accepte les <0/> et <1/>.",+ "legal.notice": "En vous connectant, vous acceptez les <0/> et <1/>.",+ "legal.privacypolicy": "Politique de confidentialité",+ "legal.termsofservice": "Conditions générales d’utilisation",+ "menu.administration": "Administration",+ "menu.mysettings": "Mes paramètres",+ "menu.signout": "Se déconnecter",+ "menu.sitesettings": "Paramètres du site",+ "modal.changeemail.header": "Confirmez votre nouvelle adresse e-mail",+ "modal.changeemail.text": "Nous venons d'envoyer un lien de confirmation à <0>{0}</0>. <1/> Cliquez sur le lien pour mettre à jour votre e-mail.",+ "modal.completeprofile.header": "Complètez votre profil",+ "modal.completeprofile.name.placeholder": "Nom",+ "modal.completeprofile.text": "Parce qu'il s'agit de votre première connexion, veuillez entrer votre nom.",+ "modal.deleteaccount.header": "Supprimer le compte",+ "modal.deleteaccount.text": "<0>Lorsque vous choisissez de supprimer votre compte, nous effacerons définitivement toutes vos informations personnelles. Le contenu que vous avez publié restera, mais il sera anonyme.</0><1>Ce processus est irréversible. <2>Êtes-vous sûr ?</2></1>",+ "modal.deletecomment.header": "Supprimer le commentaire",+ "modal.deletecomment.text": "Ce processus est irréversible. <0>Êtes-vous sûr ?</0>",+ "modal.showvotes.message.zeromatches": "Aucun utilisateur correspondant à '{0}'.",+ "modal.showvotes.query.placeholder": "Rechercher des utilisateurs par nom...",+ "mynotifications.label.readrecently": "Lu sur les 30 dernier jours.",+ "mynotifications.message.nounread": "Pas de notification non lue.",+ "mynotifications.page.subtitle": "Restez au courant de ce qui se passe",+ "mynotifications.page.title": "Notifications",+ "mysettings.apikey.documentation": "Pour savoir comment utiliser l'API, lisez la <0>documentation officielle</0>.",+ "mysettings.apikey.generate": "Régénérer la clé API",+ "mysettings.apikey.newkey": "Votre nouvelle clé API est : <0>{0}</0>",+ "mysettings.apikey.newkeynotice": "Stockez-le sur vos serveurs et non pas sur la partie cliente de votre application.",+ "mysettings.apikey.notice": "La clé API ne s'affiche qu'à chaque génération. Si votre clé est perdue ou a été compromise, générée une nouvelle clé et prenez-en note.",+ "mysettings.apikey.title": "Clé API",+ "mysettings.dangerzone.delete": "Supprimer mon compte",+ "mysettings.dangerzone.notice": "Ce processus est irréversible. Soyez sûr.",+ "mysettings.dangerzone.text": "Lorsque vous déciderez de supprimer votre compte, nous effacerons définitivement toutes vos informations personnelles. Le contenu que vous avez publié restera, mais il sera anonyme.",+ "mysettings.dangerzone.title": "Supprimer mon compte",+ "mysettings.message.avatar.custom": "Nous acceptons les images JPG, GIF et PNG, inférieures à 100 Ko avec un ratio largeur/hauteur de 1:1 et avec des dimensions minimales de 50x50 pixels.",+ "mysettings.message.avatar.gravatar": "Un <0>Gravatar</0> sera utilisé en fonction de votre adresse e-mail. Si vous n'avez pas de Gravatar, un avatar basé sur vos initiales est généré pour vous.",+ "mysettings.message.avatar.letter": "Un avatar basé sur vos initiales est généré pour vous.",+ "mysettings.message.noemail": "Votre compte n'a pas d'adresse e-mail.",+ "mysettings.message.privateemail": "Votre adresse e-mail est privé et ne sera jamais affiché publiquement.",+ "mysettings.notification.channelemail": "Adresse e-mail",+ "mysettings.notification.channelweb": "Web",+ "mysettings.notification.event.discussion": "Discussion",+ "mysettings.notification.event.discussion.staff": "commentaires sur tous les messages sauf si désabonné individuellement",+ "mysettings.notification.event.discussion.visitors": "commentaires sur les messages auxquels vous vous êtes abonné",+ "mysettings.notification.event.newpost": "Nouveau message",+ "mysettings.notification.event.newpost.staff": "nouveaux messages sur ce site",+ "mysettings.notification.event.newpost.visitors": "nouveaux messages sur ce site",+ "mysettings.notification.event.statuschanged": "Statut modifié",+ "mysettings.notification.event.statuschanged.staff": "changement de statut sur tous les messages sauf si désabonné individuellement",+ "mysettings.notification.event.statuschanged.visitors": "changement de statut sur les messages auxquels vous vous êtes abonné",+ "mysettings.notification.message.emailonly": "Vous recevrez des notifications <0>e-mail</0> sur {about}.",+ "mysettings.notification.message.none": "Vous n'allez recevoir <0>AUCUNE</0> notification concernant cet événement.",+ "mysettings.notification.message.webandemail": "Vous recevrez des notifications <0>web</0> et <1>e-mail</1> sur {about}.",+ "mysettings.notification.message.webonly": "Vous recevrez des notifications <0>web</0> sur {about}.",+ "mysettings.notification.title": "Utiliser le panneau suivant pour choisir pour quels événements vous souhaitez recevoir une notification",+ "mysettings.page.subtitle": "Gérer les paramètres de votre profil",+ "mysettings.page.title": "Paramètres",+ "showpost.commentinput.placeholder": "Rédiger un commentaire",+ "showpost.discussionpanel.emptymessage": "Personne n'a encore commenté.",+ "showpost.label.author": "Posté par <0/> · <1/>",+ "showpost.message.nodescription": "Aucune description fournie.",+ "showpost.moderationpanel.text.help": "Cette opération <0>ne peut pas</0> être annulée.",+ "showpost.moderationpanel.text.placeholder": "Pourquoi supprimez-vous ce message ? (optionnel)",+ "showpost.notificationspanel.message.subscribed": "Vous recevrez des notifications sur l'activité de ce message.",+ "showpost.notificationspanel.message.unsubscribed": "Vous ne recevrez aucune notification à propos de ce message.",+ "showpost.postsearch.numofvotes": "{0} votes",+ "showpost.postsearch.query.placeholder": "Rechercher le message original...",+ "showpost.responseform.message.mergedvotes": "Les votes de ce message seront fusionnés dans le message original.",+ "showpost.responseform.text.placeholder": "Que se passe-t-il avec ce message ? Faites savoir à vos utilisateurs quels sont vos plans...",+ "showpost.votespanel.more": "+{extraVotesCount} de plus",+ "showpost.votespanel.seedetails": "voir les détails",+ "signin.message.email": "Entrez votre adresse e-mail pour vous connecter",+ "signin.message.emailsent": "Nous venons d'envoyer un lien de confirmation à <0>{email}</0>. Cliquez sur le lien et vous serez connecté.",+ "signin.message.locked.text": "Pour réactiver ce site, connectez-vous avec un compte administrateur et mettez à jour les paramètres requis.",+ "signin.message.locked.title": "<0>{0}</0> est actuellement verrouillé.",+ "signin.message.private.text": "Si vous avez un compte ou une invitation, vous pouvez utiliser les options suivantes pour vous connecter.",+ "signin.message.private.title": "<0>{0}</0> est un espace privé et nécessite une invitation pour le rejoindre.",+ "{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"+}\ No newline at end of filediff --git a/locale/fr/server.json b/locale/fr/server.jsonnew file mode 100644index 000000000..c270ebe5f--- /dev/null+++ b/locale/fr/server.json@@ -0,0 +1,78 @@+{+ "property.avatarType": "Type d'avatar",+ "property.name": "Nom",+ "property.image": "Image",+ "property.customdomain": "Domaine personnalisé",+ "property.key": "Clé",+ "property.email": "Adresse e-mail",+ "property.title": "Titre",+ "property.comment": "Commentaire",+ "property.status": "Statut",+ "validation.required": "{name} est obligatoire.",+ "validation.invalid": "{name} est invalide.",+ "validation.invalidvalue": "{name} a une valeur invalide '{value}'.",+ "validation.maxstringlen": "{name} doit avoir moins de {len} caractères.",+ "validation.custom.maxattachments": "Un maximum de {number} pièces jointes sont autorisées par message.",+ "validation.custom.differentemail": "Veuillez choisir une adresse e-mail différente.",+ "validation.custom.emailtaken": "Cet e-mail est déjà utilisé par quelqu'un d'autre",+ "validation.custom.descriptivetitle": "Le titre doit être plus descriptif.",+ "validation.custom.duplicatetitle": "Cela a déjà été posté précédemment.",+ "validation.custom.selfduplicate": "Ne peut pas être un doublon de lui-même.",+ "validation.custom.originalpostnotfound": "Le message original est introuvable.",+ "validation.custom.cannotdeleteduplicatepost": "Ce message ne peut pas être supprimé car il est référencé par un message dupliqué.",+ "validation.custom.unknownsettings": "Paramètre inconnu nommé '{name}'",+ "validation.custom.invalidemail": "'{email}' n'est pas une adresse e-mail valide.",+ "validation.custom.invalidurl": "'{url}' n'est pas une URL valide.",+ "validation.custom.invalidcustomdomain": "'{domain}' n'est pas un domaine personnalisé valide.",+ "validation.custom.customdomaintaken": "Ce domaine personnalisé est déjà utilisé par quelqu'un d'autre.",+ "validation.custom.unsupportedfileformat": "Ce format de fichier n'est pas supporté.",+ "validation.custom.minimagedimensions": "L'image doit avoir des dimensions minimales de {width}x{height} pixels.",+ "validation.custom.imagesquareratio": "L'image doit avoir un ratio largeur/hauteur de 1:1.",+ "validation.custom.maximagesize": "La taille de l'image doit être inférieure à {kilobytes}Ko.",+ "enum.poststatus.open": "Ouvrir",+ "enum.poststatus.started": "Démarré",+ "enum.poststatus.completed": "Terminé",+ "enum.poststatus.declined": "Refusé",+ "enum.poststatus.planned": "Planifié",+ "enum.poststatus.duplicate": "Doublon",+ "enum.poststatus.deleted": "Supprimé",+ "error.pagenotfound.title": "Page non trouvée",+ "error.pagenotfound.text": "Le lien que vous avez suivi est peut être brisé ou la page peut avoir été supprimée.",+ "error.unauthorized.title": "Non autorisé",+ "error.unauthorized.text": "Vous n'êtes pas autorisé à accéder à cette page.",+ "error.expired.title": "Expiré",+ "error.expired.text": "Le lien que vous avez cliqué a expiré.",+ "error.internalerror.title": "Oops ! C'est inattendu…",+ "error.internalerror.text": "Une erreur est survenue et nous travaillons à la résolution du problème ! Nous serons opérationnels sous peu.",+ "page.notinvited.title": "Non invité",+ "page.notinvited.text": "Nous n'avons pas trouvé de compte avec cette adresse e-mail.",+ "page.pendingactivation.title": "Votre compte n'est pas activé",+ "page.pendingactivation.text": "Nous vous avons envoyé un e-mail de confirmation avec un lien pour activer votre site.",+ "page.pendingactivation.text2": "Veuillez vérifier votre boîte de réception pour l'activer.",+ "page.backhome": "Ramenez-moi à la page d'accueil de <a class=\"{className}\" href=\"{url}\">{url}</a>.",+ "email.change_emailaddress.subject": "Confirmez votre nouvelle adresse e-mail",+ "email.change_emailaddress.request": "Vous avez demandé à changer votre adresse e-mail de {oldEmail} à {newEmail}.",+ "email.subscription.view": "visualiser-le dans votre navigateur",+ "email.subscription.change": "changez vos préférences de notification",+ "email.subscription.unsubscribe": "me désabonner",+ "email.greetings": "Bonjour !",+ "email.greetings_name": "Bonjour, {name} !",+ "email.operation_confirmation": "Cliquez sur le lien ci-dessous pour confirmer cette action.",+ "email.expire_note_hours": "Remarque : Ce lien expirera dans {hours} heures et ne peut être utilisé qu'une seule fois.",+ "email.expire_note_minutes": "Remarque : Ce lien expirera dans {minutes} minutes et ne peut être utilisé qu'une seule fois.",+ "email.footer.noreply": "Cet e-mail a été envoyé à partir d'une adresse automatique qui ne peut pas recevoir d'e-mail. Veuillez ne pas répondre à ce message.",+ "email.change_status.duplicate": "<strong>{title} ({postLink})</strong> a été fermé en tant que <strong>doublon</strong> de {duplicate}.",+ "email.change_status.others": "Le statut de <strong>{title} ({postLink})</strong> a été changé à <strong>{status}</strong>.",+ "email.delete_post.text": "<strong>{title}</strong> a été <strong>supprimé</strong>.",+ "email.new_comment.text": "<strong>{userName}</strong> a laissé un commentaire sur <strong>{title} ({postLink})</strong>.",+ "email.new_post.text": "<strong>{userName}</strong> a créé un nouveau message <strong>{title} ({postLink})</strong>.",+ "email.signin_email.subject": "Se connecter à {siteName}",+ "email.signin_email.text": "Vous nous avez demandé de vous envoyer un lien de connexion et le voici.",+ "email.signin_email.confirmation": "Cliquez sur le lien ci-dessous pour vous connecter à <strong>{siteName}</strong>.",+ "email.signup_email.subject": "Votre nouveau site Fider",+ "email.signup_email.text": "Vous êtes à un pas de l'activation de votre site Fider.",+ "email.signup_email.confirmation": "En cliquant sur le lien ci-dessous, vous pouvez vérifier votre adresse e-mail et terminer le processus d'activation.",+ "email.footer.subscription_notice": "Vous recevez cet e-mail parce que vous êtes abonné à ce message. Vous pouvez {view}, {unsubscribe} ou {change}.",+ "email.footer.subscription_notice2": "Vous recevez cet e-mail parce que vous êtes abonné à ce message. Vous pouvez {change}.",+ "email.footer.subscription_notice3": "Vous recevez cet e-mail parce que vous êtes abonné à ce message. Vous pouvez {view} ou {change}."+}diff --git a/locale/locales.ts b/locale/locales.tsindex 18cadc1a9..c5ae775e9 100644--- a/locale/locales.ts+++ b/locale/locales.ts@@ -1,16 +1,21 @@interface Locale {text: string- translated?: number+ translated: number}const locales: { [key: string]: Locale } = {en: {text: "🇺🇸 English",+ translated: 100,},"pt-BR": {text: "🇧🇷 Portuguese (Brazilian)",translated: 100,},+ fr: {+ text: "🇫🇷 French",+ translated: 100,+ },}export default localesdiff --git a/locale/pt-BR/client.json b/locale/pt-BR/client.jsonindex 19c04c52e..990a003c3 100644--- a/locale/pt-BR/client.json+++ b/locale/pt-BR/client.json@@ -1,7 +1,131 @@{+ "action.cancel": "Cancelar",+ "action.close": "Fechar",+ "action.confirm": "Confirmar",+ "action.delete": "Deletar",+ "action.edit": "Editar",+ "action.markallasread": "Marcar todas como lidas",+ "action.ok": "OK",+ "action.respond": "Responder",+ "action.save": "Salvar",+ "action.signin": "Iniciar sessão",+ "action.submit": "Enviar",+ "enum.poststatus.completed": "Completado",+ "enum.poststatus.declined": "Rejeitado",+ "enum.poststatus.deleted": "Removido",+ "enum.poststatus.duplicate": "Duplicado",+ "enum.poststatus.open": "Aberto",+ "enum.poststatus.planned": "Planejado",+ "enum.poststatus.started": "Iniciado",+ "home.form.defaultinvitation": "Insira sua sugestão aqui...",+ "home.form.defaultwelcomemessage": "Gostaríamos de ouvir sobre o que você está pensando.\n\nO que podemos fazer melhor? Este é o lugar para você votar, discutir e compartilhar ideias.","home.lonely.suggestion": "É recomendável que você crie <0>pelo menos 3</0> sugestões aqui antes de compartilhar este site. O conteúdo inicial é importante para começar a engajar seu público.","home.lonely.text": "Nenhuma postagem foi criada ainda.",+ "home.postfilter.label.view": "Visualizar",+ "home.postfilter.option.mostdiscussed": "Mais Discutidos",+ "home.postfilter.option.mostwanted": "Mais Desejados",+ "home.postfilter.option.myvotes": "Meus Votos",+ "home.postfilter.option.recent": "Recentes",+ "home.postfilter.option.trending": "Popular",+ "home.postinput.description.placeholder": "Descreva sua sugestão (opcional)",+ "home.postscontainer.label.noresults": "Nenhum resultado corresponde à sua busca, tente algo diferente.",+ "home.postscontainer.label.viewmore": "Ver mais postagens",+ "home.postscontainer.query.placeholder": "Pesquisa","home.similar.subtitle": "Considere votar em postagens existentes.","home.similar.title": "Postagens similares",- "invitations.submit": "{0, plural, one {Envie # convite} other {Envie # convites}}"+ "home.tagsfilter.label.with": "com",+ "home.tagsfilter.selected.none": "Qualquer tag",+ "label.actions": "Ações",+ "label.avatar": "Avatar",+ "label.custom": "Personalizado",+ "label.description": "Descrição",+ "label.discussion": "Discussão",+ "label.gravatar": "Gravatar",+ "label.letter": "Letra",+ "label.moderation": "Moderação",+ "label.name": "Nome",+ "label.none": "Nenhum",+ "label.notifications": "Notificações",+ "label.subscribe": "Inscrever-se",+ "label.tags": "Tags",+ "label.unread": "Não lidas",+ "label.unsubscribe": "Desinscrever-se",+ "label.voters": "Votantes",+ "legal.agreement": "Eu li e concordo com os <0/> e <1/>.",+ "legal.notice": "Ao fazer o login, você aceita os <0/> e <1/>.",+ "legal.privacypolicy": "Política de Privacidade",+ "legal.termsofservice": "Termos do Serviço",+ "menu.administration": "Administração",+ "menu.mysettings": "Minhas Configurações",+ "menu.signout": "Finalizar sessão",+ "menu.sitesettings": "Configurações de Site",+ "modal.changeemail.header": "Confirme o seu novo e-mail",+ "modal.changeemail.text": "Enviamos um link de confirmação para <0>{0}</0>. <1/> Clique no link para atualizar seu e-mail.",+ "modal.completeprofile.header": "Complete o seu perfil",+ "modal.completeprofile.name.placeholder": "Nome",+ "modal.completeprofile.text": "Como este é o seu primeiro login, por favor insira o seu nome.",+ "modal.deleteaccount.header": "Excluir a conta",+ "modal.deleteaccount.text": "<0>Quando você optar por excluir sua conta, todas as suas informações pessoais serão removidas para sempre. O conteúdo que você publicou permanecerá, mas será anonimizado.</0><1>Esse processo é irreversível. <2>Você tem certeza?</2></1>",+ "modal.deletecomment.header": "Excluir comentário",+ "modal.deletecomment.text": "Este processo é irreversível. <0>Tem certeza?</0>",+ "modal.showvotes.message.zeromatches": "Nenhum usuário encontrado para '{0}'.",+ "modal.showvotes.query.placeholder": "Procurar usuários por nome...",+ "mynotifications.label.readrecently": "Lido nos últimos 30 dias.",+ "mynotifications.message.nounread": "Nenhuma notificação não lida.",+ "mynotifications.page.subtitle": "Mantenha-se atualizado com o que está acontecendo",+ "mynotifications.page.title": "Notificações",+ "mysettings.apikey.documentation": "Para aprender a usar a API, leia a <0>documentação oficial</0>.",+ "mysettings.apikey.generate": "Regerar chave de API",+ "mysettings.apikey.newkey": "A sua nova chave de API é: <0>{0}</0>",+ "mysettings.apikey.newkeynotice": "Guarde-a em seus servidores com segurança e nunca o armazene no lado do cliente em seu aplicativo.",+ "mysettings.apikey.notice": "A chave de API só é exibida quando gerada. Se sua chave for perdida ou estiver comprometida, gere uma nova e guarde-a.",+ "mysettings.apikey.title": "Chave de API",+ "mysettings.dangerzone.delete": "Excluir minha conta",+ "mysettings.dangerzone.notice": "Este processo é irreversível. Por favor, tenha certeza.",+ "mysettings.dangerzone.text": "Quando você optar por excluir sua conta, todas as suas informações pessoais serão removidas para sempre. O conteúdo que você publicou permanecerá, mas será anonimizado.",+ "mysettings.dangerzone.title": "Excluir a conta",+ "mysettings.message.avatar.custom": "Aceitamos imagens JPG, GIF e PNG, menores que 100KB e com uma proporção de aspecto de 1:1 com dimensões mínimas de 50x50 pixels.",+ "mysettings.message.avatar.gravatar": "Um <0>Gravatar</0> será utilizado com base no seu e-mail. Se você não tem um Gravatar, um avatar de letra baseado em suas iniciais será gerado para você.",+ "mysettings.message.avatar.letter": "Um avatar de letra baseado em suas iniciais é gerado para você.",+ "mysettings.message.noemail": "Sua conta não possui um e-mail.",+ "mysettings.message.privateemail": "O seu e-mail é privado e nunca será exibido publicamente.",+ "mysettings.notification.channelemail": "E-mail",+ "mysettings.notification.channelweb": "Web",+ "mysettings.notification.event.discussion": "Discussão",+ "mysettings.notification.event.discussion.staff": "comentários em todas as postagens, a menos que individualmente desinscritas",+ "mysettings.notification.event.discussion.visitors": "comentários em postagens que você se inscreveu",+ "mysettings.notification.event.newpost": "Nova postagem",+ "mysettings.notification.event.newpost.staff": "novas postagens nesse site",+ "mysettings.notification.event.newpost.visitors": "novas postagens nesse site",+ "mysettings.notification.event.statuschanged": "Alteração de status",+ "mysettings.notification.event.statuschanged.staff": "alteração de status em todas as postagens, a menos que individualmente desinscritas",+ "mysettings.notification.event.statuschanged.visitors": "alteração de status em postagens que você se inscreveu",+ "mysettings.notification.message.emailonly": "Você receberá notificações por <0>email</0> sobre {about}.",+ "mysettings.notification.message.none": "Você <0>NÃO</0> receberá qualquer notificação sobre este evento.",+ "mysettings.notification.message.webandemail": "Você receberá notificações por <0>web</0> e <1>e-mail</1> sobre {about}.",+ "mysettings.notification.message.webonly": "Você receberá notificações por <0>web</0> sobre {about}.",+ "mysettings.notification.title": "Use o painel a seguir para escolher quais eventos você gostaria de ser notificado",+ "mysettings.page.subtitle": "Gerenciar suas configurações de perfil",+ "mysettings.page.title": "Configurações",+ "showpost.commentinput.placeholder": "Deixe um comentário",+ "showpost.discussionpanel.emptymessage": "Ninguém comentou ainda.",+ "showpost.label.author": "Publicado por <0/> · <1/>",+ "showpost.message.nodescription": "Nenhuma descrição fornecida.",+ "showpost.moderationpanel.text.help": "Esta operação <0>não pode</0> ser desfeita.",+ "showpost.moderationpanel.text.placeholder": "Por que você está excluindo esta postagem? (opcional)",+ "showpost.notificationspanel.message.subscribed": "Você está recebendo notificações sobre a atividade nesta postagem.",+ "showpost.notificationspanel.message.unsubscribed": "Você não receberá nenhuma notificação sobre esta postagem.",+ "showpost.postsearch.numofvotes": "{0} votos",+ "showpost.postsearch.query.placeholder": "Procurar postagem original...",+ "showpost.responseform.message.mergedvotes": "Votos desta publicação serão mesclados na postagem original.",+ "showpost.responseform.text.placeholder": "O que está acontecendo com esta postagem? Informe seus usuários quais são os seus planos...",+ "showpost.votespanel.more": "+{extraVotesCount} mais",+ "showpost.votespanel.seedetails": "ver detalhes",+ "signin.message.email": "Digite seu endereço de e-mail para fazer login",+ "signin.message.emailsent": "Acabamos de enviar um link de confirmação para <0>{email}</0>. Clique no link para iniciar a sessão.",+ "signin.message.locked.text": "Para reativar este site, entre com uma conta de administrador e atualize as configurações necessárias.",+ "signin.message.locked.title": "<0>{0}</0> está bloqueado no momento.",+ "signin.message.private.text": "Se você tem uma conta ou um convite, você pode usar as seguintes opções para fazer o login.",+ "signin.message.private.title": "<0>{0}</0> é um espaço privado e requer um convite para se juntar a ele.",+ "{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/pt-BR/server.json b/locale/pt-BR/server.jsonindex aec052f35..8b98990ee 100644--- a/locale/pt-BR/server.json+++ b/locale/pt-BR/server.json@@ -1,11 +1,41 @@{- "post_status.open": "Aberto",- "post_status.started": "Iniciado",- "post_status.completed": "Completado",- "post_status.declined": "Rejeitado",- "post_status.planned": "Planejado",- "post_status.duplicate": "Duplicado",- "post_status.deleted": "Removido",+ "property.avatarType": "Tipo de Avatar",+ "property.name": "Nome",+ "property.image": "Imagem",+ "property.customdomain": "Domínio personalizado",+ "property.key": "Chave",+ "property.email": "E-mail",+ "property.title": "Título",+ "property.comment": "Comentário",+ "property.status": "Status",+ "validation.required": "{name} é obrigatório.",+ "validation.invalid": "{name} é inválido.",+ "validation.invalidvalue": "{name} possui um valor inválido '{value}'.",+ "validation.maxstringlen": "{name} deve ter menos de {len} caracteres.",+ "validation.custom.maxattachments": "Um máximo de {number} anexos são permitidos por postagem.",+ "validation.custom.differentemail": "Escolha um e-mail diferente.",+ "validation.custom.emailtaken": "Este e-mail já está em uso por outra pessoa",+ "validation.custom.descriptivetitle": "O título precisa ser mais descritivo.",+ "validation.custom.duplicatetitle": "Isto já foi postado anteriormente.",+ "validation.custom.selfduplicate": "Não pode ser uma duplicata de si mesma.",+ "validation.custom.originalpostnotfound": "Postagem original não encontrada.",+ "validation.custom.cannotdeleteduplicatepost": "Esta postagem não pode ser excluída porque ela está sendo referenciada por uma postagem duplicada.",+ "validation.custom.unknownsettings": "Configuração '{name}' é desconhecida",+ "validation.custom.invalidemail": "'{email}' não é um endereço de e-mail válido.",+ "validation.custom.invalidurl": "'{url}' não é uma URL válida.",+ "validation.custom.invalidcustomdomain": "'{domain}' não é um domínio personalizado válido.",+ "validation.custom.customdomaintaken": "Este domínio personalizado já está em uso por outra pessoa.",+ "validation.custom.unsupportedfileformat": "Este formato de arquivo não é suportado.",+ "validation.custom.minimagedimensions": "A imagem deve ter dimensões mínimas de {width}x{height} pixels.",+ "validation.custom.imagesquareratio": "A imagem deve ter uma relação de proporção de 1:1.",+ "validation.custom.maximagesize": "O tamanho da imagem deve ser inferior a {kilobytes}KB.",+ "enum.poststatus.open": "Aberto",+ "enum.poststatus.started": "Iniciado",+ "enum.poststatus.completed": "Completado",+ "enum.poststatus.declined": "Rejeitado",+ "enum.poststatus.planned": "Planejado",+ "enum.poststatus.duplicate": "Duplicado",+ "enum.poststatus.deleted": "Removido","error.pagenotfound.title": "Página não encontrada","error.pagenotfound.text": "O link que você acessou pode estar quebrado ou a página pode ter sido removida.","error.unauthorized.title": "Não autorizado",@@ -20,7 +50,6 @@"page.pendingactivation.text": "Enviamos a você um e-mail de confirmação com um link para ativar o seu site.","page.pendingactivation.text2": "Verifique sua caixa de entrada para ativá-la.","page.backhome": "Me leve de volta para a página inicial <a class=\"{className}\" href=\"{url}\">{url}</a>.",- "validation.settings.unknown": "Configuração '{name}' é desconhecida","email.change_emailaddress.subject": "Confirme seu novo e-mail","email.change_emailaddress.request": "Você solicitou a troca de seu email {oldEmail} para {newEmail}.","email.subscription.view": "visualizar no seu navegador",diff --git a/package.json b/package.jsonindex 6a9081999..985d8a47b 100644--- a/package.json+++ b/package.json@@ -78,6 +78,7 @@"format": "minimal","locales": ["pt-BR",+ "fr","en"]},diff --git a/public/components/Header.tsx b/public/components/Header.tsxindex a3cfa690f..ca88019e0 100644--- a/public/components/Header.tsx+++ b/public/components/Header.tsx@@ -2,6 +2,7 @@ import React, { useState } from "react"import { SignInModal, TenantLogo, DevBanner, NotificationIndicator, UserMenu } from "@fider/components"import { useFider } from "@fider/hooks"import { HStack } from "./layout"+import { Trans } from "@lingui/macro"export const Header = () => {const fider = useFider()@@ -34,7 +35,7 @@ export const Header = () => {)}{!fider.session.isAuthenticated && (<a href="#" className="uppercase text-sm" onClick={showModal}>- Sign in+ <Trans id="action.signin">Sign in</Trans></a>)}</HStack>diff --git a/public/components/ShowPostStatus.tsx b/public/components/ShowPostStatus.tsxindex baa1bba3c..b41765fc0 100644--- a/public/components/ShowPostStatus.tsx+++ b/public/components/ShowPostStatus.tsx@@ -2,11 +2,14 @@ import "./ShowPostStatus.scss"import React from "react"import { PostStatus } from "@fider/models"+import { t } from "@lingui/macro"interface ShowPostStatusProps {status: PostStatus}export const ShowPostStatus = (props: ShowPostStatusProps) => {- return <span className={`c-status-label c-status-label--${props.status.value}`}>{props.status.title}</span>+ const id = `enum.poststatus.${props.status.value}`+ const title = t({ id, message: props.status.title })+ return <span className={`c-status-label c-status-label--${props.status.value}`}>{title}</span>}diff --git a/public/components/SignInModal.tsx b/public/components/SignInModal.tsxindex c81569581..a0498adf1 100644--- a/public/components/SignInModal.tsx+++ b/public/components/SignInModal.tsx@@ -1,6 +1,7 @@import React, { useState, useEffect } from "react"import { Modal, SignInControl, LegalFooter } from "@fider/components"import { Button } from "./common"+import { Trans } from "@lingui/macro"interface SignInModalProps {isOpen: boolean@@ -28,7 +29,9 @@ export const SignInModal: React.StatelessComponent<SignInModalProps> = (props) =const content = confirmationAddress ? (<><p>- We have just sent a confirmation link to <b>{confirmationAddress}</b>. <br /> Click the link and you’ll be signed in.+ <Trans id="signin.message.emailsent">+ We have just sent a confirmation link to <b>{confirmationAddress}</b>. <br /> Click the link and you’ll be signed in.+ </Trans></p><p><Button variant="tertiary" onClick={closeModal}>diff --git a/public/components/UserMenu.tsx b/public/components/UserMenu.tsxindex a6a5ed620..8c2c7a948 100644--- a/public/components/UserMenu.tsx+++ b/public/components/UserMenu.tsx@@ -1,6 +1,7 @@import React from "react"import { useFider } from "@fider/hooks"import { Avatar, Dropdown } from "./common"+import { Trans } from "@lingui/macro"export const UserMenu = () => {const fider = useFider()@@ -9,17 +10,25 @@ export const UserMenu = () => {<div className="c-menu-user"><Dropdown position="left" renderHandle={<Avatar user={fider.session.user} />}><div className="p-2 text-medium uppercase">{fider.session.user.name}</div>- <Dropdown.ListItem href="/settings">My Settings</Dropdown.ListItem>+ <Dropdown.ListItem href="/settings">+ <Trans id="menu.mysettings">My Settings</Trans>+ </Dropdown.ListItem><Dropdown.Divider />{fider.session.user.isCollaborator && (<>- <div className="p-2 text-medium uppercase">Administration</div>- <Dropdown.ListItem href="/admin">Site Settings</Dropdown.ListItem>+ <div className="p-2 text-medium uppercase">+ <Trans id="menu.administration">Administration</Trans>+ </div>+ <Dropdown.ListItem href="/admin">+ <Trans id="menu.sitesettings">Site Settings</Trans>+ </Dropdown.ListItem><Dropdown.Divider /></>)}- <Dropdown.ListItem href="/signout?redirect=/">Sign out</Dropdown.ListItem>+ <Dropdown.ListItem href="/signout?redirect=/">+ <Trans id="menu.signout">Sign out</Trans>+ </Dropdown.ListItem></Dropdown></div>)diff --git a/public/components/common/Legal.tsx b/public/components/common/Legal.tsxindex 1216cdbb7..1ceb5f94c 100644--- a/public/components/common/Legal.tsx+++ b/public/components/common/Legal.tsx@@ -1,6 +1,7 @@import React from "react"import { Modal, Checkbox } from "@fider/components"import { useFider } from "@fider/hooks"+import { Trans } from "@lingui/macro"interface LegalAgreementProps {onChange: (agreed: boolean) => void@@ -12,7 +13,7 @@ export const TermsOfService = () => {if (fider.settings.hasLegal) {return (<a href="/terms" className="text-link" target="_blank">- Terms of Service+ <Trans id="legal.termsofservice">Terms of Service</Trans></a>)}@@ -25,7 +26,7 @@ export const PrivacyPolicy = () => {if (fider.settings.hasLegal) {return (<a href="/privacy" className="text-link" target="_blank">- Privacy Policy+ <Trans id="legal.privacypolicy">Privacy Policy</Trans></a>)}@@ -38,7 +39,9 @@ export const LegalNotice = () => {if (fider.settings.hasLegal) {return (<p className="text-muted">- By signing in, you agree to the <PrivacyPolicy /> and <TermsOfService />.+ <Trans id="legal.notice">+ By signing in, you agree to the <PrivacyPolicy /> and <TermsOfService />.+ </Trans></p>)}@@ -64,7 +67,9 @@ export const LegalAgreement: React.FunctionComponent<LegalAgreementProps> = (proif (fider.settings.hasLegal) {return (<Checkbox field="legalAgreement" onChange={props.onChange}>- I have read and agree to the <PrivacyPolicy /> and <TermsOfService />.+ <Trans id="legal.agreement">+ I have read and agree to the <PrivacyPolicy /> and <TermsOfService />.+ </Trans></Checkbox>)}diff --git a/public/components/common/SignInControl.tsx b/public/components/common/SignInControl.tsxindex 90541dc05..9f38a34e6 100644--- a/public/components/common/SignInControl.tsx+++ b/public/components/common/SignInControl.tsx@@ -5,6 +5,7 @@ import { SocialSignInButton, Form, Button, Input, Message } from "@fider/componeimport { Divider } from "@fider/components/layout"import { device, actions, Failure, isCookieEnabled } from "@fider/services"import { useFider } from "@fider/hooks"+import { Trans } from "@lingui/macro"interface SignInControlProps {useEmail: boolean@@ -52,7 +53,6 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props</React.Fragment>))}</div>- <p className="text-muted">We will never post to these accounts on your behalf.</p></>)}@@ -60,7 +60,9 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props{props.useEmail && (<div>- <p>Enter your email address to sign in</p>+ <p>+ <Trans id="signin.message.email">Enter your email address to sign in</Trans>+ </p><Form error={error}><Inputfield="email"@@ -70,7 +72,7 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (propsplaceholder="[email protected]"suffix={<Button type="submit" variant="primary" disabled={email === ""} onClick={signIn}>- Sign in+ <Trans id="action.signin">Sign in</Trans></Button>}/>diff --git a/public/components/common/form/ImageViewer.tsx b/public/components/common/form/ImageViewer.tsxindex 0b571a1d8..2f3a3a88f 100644--- a/public/components/common/form/ImageViewer.tsx+++ b/public/components/common/form/ImageViewer.tsx@@ -3,6 +3,7 @@ import { uploadedImageURL } from "@fider/services"import { Modal, Button, Loader } from "@fider/components"import "./ImageViewer.scss"+import { Trans } from "@lingui/macro"interface ImageViewerProps {bkey: string@@ -53,7 +54,7 @@ export class ImageViewer extends React.Component<ImageViewerProps, ImageViewerSt<Modal.Footer><Button variant="tertiary" onClick={this.closeModal}>- Close+ <Trans id="action.close">Close</Trans></Button></Modal.Footer></Modal.Window>diff --git a/public/pages/Administration/pages/GeneralSettings.page.tsx b/public/pages/Administration/pages/GeneralSettings.page.tsxindex e6eb419ae..8228beb25 100644--- a/public/pages/Administration/pages/GeneralSettings.page.tsx+++ b/public/pages/Administration/pages/GeneralSettings.page.tsx@@ -1,11 +1,11 @@import React, { useState } from "react"-import { Button, ButtonClickEvent, TextArea, Form, Input, ImageUploader } from "@fider/components"+import { Button, ButtonClickEvent, TextArea, Form, Input, ImageUploader, Select } from "@fider/components"import { AdminPageContainer } from "../components/AdminBasePage"import { actions, Failure, Fider } from "@fider/services"import { ImageUpload } from "@fider/models"import { useFider } from "@fider/hooks"-// import locales from "@locale/locales"+import locales from "@locale/locales"const GeneralSettingsPage = () => {const fider = useFider()@@ -14,7 +14,7 @@ const GeneralSettingsPage = () => {const [invitation, setInvitation] = useState<string>(fider.session.tenant.invitation)const [logo, setLogo] = useState<ImageUpload | undefined>(undefined)const [cname, setCNAME] = useState<string>(fider.session.tenant.cname)- const [locale] = useState<string>(fider.session.tenant.locale)+ const [locale, setLocale] = useState<string>(fider.session.tenant.locale)const [error, setError] = useState<Failure | undefined>(undefined)const handleSave = async (e: ButtonClickEvent) => {@@ -112,13 +112,13 @@ const GeneralSettingsPage = () => {</Input>)}- {/* <Select+ <Selectlabel="Locale"field="locale"defaultValue={locale}options={Object.entries(locales).map(([k, v]) => ({value: k,- label: v.text,+ label: `${v.text} (${v.translated}%)`,}))}onChange={(o) => setLocale(o?.value || "en")}>@@ -130,11 +130,12 @@ const GeneralSettingsPage = () => {<a className="text-link" target="_blank" rel="noopener" href="https://crowdin.com/project/fider">Crowdin</a>{" "}- and contribute with your own translations.+ and contribute with your own translations. No technical knowledge required.</p>+ <p className="text-muted">Only public pages are translated. Internal and/or administrative pages will remain in English.</p></>)}- </Select> */}+ </Select><div className="field"><Button disabled={!fider.session.user.isAdministrator} variant="primary" onClick={handleSave}>diff --git a/public/pages/Administration/pages/Invitations.page.tsx b/public/pages/Administration/pages/Invitations.page.tsxindex 73cc6a2ac..0656b7315 100644--- a/public/pages/Administration/pages/Invitations.page.tsx+++ b/public/pages/Administration/pages/Invitations.page.tsx@@ -4,8 +4,6 @@ import { Button, TextArea, Form, Input, Field } from "@fider/components"import { actions, notify, Failure, Fider } from "@fider/services"import { AdminBasePage } from "../components/AdminBasePage"-import { Plural } from "@lingui/macro"-interface InvitationsPageState {subject: stringmessage: string@@ -129,7 +127,7 @@ ${Fider.session.user.name} (${Fider.session.tenant.name})`,<Field label="Confirmation"><p className="text-muted">Whenever you're ready, click the following button to send out these invites.</p><Button onClick={this.sendInvites} variant="primary" disabled={this.state.numOfRecipients === 0}>- <Plural id="invitations.submit" value={this.state.numOfRecipients} one="Send # invite" other="Send # invites" />+ Send {this.state.numOfRecipients} {this.state.numOfRecipients === 1 ? "invite" : "invites"}</Button></Field></Form>diff --git a/public/pages/CompleteSignInProfile/CompleteSignInProfile.page.tsx b/public/pages/CompleteSignInProfile/CompleteSignInProfile.page.tsxindex 69a35d801..9ea1dd32f 100644--- a/public/pages/CompleteSignInProfile/CompleteSignInProfile.page.tsx+++ b/public/pages/CompleteSignInProfile/CompleteSignInProfile.page.tsx@@ -4,6 +4,7 @@ import HomePage, { HomePageProps } from "../Home/Home.page"import SignInPage from "../SignIn/SignIn.page"import { Modal, Button, Form, Input, LegalFooter } from "@fider/components"import { actions, Failure, querystring, Fider } from "@fider/services"+import { t, Trans } from "@lingui/macro"interface CompleteSignInProfilePageState {name: string@@ -42,18 +43,22 @@ export default class CompleteSignInProfilePage extends React.Component<HomePagePreturn (<><Modal.Window canClose={false} isOpen={true} onClose={this.noop}>- <Modal.Header>Complete your profile</Modal.Header>+ <Modal.Header>+ <Trans id="modal.completeprofile.header">Complete your profile</Trans>+ </Modal.Header><Modal.Content>- <p>Because this is your first sign in, please enter your name.</p>+ <p>+ <Trans id="modal.completeprofile.text">Because this is your first sign in, please enter your name.</Trans>+ </p><Form error={this.state.error}><Inputfield="name"onChange={this.setName}maxLength={100}- placeholder="Name"+ placeholder={t({ id: "modal.completeprofile.name.placeholder", message: "Name" })}suffix={<Button type="submit" onClick={this.submit} variant="primary" disabled={this.state.name === ""}>- Submit+ <Trans id="action.submit">Submit</Trans></Button>}/>diff --git a/public/pages/Home/Home.page.tsx b/public/pages/Home/Home.page.tsxindex c03770f98..0d32f7d7f 100644--- a/public/pages/Home/Home.page.tsx+++ b/public/pages/Home/Home.page.tsx@@ -10,7 +10,7 @@ import { PostsContainer } from "./components/PostsContainer"import { useFider } from "@fider/hooks"import { VStack } from "@fider/components/layout"-import { Trans } from "@lingui/macro"+import { t, Trans } from "@lingui/macro"export interface HomePageProps {posts: Post[]@@ -43,14 +43,22 @@ const Lonely = () => {)}-const defaultWelcomeMessage = `We'd love to hear what you're thinking about.--What can we do better? This is the place for you to vote, discuss and share ideas.`-const HomePage = (props: HomePageProps) => {const fider = useFider()const [title, setTitle] = useState("")+ const defaultWelcomeMessage = t({+ id: "home.form.defaultwelcomemessage",+ message: `We'd love to hear what you're thinking about.++What can we do better? This is the place for you to vote, discuss and share ideas.`,+ })++ const defaultInvitation = t({+ id: "home.form.defaultinvitation",+ message: "Enter your suggestion here...",+ })+const isLonely = () => {const len = Object.keys(props.countPerStatus).lengthif (len === 0) {@@ -69,7 +77,7 @@ const HomePage = (props: HomePageProps) => {<div className="p-home__welcome-col"><VStack spacing={2}><Markdown text={fider.session.tenant.welcomeMessage || defaultWelcomeMessage} style="full" />- <PostInput placeholder={fider.session.tenant.invitation || "Enter your suggestion here..."} onTitleChanged={setTitle} />+ <PostInput placeholder={fider.session.tenant.invitation || defaultInvitation} onTitleChanged={setTitle} /><PoweredByFider className="sm:hidden md:hidden lg:block" /></VStack></div>diff --git a/public/pages/Home/components/PostFilter.tsx b/public/pages/Home/components/PostFilter.tsxindex 1900ae52e..3aa418329 100644--- a/public/pages/Home/components/PostFilter.tsx+++ b/public/pages/Home/components/PostFilter.tsx@@ -3,6 +3,7 @@ import { PostStatus } from "@fider/models"import { Dropdown } from "@fider/components"import { HStack } from "@fider/components/layout"import { useFider } from "@fider/hooks"+import { t, Trans } from "@lingui/macro"interface PostFilterProps {activeView: string@@ -26,19 +27,20 @@ export const PostFilter = (props: PostFilterProps) => {}const options: OptionItem[] = [- { value: "trending", label: "Trending" },- { value: "recent", label: "Recent" },- { value: "most-wanted", label: "Most Wanted" },- { value: "most-discussed", label: "Most Discussed" },+ { value: "trending", label: t({ id: "home.postfilter.option.trending", message: "Trending" }) },+ { value: "recent", label: t({ id: "home.postfilter.option.recent", message: "Recent" }) },+ { value: "most-wanted", label: t({ id: "home.postfilter.option.mostwanted", message: "Most Wanted" }) },+ { value: "most-discussed", label: t({ id: "home.postfilter.option.mostdiscussed", message: "Most Discussed" }) },]if (fider.session.isAuthenticated) {- options.push({ value: "my-votes", label: "My Votes" })+ options.push({ value: "my-votes", label: t({ id: "home.postfilter.option.myvotes", message: "My Votes" }) })}PostStatus.All.filter((s) => s.filterable && props.countPerStatus[s.value]).forEach((s) => {+ const id = `enum.poststatus.${s.value.toString()}`options.push({- label: s.title,+ label: t({ id, message: s.title }),value: s.value,count: props.countPerStatus[s.value],})@@ -49,7 +51,9 @@ export const PostFilter = (props: PostFilterProps) => {return (<HStack>- <span className="text-category">View</span>+ <span className="text-category">+ <Trans id="home.postfilter.label.view">View</Trans>+ </span><Dropdown renderHandle={<div className="text-medium text-xs uppercase rounded-md uppercase bg-gray-100 px-2 py-1">{label}</div>}>{options.map((o) => (<Dropdown.ListItem onClick={handleChangeView(o)} key={o.value}>diff --git a/public/pages/Home/components/PostInput.tsx b/public/pages/Home/components/PostInput.tsxindex 84d776835..e331e4bb5 100644--- a/public/pages/Home/components/PostInput.tsx+++ b/public/pages/Home/components/PostInput.tsx@@ -4,6 +4,7 @@ import { SignInModal } from "@fider/components"import { cache, actions, Failure } from "@fider/services"import { ImageUpload } from "@fider/models"import { useFider } from "@fider/hooks"+import { t } from "@lingui/macro"interface PostInputProps {placeholder: string@@ -70,7 +71,13 @@ export const PostInput = (props: PostInputProps) => {const details = () => (<>- <TextArea field="description" onChange={handleDescriptionChange} value={description} minRows={5} placeholder="Describe your suggestion (optional)" />+ <TextArea+ field="description"+ onChange={handleDescriptionChange}+ value={description}+ minRows={5}+ placeholder={t({ id: "home.postinput.description.placeholder", message: "Describe your suggestion (optional)" })}+ /><MultiImageUploader field="attachments" maxUploads={3} onChange={setAttachments} /><Button type="submit" variant="primary" onClick={submit}>Submitdiff --git a/public/pages/Home/components/PostsContainer.tsx b/public/pages/Home/components/PostsContainer.tsxindex a41dd576b..9478ec749 100644--- a/public/pages/Home/components/PostsContainer.tsx+++ b/public/pages/Home/components/PostsContainer.tsx@@ -10,6 +10,7 @@ import IconX from "@fider/assets/images/heroicons-x.svg"import { PostFilter } from "./PostFilter"import { ListPosts } from "./ListPosts"import { TagsFilter } from "./TagsFilter"+import { t, Trans } from "@lingui/macro"interface PostsContainerProps {user?: CurrentUser@@ -106,7 +107,7 @@ export class PostsContainer extends React.Component<PostsContainerProps, PostsCo{!this.state.query && (<div className="c-posts-container__filter-col"><PostFilter activeView={this.state.view} viewChanged={this.handleViewChanged} countPerStatus={this.props.countPerStatus} />- <TagsFilter tags={this.props.tags} selectionChanged={this.handleTagsFilterChanged} selected={this.state.tags} />+ {this.props.tags.length > 0 && <TagsFilter tags={this.props.tags} selectionChanged={this.handleTagsFilterChanged} selected={this.state.tags} />}</div>)}<div className="c-posts-container__search-col">@@ -114,18 +115,22 @@ export class PostsContainer extends React.Component<PostsContainerProps, PostsCofield="query"icon={this.state.query ? IconX : IconSearch}onIconClick={this.state.query ? this.clearSearch : undefined}- placeholder="Search"+ placeholder={t({ id: "home.postscontainer.query.placeholder", message: "Search" })}value={this.state.query}onChange={this.handleSearchFilterChanged}/></div></div>- <ListPosts posts={this.state.posts} tags={this.props.tags} emptyText={"No results matched your search, try something different."} />+ <ListPosts+ posts={this.state.posts}+ tags={this.props.tags}+ emptyText={t({ id: "home.postscontainer.label.noresults", message: "No results matched your search, try something different." })}+ />{this.state.loading && <Loader />}{showMoreLink && (<div className="my-4 ml-4"><a href={showMoreLink} className="text-primary-base text-medium hover:underline" onClick={this.showMore}>- View more posts+ <Trans id="home.postscontainer.label.viewmore">View more posts</Trans></a></div>)}diff --git a/public/pages/Home/components/TagsFilter.tsx b/public/pages/Home/components/TagsFilter.tsxindex 4fd1e2761..c18580e1e 100644--- a/public/pages/Home/components/TagsFilter.tsx+++ b/public/pages/Home/components/TagsFilter.tsx@@ -3,6 +3,7 @@ import { Tag } from "@fider/models"import { Dropdown, Icon, ShowTag } from "@fider/components"import IconCheck from "@fider/assets/images/heroicons-check.svg"import { HStack } from "@fider/components/layout"+import { plural, t, Trans } from "@lingui/macro"interface TagsFilterProps {tags: Tag[]@@ -20,11 +21,18 @@ export const TagsFilter = (props: TagsFilterProps) => {props.selectionChanged(next)}- const label = selected.length === 1 ? "1 tag" : selected.length >= 2 ? `${selected.length} tags` : "Any Tag"+ const count = selected.length+ const label =+ count >= 1+ ? plural(count, {+ one: `# tag`,+ other: `# tags`,+ })+ : t({ id: "home.tagsfilter.selected.none", message: "Any tag" })return (<HStack>- <span className="text-category">with</span>+ <Trans id="home.tagsfilter.label.with">with</Trans><Dropdown renderHandle={<div className="text-medium text-xs uppercase rounded-md uppercase bg-gray-100 px-2 py-1">{label}</div>}>{props.tags.map((t) => (<Dropdown.ListItem onClick={toggle(t)} key={t.id}>diff --git a/public/pages/MyNotifications/MyNotifications.page.tsx b/public/pages/MyNotifications/MyNotifications.page.tsxindex d8ba46cdd..f5f9ffc68 100644--- a/public/pages/MyNotifications/MyNotifications.page.tsx+++ b/public/pages/MyNotifications/MyNotifications.page.tsx@@ -4,6 +4,7 @@ import { Notification } from "@fider/models"import { Markdown, Moment, PageTitle } from "@fider/components"import { actions, Fider } from "@fider/services"import { HStack, VStack } from "@fider/components/layout"+import { t, Trans } from "@lingui/macro"interface MyNotificationsPageProps {notifications: Notification[]@@ -59,25 +60,36 @@ export default class MyNotificationsPage extends React.Component<MyNotificationspublic render() {return (<div id="p-my-notifications" className="page container">- <PageTitle title="Notifications" subtitle="Stay up to date with what's happening" />+ <PageTitle+ title={t({ id: "mynotifications.page.title", message: "Notifications" })}+ subtitle={t({ id: "mynotifications.page.subtitle", message: "Stay up to date with what's happening" })}+ /><HStack spacing={4} className="mt-8 mb-2">- <h4 className="text-title">Unread</h4>+ <h4 className="text-title">+ <Trans id="label.unread">Unread</Trans>+ </h4>{this.state.unread.length > 0 && (<a href="#" className="text-link text-xs" onClick={this.markAllAsRead}>- Mark All as Read+ <Trans id="action.markallasread">Mark All as Read</Trans></a>)}</HStack><VStack spacing={4}>{this.state.unread.length > 0 && this.items(this.state.unread)}- {this.state.unread.length === 0 && <span className="text-muted">No unread notifications.</span>}+ {this.state.unread.length === 0 && (+ <span className="text-muted">+ <Trans id="mynotifications.message.nounread">No unread notifications.</Trans>+ </span>+ )}</VStack>{this.state.recent.length > 0 && (<>- <h4 className="text-title mt-8 mb-2">Read on last 30 days</h4>+ <h4 className="text-title mt-8 mb-2">+ <Trans id="mynotifications.label.readrecently">Read on last 30 days.</Trans>+ </h4><VStack spacing={4}>{this.items(this.state.recent)}</VStack></>)}diff --git a/public/pages/MySettings/MySettings.page.tsx b/public/pages/MySettings/MySettings.page.tsxindex 6725896a0..1b22ac9a5 100644--- a/public/pages/MySettings/MySettings.page.tsx+++ b/public/pages/MySettings/MySettings.page.tsx@@ -7,6 +7,7 @@ import { Failure, actions, Fider } from "@fider/services"import { NotificationSettings } from "./components/NotificationSettings"import { APIKeyForm } from "./components/APIKeyForm"import { DangerZone } from "./components/DangerZone"+import { t, Trans } from "@lingui/macro"interface MySettingsPageState {showModal: boolean@@ -111,22 +112,29 @@ export default class MySettingsPage extends React.Component<MySettingsPageProps,return (<div id="p-my-settings" className="page container"><Modal.Window isOpen={this.state.showModal} onClose={this.closeModal}>- <Modal.Header>Confirm your new email</Modal.Header>+ <Modal.Header>+ <Trans id="modal.changeemail.header">Confirm your new email</Trans>+ </Modal.Header><Modal.Content><div><p>- We have just sent a confirmation link to <b>{this.state.newEmail}</b>. <br /> Click the link to update your email.+ <Trans id="modal.changeemail.text">+ We have just sent a confirmation link to <b>{this.state.newEmail}</b>. <br /> Click the link to update your email.+ </Trans></p><p><a href="#" onClick={this.closeModal}>- OK+ <Trans id="action.ok">OK</Trans></a></p></div></Modal.Content></Modal.Window>- <PageTitle title="Settings" subtitle="Manage your profile settings" />+ <PageTitle+ title={t({ id: "mysettings.page.title", message: "Settings" })}+ subtitle={t({ id: "mysettings.page.subtitle", message: "Manage your profile settings" })}+ /><div className="w-max-7xl"><Form error={this.state.error}>@@ -140,49 +148,59 @@ export default class MySettingsPage extends React.Component<MySettingsPageProps,onChange={this.setNewEmail}><p className="text-muted">- {Fider.session.user.email || this.state.changingEmail- ? "Your email is private and will never be publicly displayed."- : "Your account doesn't have an email."}+ {Fider.session.user.email || this.state.changingEmail ? (+ <Trans id="mysettings.message.privateemail">Your email is private and will never be publicly displayed.</Trans>+ ) : (+ <Trans id="mysettings.message.noemail">Your account doesn't have an email.</Trans>+ )}</p>{this.state.changingEmail && (<><Button variant="primary" size="small" onClick={this.submitNewEmail}>- Confirm+ <Trans id="action.confirm">Confirm</Trans></Button><Button variant="tertiary" size="small" onClick={this.cancelChangeEmail}>- Cancel+ <Trans id="action.cancel">Cancel</Trans></Button></>)}</Input>- <Input label="Name" field="name" value={this.state.name} maxLength={100} onChange={this.setName} />+ <Input label={t({ id: "label.name", message: "Name" })} field="name" value={this.state.name} maxLength={100} onChange={this.setName} /><Select- label="Avatar"+ label={t({ id: "label.avatar", message: "Avatar" })}field="avatarType"defaultValue={this.state.avatarType}options={[- { label: "Letter", value: UserAvatarType.Letter },- { label: "Gravatar", value: UserAvatarType.Gravatar },- { label: "Custom", value: UserAvatarType.Custom },+ { label: t({ id: "label.letter", message: "Letter" }), value: UserAvatarType.Letter },+ { label: t({ id: "label.gravatar", message: "Gravatar" }), value: UserAvatarType.Gravatar },+ { label: t({ id: "label.custom", message: "Custom" }), value: UserAvatarType.Custom },]}onChange={this.avatarTypeChanged}>{this.state.avatarType === UserAvatarType.Gravatar && (<p className="text-muted mt-1">- A{" "}- <a className="text-link" rel="noopener" href="https://en.gravatar.com" target="_blank">- Gravatar- </a>{" "}- will be used based on your email. If you don't have a Gravatar, a letter avatar based on your initials is generated for you.+ <Trans id="mysettings.message.avatar.gravatar">+ A{" "}+ <a className="text-link" rel="noopener" href="https://en.gravatar.com" target="_blank">+ Gravatar+ </a>{" "}+ will be used based on your email. If you don't have a Gravatar, a letter avatar based on your initials is generated for you.+ </Trans>+ </p>+ )}+ {this.state.avatarType === UserAvatarType.Letter && (+ <p className="text-muted">+ <Trans id="mysettings.message.avatar.letter">A letter avatar based on your initials is generated for you.</Trans></p>)}- {this.state.avatarType === UserAvatarType.Letter && <p className="text-muted">A letter avatar based on your initials is generated for you.</p>}{this.state.avatarType === UserAvatarType.Custom && (<ImageUploader field="avatar" onChange={this.setAvatar} bkey={Fider.session.user.avatarBlobKey}><p className="text-muted">- We accept JPG, GIF and PNG images, smaller than 100KB and with an aspect ratio of 1:1 with minimum dimensions of 50x50 pixels.+ <Trans id="mysettings.message.avatar.custom">+ We accept JPG, GIF and PNG images, smaller than 100KB and with an aspect ratio of 1:1 with minimum dimensions of 50x50 pixels.+ </Trans></p></ImageUploader>)}@@ -191,7 +209,7 @@ export default class MySettingsPage extends React.Component<MySettingsPageProps,<NotificationSettings userSettings={this.props.userSettings} settingsChanged={this.setNotificationSettings} /><Button variant="primary" onClick={this.confirm}>- Save+ <Trans id="action.save">Save</Trans></Button></Form>diff --git a/public/pages/MySettings/components/APIKeyForm.tsx b/public/pages/MySettings/components/APIKeyForm.tsxindex 9b57133e5..a3300d418 100644--- a/public/pages/MySettings/components/APIKeyForm.tsx+++ b/public/pages/MySettings/components/APIKeyForm.tsx@@ -1,6 +1,7 @@import React from "react"import { Button } from "@fider/components"import { actions } from "@fider/services"+import { Trans } from "@lingui/macro"interface APIKeyFormState {apiKey?: string@@ -23,9 +24,13 @@ export class APIKeyForm extends React.Component<any, APIKeyFormState> {return (<><p className="text-muted">- Your new API Key is: <code>{this.state.apiKey}</code>+ <Trans id="mysettings.apikey.newkey">+ Your new API Key is: <code>{this.state.apiKey}</code>+ </Trans>+ </p>+ <p className="text-muted">+ <Trans id="mysettings.apikey.newkeynotice">Store it securely on your servers and never store it in the client side of your app.</Trans></p>- <p className="text-muted">Stored it securely on your servers and never store it in the client side of your app.</p></>)}@@ -33,20 +38,26 @@ export class APIKeyForm extends React.Component<any, APIKeyFormState> {public render() {return (<div>- <h4 className="text-title mb-1">API Key</h4>+ <h4 className="text-title mb-1">+ <Trans id="mysettings.apikey.title">API Key</Trans>+ </h4><p className="text-muted">- The API Key is only shown whenever generated. If your Key is lost or has been compromised, generated a new one and take note of it.+ <Trans id="mysettings.apikey.notice">+ The API Key is only shown whenever generated. If your Key is lost or has been compromised, generated a new one and take note of it.+ </Trans></p><p className="text-muted">- To learn how to use the API, read the{" "}- <a className="text-link" rel="noopener" href="https://getfider.com/docs/api" target="_blank">- official documentation- </a>- .+ <Trans id="mysettings.apikey.documentation">+ To learn how to use the API, read the{" "}+ <a className="text-link" rel="noopener" href="https://getfider.com/docs/api" target="_blank">+ official documentation+ </a>+ .+ </Trans></p><p><Button size="small" onClick={this.regenerate}>- Regenerate API Key+ <Trans id="mysettings.apikey.generate">Regenerate API Key</Trans></Button></p>{this.state.apiKey && this.showAPIKey()}diff --git a/public/pages/MySettings/components/DangerZone.tsx b/public/pages/MySettings/components/DangerZone.tsxindex de326368a..03b6c38c9 100644--- a/public/pages/MySettings/components/DangerZone.tsx+++ b/public/pages/MySettings/components/DangerZone.tsx@@ -2,6 +2,7 @@ import React from "react"import { Button, Modal, ButtonClickEvent } from "@fider/components"import { actions, notify, navigator } from "@fider/services"+import { Trans } from "@lingui/macro"interface DangerZoneState {clicked: boolean@@ -37,34 +38,44 @@ export class DangerZone extends React.Component<any, DangerZoneState> {return (<div><Modal.Window isOpen={this.state.clicked} center={false} onClose={this.onCancel}>- <Modal.Header>Delete account</Modal.Header>+ <Modal.Header>+ <Trans id="modal.deleteaccount.header">Delete account</Trans>+ </Modal.Header><Modal.Content>- <p>- When you choose to delete your account, we will erase all your personal information forever. The content you have published will remain, but it- will be anonymised.- </p>- <p>- This process is irreversible. <strong>Are you sure?</strong>- </p>+ <Trans id="modal.deleteaccount.text">+ <p>+ When you choose to delete your account, we will erase all your personal information forever. The content you have published will remain, but it+ will be anonymised.+ </p>+ <p>+ This process is irreversible. <strong>Are you sure?</strong>+ </p>+ </Trans></Modal.Content><Modal.Footer><Button variant="danger" size="small" onClick={this.onConfirm}>- Confirm+ <Trans id="action.confirm">Confirm</Trans></Button><Button variant="tertiary" size="small" onClick={this.onCancel}>- Cancel+ <Trans id="action.cancel">Cancel</Trans></Button></Modal.Footer></Modal.Window>- <h4 className="text-title mb-1">Delete account</h4>+ <h4 className="text-title mb-1">+ <Trans id="mysettings.dangerzone.title">Delete account</Trans>+ </h4><p className="text-muted">- When you choose to delete your account, we will erase all your personal information forever. The content you have published will remain, but it will- be anonymised.+ <Trans id="mysettings.dangerzone.text">+ When you choose to delete your account, we will erase all your personal information forever. The content you have published will remain, but it will+ be anonymised.+ </Trans>+ </p>+ <p className="text-muted">+ <Trans id="mysettings.dangerzone.notice">This process is irreversible. Please be certain.</Trans></p>- <p className="text-muted">This process is irreversible. Please be certain.</p><Button variant="danger" size="small" onClick={this.onClickDelete}>- Delete My Account+ <Trans id="mysettings.dangerzone.delete">Delete My Account</Trans></Button></div>)diff --git a/public/pages/MySettings/components/NotificationSettings.tsx b/public/pages/MySettings/components/NotificationSettings.tsxindex b29ac35c0..4c54acdca 100644--- a/public/pages/MySettings/components/NotificationSettings.tsx+++ b/public/pages/MySettings/components/NotificationSettings.tsx@@ -4,6 +4,7 @@ import { UserSettings } from "@fider/models"import { Toggle, Field } from "@fider/components"import { useFider } from "@fider/hooks"import { HStack, VStack } from "@fider/components/layout"+import { t, Trans } from "@lingui/macro"interface NotificationSettingsProps {userSettings: UserSettings@@ -34,9 +35,12 @@ export const NotificationSettings = (props: NotificationSettingsProps) => {props.settingsChanged(nextSettings)}+ const labelWeb = t({ id: "mysettings.notification.channelweb", message: "Web" })+ const labelEmail = t({ id: "mysettings.notification.channelemail", message: "Email" })+const icon = (settingsKey: string, channel: Channel) => {const active = isEnabled(settingsKey, channel)- const label = channel === WebChannel ? "Web" : "Email"+ const label = channel === WebChannel ? labelWeb : labelEmailconst onToggle = () => toggle(settingsKey, channel)return <Toggle key={`${settingsKey}_${channel}`} active={active} label={label} onToggle={onToggle} />}@@ -49,25 +53,33 @@ export const NotificationSettings = (props: NotificationSettingsProps) => {if (!webEnabled && !emailEnabled) {return (<p className="text-muted">- You'll <strong>NOT</strong> receive any notification about this event.+ <Trans id="mysettings.notification.message.none">+ You'll <strong>NOT</strong> receive any notification about this event.+ </Trans></p>)} else if (webEnabled && !emailEnabled) {return (<p className="text-muted">- You'll receive <strong>web</strong> notifications about {about}.+ <Trans id="mysettings.notification.message.webonly">+ You'll receive <strong>web</strong> notifications about {about}.+ </Trans></p>)} else if (!webEnabled && emailEnabled) {return (<p className="text-muted">- You'll receive <strong>email</strong> notifications about {about}.+ <Trans id="mysettings.notification.message.emailonly">+ You'll receive <strong>email</strong> notifications about {about}.+ </Trans></p>)} else if (webEnabled && emailEnabled) {return (<p className="text-muted">- You'll receive <strong>web</strong> and <strong>email</strong> notifications about {about}.+ <Trans id="mysettings.notification.message.webandemail">+ You'll receive <strong>web</strong> and <strong>email</strong> notifications about {about}.+ </Trans></p>)}@@ -77,32 +89,48 @@ export const NotificationSettings = (props: NotificationSettingsProps) => {return (<><Field label="Notifications">- <p className="text-muted">Use following panel to choose which events you'd like to receive notification</p>+ <p className="text-muted">+ <Trans id="mysettings.notification.title">Use following panel to choose which events you'd like to receive notification</Trans>+ </p><div className="notifications-settings"><VStack spacing={4} divide={true} className="p-2 bg-gray-50 rounded"><div>- <div className="mb-1">New Post</div>- {info("event_notification_new_post", "new posts on this site", "new posts on this site")}+ <div className="mb-1">+ <Trans id="mysettings.notification.event.newpost">New Post</Trans>+ </div>+ {info(+ "event_notification_new_post",+ t({ id: "mysettings.notification.event.newpost.visitors", message: "new posts on this site" }),+ t({ id: "mysettings.notification.event.newpost.staff", message: "new posts on this site" })+ )}<HStack spacing={6}>{icon("event_notification_new_post", WebChannel)}{icon("event_notification_new_post", EmailChannel)}</HStack></div><div>- <div className="mb-1">Discussion</div>- {info("event_notification_new_comment", "comments on posts you've subscribed to", "comments on all posts unless individually unsubscribed")}+ <div className="mb-1">+ <Trans id="mysettings.notification.event.discussion">Discussion</Trans>+ </div>+ {info(+ "event_notification_new_comment",+ t({ id: "mysettings.notification.event.discussion.visitors", message: "comments on posts you've subscribed to" }),+ t({ id: "mysettings.notification.event.discussion.staff", message: "comments on all posts unless individually unsubscribed" })+ )}<HStack spacing={6}>{icon("event_notification_new_comment", WebChannel)}{icon("event_notification_new_comment", EmailChannel)}</HStack></div><div>- <div className="mb-1">Status Changed</div>+ <div className="mb-1">+ <Trans id="mysettings.notification.event.statuschanged">Status Changed</Trans>+ </div>{info("event_notification_change_status",- "status change on posts you've subscribed to",- "status change on all posts unless individually unsubscribed"+ t({ id: "mysettings.notification.event.statuschanged.visitors", message: "status change on posts you've subscribed to" }),+ t({ id: "mysettings.notification.event.statuschanged.staff", message: "status change on all posts unless individually unsubscribed" }))}<HStack spacing={6}>{icon("event_notification_change_status", WebChannel)}diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsxindex d682371e9..0508fe77f 100644--- a/public/pages/ShowPost/ShowPost.page.tsx+++ b/public/pages/ShowPost/ShowPost.page.tsx@@ -30,6 +30,7 @@ import IconX from "@fider/assets/images/heroicons-x.svg"import IconPencilAlt from "@fider/assets/images/heroicons-pencil-alt.svg"import IconCheck from "@fider/assets/images/heroicons-check.svg"import { HStack, VStack } from "@fider/components/layout"+import { Trans } from "@lingui/macro"interface ShowPostPageProps {post: Post@@ -119,12 +120,16 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho)}<span className="text-muted">- Posted by <UserName user={this.props.post.user} /> · <Moment locale={Fider.currentLocale} date={this.props.post.createdAt} />+ <Trans id="showpost.label.author">+ Posted by <UserName user={this.props.post.user} /> · <Moment locale={Fider.currentLocale} date={this.props.post.createdAt} />+ </Trans></span></div></HStack><VStack>- <span className="text-category">Description</span>+ <span className="text-category">+ <Trans id="label.description">Description</Trans>+ </span>{this.state.editMode ? (<Form error={this.state.error}><TextArea field="description" value={this.state.newDescription} onChange={this.setNewDescription} />@@ -133,7 +138,11 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho) : (<>{this.props.post.description && <Markdown className="description" text={this.props.post.description} style="full" />}- {!this.props.post.description && <em className="text-muted">No description provided.</em>}+ {!this.props.post.description && (+ <em className="text-muted">+ <Trans id="showpost.message.nodescription">No description provided.</Trans>+ </em>+ )}{this.props.attachments.map((x) => (<ImageViewer key={x} bkey={x} />))}@@ -150,21 +159,30 @@ export default class ShowPostPage extends React.Component<ShowPostPageProps, Sho{Fider.session.isAuthenticated && canEditPost(Fider.session.user, this.props.post) && (<VStack><span key={0} className="text-category">- Actions+ <Trans id="label.actions">Actions</Trans></span>{this.state.editMode ? (<VStack><Button variant="primary" onClick={this.saveChanges}>- <Icon sprite={IconCheck} /> <span>Save</span>+ <Icon sprite={IconCheck} />{" "}+ <span>+ <Trans id="action.save">Save</Trans>+ </span></Button><Button onClick={this.cancelEdit}>- <Icon sprite={IconX} /> <span>Cancel</span>+ <Icon sprite={IconX} />+ <span>+ <Trans id="action.cancel">Cancel</Trans>+ </span></Button></VStack>) : (<VStack><Button onClick={this.startEdit}>- <Icon sprite={IconPencilAlt} /> <span>Edit</span>+ <Icon sprite={IconPencilAlt} />+ <span>+ <Trans id="action.edit">Edit</Trans>+ </span></Button>{Fider.session.user.isCollaborator && <ResponseForm post={this.props.post} />}</VStack>diff --git a/public/pages/ShowPost/components/CommentInput.tsx b/public/pages/ShowPost/components/CommentInput.tsxindex 8de4ff712..67a162a51 100644--- a/public/pages/ShowPost/components/CommentInput.tsx+++ b/public/pages/ShowPost/components/CommentInput.tsx@@ -7,6 +7,7 @@ import { SignInModal } from "@fider/components"import { cache, actions, Failure, Fider } from "@fider/services"import { useFider } from "@fider/hooks"import { HStack } from "@fider/components/layout"+import { t, Trans } from "@lingui/macro"interface CommentInputProps {post: Post@@ -64,7 +65,7 @@ export const CommentInput = (props: CommentInputProps) => {</div>)}<TextArea- placeholder="Leave a comment"+ placeholder={t({ id: "showpost.commentinput.placeholder", message: "Leave a comment" })}field="content"value={content}minRows={1}@@ -76,7 +77,7 @@ export const CommentInput = (props: CommentInputProps) => {<><MultiImageUploader field="attachments" maxUploads={2} onChange={setAttachments} /><Button variant="primary" onClick={submit}>- Submit+ <Trans id="action.submit">Submit</Trans></Button></>)}diff --git a/public/pages/ShowPost/components/DiscussionPanel.tsx b/public/pages/ShowPost/components/DiscussionPanel.tsxindex a0bc68dc4..814a2ea7e 100644--- a/public/pages/ShowPost/components/DiscussionPanel.tsx+++ b/public/pages/ShowPost/components/DiscussionPanel.tsx@@ -5,6 +5,7 @@ import { CommentInput } from "./CommentInput"import PostIllustration from "@fider/assets/images/undraw-post.svg"import { Icon } from "@fider/components"import { VStack } from "@fider/components/layout"+import { Trans } from "@lingui/macro"interface DiscussionPanelProps {user?: CurrentUser@@ -16,7 +17,9 @@ export const DiscussionPanel = (props: DiscussionPanelProps) => {return (<><VStack spacing={2} className="c-comment-list">- <span className="text-category">Discussion</span>+ <span className="text-category">+ <Trans id="label.discussion">Discussion</Trans>+ </span><VStack spacing={4} className="c-comment-list">{props.comments.map((c) => (<ShowComment key={c.id} post={props.post} comment={c} />@@ -26,7 +29,9 @@ export const DiscussionPanel = (props: DiscussionPanelProps) => {{props.comments.length === 0 && (<div className="text-center mt-4"><Icon sprite={PostIllustration} height="120" />- <p className="text-xs">No one has commented yet.</p>+ <p className="text-xs">+ <Trans id="showpost.discussionpanel.emptymessage">No one has commented yet.</Trans>+ </p></div>)}</VStack>diff --git a/public/pages/ShowPost/components/ModerationPanel.tsx b/public/pages/ShowPost/components/ModerationPanel.tsxindex d94f03a04..143a84384 100644--- a/public/pages/ShowPost/components/ModerationPanel.tsx+++ b/public/pages/ShowPost/components/ModerationPanel.tsx@@ -4,6 +4,7 @@ import { actions, navigator, Failure } from "@fider/services"import { Form, Modal, Button, TextArea } from "@fider/components"import { useFider } from "@fider/hooks"import { VStack } from "@fider/components/layout"+import { t, Trans } from "@lingui/macro"interface ModerationPanelProps {post: Post@@ -37,9 +38,16 @@ export const ModerationPanel = (props: ModerationPanelProps) => {<Modal.Window isOpen={showConfirmation} onClose={hideModal} center={false} size="large"><Modal.Content><Form error={error}>- <TextArea field="text" onChange={setText} value={text} placeholder="Why are you deleting this post? (optional)">+ <TextArea+ field="text"+ onChange={setText}+ value={text}+ placeholder={t({ id: "showpost.moderationpanel.text.placeholder", message: "Why are you deleting this post? (optional)" })}+ ><span className="text-muted">- This operation <strong>cannot</strong> be undone.+ <Trans id="showpost.moderationpanel.text.help">+ This operation <strong>cannot</strong> be undone.+ </Trans></span></TextArea></Form>@@ -47,10 +55,10 @@ export const ModerationPanel = (props: ModerationPanelProps) => {<Modal.Footer><Button variant="danger" onClick={handleDelete}>- Delete+ <Trans id="action.delete">Delete</Trans></Button><Button variant="tertiary" onClick={hideModal}>- Cancel+ <Trans id="action.cancel">Cancel</Trans></Button></Modal.Footer></Modal.Window>@@ -59,9 +67,11 @@ export const ModerationPanel = (props: ModerationPanelProps) => {return (<VStack>{modal}- <span className="text-category">Moderation</span>+ <span className="text-category">+ <Trans id="label.moderation">Moderation</Trans>+ </span><Button variant="danger" size="small" className="w-full" onClick={showModal}>- Delete+ <Trans id="action.delete">Delete</Trans></Button></VStack>)diff --git a/public/pages/ShowPost/components/NotificationsPanel.tsx b/public/pages/ShowPost/components/NotificationsPanel.tsxindex a9511f204..d299a898e 100644--- a/public/pages/ShowPost/components/NotificationsPanel.tsx+++ b/public/pages/ShowPost/components/NotificationsPanel.tsx@@ -6,6 +6,7 @@ import { useFider } from "@fider/hooks"import IconVolumeOn from "@fider/assets/images/heroicons-volume-on.svg"import IconVolumeOff from "@fider/assets/images/heroicons-volume-off.svg"import { VStack } from "@fider/components/layout"+import { Trans } from "@lingui/macro"interface NotificationsPanelProps {post: Post@@ -31,23 +32,35 @@ export const NotificationsPanel = (props: NotificationsPanelProps) => {const button = subscribed ? (<Button className="w-full" onClick={subscribeOrUnsubscribe}>- <Icon sprite={IconVolumeOff} /> <span>Unsubscribe</span>+ <Icon sprite={IconVolumeOff} />{" "}+ <span>+ <Trans id="label.unsubscribe">Unsubscribe</Trans>+ </span></Button>) : (<Button className="w-full" onClick={subscribeOrUnsubscribe}>- <Icon sprite={IconVolumeOn} /> <span>Subscribe</span>+ <Icon sprite={IconVolumeOn} />+ <span>+ <Trans id="label.subscribe">Subscribe</Trans>+ </span></Button>)const text = subscribed ? (- <span className="text-muted">You’re receiving notifications about activity on this post.</span>+ <span className="text-muted">+ <Trans id="showpost.notificationspanel.message.subscribed">You’re receiving notifications about activity on this post.</Trans>+ </span>) : (- <span className="text-muted">You'll not receive any notification about this post.</span>+ <span className="text-muted">+ <Trans id="showpost.notificationspanel.message.unsubscribed">You'll not receive any notification about this post.</Trans>+ </span>)return (<VStack>- <span className="text-category">Notifications</span>+ <span className="text-category">+ <Trans id="label.notifications">Notifications</Trans>+ </span>{button}{text}</VStack>diff --git a/public/pages/ShowPost/components/PostSearch.tsx b/public/pages/ShowPost/components/PostSearch.tsxindex 84e2e25bd..632c3d23f 100644--- a/public/pages/ShowPost/components/PostSearch.tsx+++ b/public/pages/ShowPost/components/PostSearch.tsx@@ -4,6 +4,7 @@ import { Input, ShowPostStatus } from "@fider/components"import { actions } from "@fider/services"import { Post, PostStatus } from "@fider/models"import { HStack, VStack } from "@fider/components/layout"+import { t, Trans } from "@lingui/macro"interface PostSearchProps {exclude?: number[]@@ -42,13 +43,21 @@ export const PostSearch = (props: PostSearchProps) => {return (<>- <Input field="query" icon={IconSearch} placeholder="Search original post..." value={query} onChange={setQuery} />+ <Input+ field="query"+ icon={IconSearch}+ placeholder={t({ id: "showpost.postsearch.query.placeholder", message: "Search original post..." })}+ value={query}+ onChange={setQuery}+ /><div className="grid gap-2 grid-cols-1 lg:grid-cols-3">{posts.map((p) => (<VStack onClick={selectPost(p)} className={`bg-gray-50 p-4 clickable border-2 rounded ${selectedPost === p ? "border-primary-base" : ""}`} key={p.id}><HStack className="text-2xs"><span>#{p.number}</span> <span>·</span> <ShowPostStatus status={PostStatus.Get(p.status)} /> <span>·</span>{" "}- <span>{p.votesCount} votes</span>+ <span>+ <Trans id="showpost.postsearch.numofvotes">{p.votesCount} votes</Trans>+ </span></HStack><span>{p.title}</span></VStack>diff --git a/public/pages/ShowPost/components/ResponseForm.tsx b/public/pages/ShowPost/components/ResponseForm.tsxindex 1dd3354b9..c41518f39 100644--- a/public/pages/ShowPost/components/ResponseForm.tsx+++ b/public/pages/ShowPost/components/ResponseForm.tsx@@ -6,6 +6,7 @@ import { Post, PostStatus } from "@fider/models"import { actions, Failure } from "@fider/services"import { PostSearch } from "./PostSearch"import IconSpeakerPhone from "@fider/assets/images/heroicons-speakerphone.svg"+import { t, Trans } from "@lingui/macro"interface ResponseFormProps {post: Post@@ -67,14 +68,20 @@ export class ResponseForm extends React.Component<ResponseFormProps, ResponseForpublic render() {const button = (<Button className="w-full" onClick={this.showModal}>- <Icon sprite={IconSpeakerPhone} /> <span>Respond</span>+ <Icon sprite={IconSpeakerPhone} />{" "}+ <span>+ <Trans id="action.respond">Respond</Trans>+ </span></Button>)- const options = PostStatus.All.map((s) => ({- value: s.value.toString(),- label: s.title,- }))+ const options = PostStatus.All.map((s) => {+ const id = `enum.poststatus.${s.value.toString()}`+ return {+ value: s.value.toString(),+ label: t({ id, message: s.title }),+ }+ })const modal = (<Modal.Window isOpen={this.state.showModal} onClose={this.closeModal} center={false} size="large">@@ -87,7 +94,9 @@ export class ResponseForm extends React.Component<ResponseFormProps, ResponseFor<PostSearch exclude={[this.props.post.number]} onChanged={this.setOriginalNumber} /></Field><DisplayError fields={["originalNumber"]} error={this.state.error} />- <span className="text-muted">Votes from this post will be merged into original post.</span>+ <span className="text-muted">+ <Trans id="showpost.responseform.message.mergedvotes">Votes from this post will be merged into original post.</Trans>+ </span></>) : (<TextArea@@ -95,7 +104,10 @@ export class ResponseForm extends React.Component<ResponseFormProps, ResponseForonChange={this.setText}value={this.state.text}minRows={5}- placeholder="What's going on with this post? Let your users know what are your plans..."+ placeholder={t({+ id: "showpost.responseform.text.placeholder",+ message: "What's going on with this post? Let your users know what are your plans...",+ })}/>)}</Form>@@ -103,10 +115,10 @@ export class ResponseForm extends React.Component<ResponseFormProps, ResponseFor<Modal.Footer><Button variant="primary" onClick={this.submit}>- Submit+ <Trans id="action.submit">Submit</Trans></Button><Button variant="tertiary" onClick={this.closeModal}>- Cancel+ <Trans id="action.cancel">Cancel</Trans></Button></Modal.Footer></Modal.Window>diff --git a/public/pages/ShowPost/components/ShowComment.tsx b/public/pages/ShowPost/components/ShowComment.tsxindex 7e3dece0d..3d6f0f018 100644--- a/public/pages/ShowPost/components/ShowComment.tsx+++ b/public/pages/ShowPost/components/ShowComment.tsx@@ -5,6 +5,7 @@ import { HStack } from "@fider/components/layout"import { formatDate, Failure, actions } from "@fider/services"import { useFider } from "@fider/hooks"import IconDotsHorizontal from "@fider/assets/images/heroicons-dots-horizontal.svg"+import { Trans } from "@lingui/macro"interface ShowCommentProps {post: Post@@ -67,19 +68,23 @@ export const ShowComment = (props: ShowCommentProps) => {const modal = () => {return (<Modal.Window isOpen={isDeleteConfirmationModalOpen} onClose={closeModal} center={false} size="small">- <Modal.Header>Delete Comment</Modal.Header>+ <Modal.Header>+ <Trans id="modal.deletecomment.header">Delete Comment</Trans>+ </Modal.Header><Modal.Content><p>- This process is irreversible. <strong>Are you sure?</strong>+ <Trans id="modal.deletecomment.text">+ This process is irreversible. <strong>Are you sure?</strong>+ </Trans></p></Modal.Content><Modal.Footer><Button variant="danger" onClick={deleteComment}>- Delete+ <Trans id="action.delete">Delete</Trans></Button><Button variant="tertiary" onClick={closeModal}>- Cancel+ <Trans id="action.cancel">Cancel</Trans></Button></Modal.Footer></Modal.Window>@@ -109,9 +114,11 @@ export const ShowComment = (props: ShowCommentProps) => {</HStack>{!isEditing && canEditComment() && (<Dropdown position="left" renderHandle={<Icon sprite={IconDotsHorizontal} width="16" height="16" />}>- <Dropdown.ListItem onClick={onActionSelected("edit")}>Edit</Dropdown.ListItem>+ <Dropdown.ListItem onClick={onActionSelected("edit")}>+ <Trans id="action.edit">Edit</Trans>+ </Dropdown.ListItem><Dropdown.ListItem onClick={onActionSelected("delete")} className="text-red-700">- Delete+ <Trans id="action.delete">Delete</Trans></Dropdown.ListItem></Dropdown>)}@@ -123,10 +130,10 @@ export const ShowComment = (props: ShowCommentProps) => {<TextArea field="content" minRows={1} value={newContent} placeholder={comment.content} onChange={setNewContent} /><MultiImageUploader field="attachments" bkeys={comment.attachments} maxUploads={2} onChange={setAttachments} /><Button size="small" onClick={saveEdit} variant="primary">- Save+ <Trans id="action.save">Save</Trans></Button><Button variant="tertiary" size="small" onClick={cancelEdit}>- Cancel+ <Trans id="action.cancel">Cancel</Trans></Button></Form>) : (diff --git a/public/pages/ShowPost/components/TagsPanel.tsx b/public/pages/ShowPost/components/TagsPanel.tsxindex c2208a140..fd6960785 100644--- a/public/pages/ShowPost/components/TagsPanel.tsx+++ b/public/pages/ShowPost/components/TagsPanel.tsx@@ -8,6 +8,7 @@ import { useFider } from "@fider/hooks"import IconPencilAlt from "@fider/assets/images/heroicons-pencil-alt.svg"import IconCheckCircle from "@fider/assets/images/heroicons-check-circle.svg"import { HStack, VStack } from "@fider/components/layout"+import { Trans } from "@lingui/macro"interface TagsPanelProps {post: Post@@ -59,7 +60,9 @@ export const TagsPanel = (props: TagsPanelProps) => {))}</VStack>) : (- <span className="text-muted">None</span>+ <span className="text-muted">+ <Trans id="label.none">None</Trans>+ </span>)const editTagsList = props.tags.length > 0 && (@@ -75,7 +78,10 @@ export const TagsPanel = (props: TagsPanelProps) => {return (<VStack><HStack spacing={2} className="text-category clickable" onClick={onSubtitleClick}>- <span>Tags</span> {icon}+ <span>+ <Trans id="label.tags">Tags</Trans>+ </span>+ {icon}</HStack>{!isEditing && tagsList}diff --git a/public/pages/ShowPost/components/VotesModal.tsx b/public/pages/ShowPost/components/VotesModal.tsxindex 6cf802035..395816469 100644--- a/public/pages/ShowPost/components/VotesModal.tsx+++ b/public/pages/ShowPost/components/VotesModal.tsx@@ -5,6 +5,7 @@ import { actions, Fider } from "@fider/services"import IconSearch from "@fider/assets/images/heroicons-search.svg"import IconX from "@fider/assets/images/heroicons-x.svg"import { HStack, VStack } from "@fider/components/layout"+import { t, Trans } from "@lingui/macro"interface VotesModalProps {isOpen: boolean@@ -72,7 +73,7 @@ export class VotesModal extends React.Component<VotesModalProps, VotesModalStatefield="query"icon={this.state.query ? IconX : IconSearch}onIconClick={this.state.query ? this.clearSearch : undefined}- placeholder="Search for users by name..."+ placeholder={t({ id: "modal.showvotes.query.placeholder", message: "Search for users by name..." })}value={this.state.query}onChange={this.handleSearchFilterChanged}/>@@ -91,7 +92,11 @@ export class VotesModal extends React.Component<VotesModalProps, VotesModalState</span></HStack>))}- {this.state.filteredVotes.length === 0 && <p className="text-muted">No users found matching '{this.state.query}'.</p>}+ {this.state.filteredVotes.length === 0 && (+ <p className="text-muted">+ <Trans id="modal.showvotes.message.zeromatches">No users found matching '{this.state.query}'.</Trans>+ </p>+ )}</VStack></>)}@@ -99,7 +104,7 @@ export class VotesModal extends React.Component<VotesModalProps, VotesModalState<Modal.Footer><Button variant="tertiary" onClick={this.closeModal}>- Close+ <Trans id="action.close">Close</Trans></Button></Modal.Footer></Modal.Window>diff --git a/public/pages/ShowPost/components/VotesPanel.tsx b/public/pages/ShowPost/components/VotesPanel.tsxindex c9985f8dc..5799de4d5 100644--- a/public/pages/ShowPost/components/VotesPanel.tsx+++ b/public/pages/ShowPost/components/VotesPanel.tsx@@ -5,6 +5,7 @@ import { Fider } from "@fider/services"import { useFider } from "@fider/hooks"import { VotesModal } from "./VotesModal"import { HStack, VStack } from "@fider/components/layout"+import { Trans } from "@lingui/macro"interface VotesPanelProps {post: Post@@ -29,20 +30,26 @@ export const VotesPanel = (props: VotesPanelProps) => {return (<VStack><VotesModal post={props.post} isOpen={isVotesModalOpen} onClose={closeModal} />- <span className="text-category">Voters</span>+ <span className="text-category">+ <Trans id="label.voters">Voters</Trans>+ </span><HStack>{props.votes.length > 0 && <AvatarStack users={props.votes.map((x) => x.user)} />}{extraVotesCount > 0 && (<Button variant="tertiary" disabled={!canShowAll} size="small" onClick={openModal}>- +{extraVotesCount} more+ <Trans id="showpost.votespanel.more">+{extraVotesCount} more</Trans></Button>)}{props.votes.length > 0 && extraVotesCount === 0 && canShowAll && (<Button variant="tertiary" size="small" disabled={!canShowAll} onClick={openModal}>- see details+ <Trans id="showpost.votespanel.seedetails">see details</Trans></Button>)}- {props.votes.length === 0 && <span className="text-muted">None</span>}+ {props.votes.length === 0 && (+ <span className="text-muted">+ <Trans id="label.none">None</Trans>+ </span>+ )}</HStack></VStack>)diff --git a/public/pages/SignIn/SignIn.page.tsx b/public/pages/SignIn/SignIn.page.tsxindex b737d7c8a..0068c052b 100644--- a/public/pages/SignIn/SignIn.page.tsx+++ b/public/pages/SignIn/SignIn.page.tsx@@ -1,22 +1,27 @@import React from "react"import { SignInControl, TenantLogo, LegalNotice } from "@fider/components"import { notify, Fider } from "@fider/services"+import { Trans } from "@lingui/macro"const Locked = (): JSX.Element => (<><p className="text-title">- <strong>{Fider.session.tenant.name}</strong> is currently locked.+ <Trans id="signin.message.locked.title">+ <strong>{Fider.session.tenant.name}</strong> is currently locked.+ </Trans></p>- <p>To reactivate this site, sign in with an administrator account and update the required settings.</p>+ <Trans id="signin.message.locked.text">To reactivate this site, sign in with an administrator account and update the required settings.</Trans></>)const Private = (): JSX.Element => (<><p className="text-title">- <strong>{Fider.session.tenant.name}</strong> is a private space and requires an invitation to join it.+ <Trans id="signin.message.private.title">+ <strong>{Fider.session.tenant.name}</strong> is a private space and requires an invitation to join it.+ </Trans></p>- <p>If you have an account or an invitation, you may use following options to sign in.</p>+ <Trans id="signin.message.private.text">If you have an account or an invitation, you may use following options to sign in.</Trans></>)@@ -24,7 +29,9 @@ export default class SignInPage extends React.Component<any, any> {private onEmailSent = (email: string) => {notify.success(<span>- We have just sent a confirmation link to <b>{email}</b>. Click the link and you’ll be signed in.+ <Trans id="signin.message.emailsent">+ We have just sent a confirmation link to <b>{email}</b>. Click the link and you’ll be signed in.+ </Trans></span>)}diff --git a/public/services/i18n.ts b/public/services/i18n.tsindex e0899e234..40c658f0f 100644--- a/public/services/i18n.ts+++ b/public/services/i18n.ts@@ -1,10 +1,11 @@import { i18n, I18n } from "@lingui/core"-import { en, pt } from "make-plural/plurals"+import { en, pt, fr } from "make-plural/plurals"export function activateI18NSync(locale: string, messages?: any): I18n {i18n._missing = (_, key) => `⚠️ Missing Translation: ${key}`i18n.loadLocaleData("en", { plurals: en })i18n.loadLocaleData("pt-BR", { plurals: pt })+ i18n.loadLocaleData("fr", { plurals: fr })i18n.load(locale, messages)i18n.activate(locale)return i18ndiff --git a/public/services/utils.ts b/public/services/utils.tsindex 062ef7aa5..37dac1cfc 100644--- a/public/services/utils.ts+++ b/public/services/utils.ts@@ -34,7 +34,7 @@ export const formatDate = (locale: string, input: Date | string, format: DateForexport const timeSince = (locale: string, now: Date, date: Date): string => {try {- const seconds = (now.getTime() - date.getTime()) / 1000+ const seconds = Math.round((now.getTime() - date.getTime()) / 1000)const minutes = Math.round(seconds / 60)const hours = Math.round(minutes / 60)const days = Math.round(hours / 24)diff --git a/public/ssr.tsx b/public/ssr.tsxindex 89d2d5669..5ecdc56ba 100644--- a/public/ssr.tsx+++ b/public/ssr.tsx@@ -18,6 +18,7 @@ import { I18nProvider } from "@lingui/react"const messages: { [key: string]: any } = {en: require(`../locale/en/client`),"pt-BR": require(`../locale/pt-BR/client`),+ fr: require(`../locale/fr/client`),}// Only public routes should be here