0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-18 13:04:38 -05:00

🌐 Add translations of login/registration/...

This commit is contained in:
mathieu.brunot 2019-02-21 15:36:50 +01:00
parent f44b9a0fc8
commit 4b1bd3d132
No known key found for this signature in database
GPG key ID: 81584BEAF692D7E0
7 changed files with 95 additions and 35 deletions

View file

@ -89,13 +89,41 @@
"ds.user.notifications" "Notifications" "ds.user.notifications" "Notifications"
"ds.user.exit" "Exit" "ds.user.exit" "Exit"
"auth.email-or-username" "Email or Username"
"auth.password" "Password"
"auth.signin" "Sign in"
"auth.forgot-password" "Forgot your password?"
"auth.no-account" "Don't have an account?"
"auth.message.recovery-token-sent" "Password recovery link sent to your inbox." "auth.message.recovery-token-sent" "Password recovery link sent to your inbox."
"auth.message.password-recovered" "Password successfully recovered." "auth.message.password-recovered" "Password successfully recovered."
"register.fullname.placeholder" "Full Name"
"register.username.placeholder" "Username"
"register.email.placeholder" "Email"
"register.password.placeholder" "Password"
"register.get-started" "Get started"
"register.already-have-account" "Already have an account?"
"recovery-request.username-or-email.placeholder" "username or email address"
"recovery-request.recover-password" "Recover password"
"recovery-request.go-back" "Go back!"
"recover.password.placeholder" "Password"
"recover.recover-password" "Recover password"
"recover.go-back" "Go back!"
"settings.profile" "PROFILE" "settings.profile" "PROFILE"
"settings.password" "PASSWORD" "settings.password" "PASSWORD"
"settings.notifications" "NOTIFICATIONS" "settings.notifications" "NOTIFICATIONS"
"settings.profile-saved" "Profile saved successfully!" "settings.profile-saved" "Profile saved successfully!"
"settings.name-username-email" "Name, username and email"
"settings.your-name" "Your name"
"settings.your-username" "Your username"
"settings.your-email" "Your email"
"settings.light-theme" "Light theme"
"settings.dark-theme" "Dark theme"
"settings.high-contrast-theme" "High-contrast theme"
"settings.your-avatar" "Your avatar"
"settings.password-saved" "Password saved successfully!" "settings.password-saved" "Password saved successfully!"
"settings.wrong-old-password" "Wrong old password" "settings.wrong-old-password" "Wrong old password"
"settings.change-password" "Change password" "settings.change-password" "Change password"

View file

@ -89,13 +89,41 @@
"ds.user.notifications" "Notifications" "ds.user.notifications" "Notifications"
"ds.user.exit" "Quitter" "ds.user.exit" "Quitter"
"auth.message.recovery-token-sent" "Password recovery link sent to your inbox." "auth.email-or-username" "adresse email ou nom d'utilisateur"
"auth.message.password-recovered" "Password successfully recovered." "auth.password" "Mot de passe"
"auth.signin" "Se connecter"
"auth.forgot-password" "Mot de passe oublié ?"
"auth.no-account" "Vous n'avez pas de compte ?"
"auth.message.recovery-token-sent" "Lien de récupération de mot de passe envoyé."
"auth.message.password-recovered" "Mot de passe récupéré avec succès."
"register.fullname.placeholder" "Nom complet"
"register.username.placeholder" "Nom d'utilisateur"
"register.email.placeholder" "Adresse email"
"register.password.placeholder" "Mot de passe"
"register.get-started" "Commencer"
"register.already-have-account" "Vous avez déjà un compte ?"
"recovery-request.username-or-email.placeholder" "nom d'utilisateur ou adresse email"
"recovery-request.recover-password" "Récupérer le mot de passe"
"recovery-request.go-back" "Retour!"
"recover.password.placeholder" "Mot de passe"
"recover.recover-password" "Récupérer le mot de passe"
"recover.go-back" "Retour!"
"settings.profile" "PROFIL" "settings.profile" "PROFIL"
"settings.password" "MOT DE PASSE" "settings.password" "MOT DE PASSE"
"settings.notifications" "NOTIFICATIONS" "settings.notifications" "NOTIFICATIONS"
"settings.profile-saved" "Profil enregistré avec succès !" "settings.profile-saved" "Profil enregistré avec succès !"
"settings.name-username-email" "Nom, nom d'utilisateur et adresse email"
"settings.your-name" "Votre nom complet"
"settings.your-username" "Votre nom d'utilisateur"
"settings.your-email" "Votre adresse email"
"settings.light-theme" "Thème Jour"
"settings.dark-theme" "Thème Nuit"
"settings.high-contrast-theme" "Thème Contraste élevé"
"settings.your-avatar" "Votre avatar"
"settings.password-saved" "Mot de passe enregistré avec succès !" "settings.password-saved" "Mot de passe enregistré avec succès !"
"settings.wrong-old-password" "Ancien mot de passe incorrect" "settings.wrong-old-password" "Ancien mot de passe incorrect"
"settings.change-password" "Changement de mot de passe" "settings.change-password" "Changement de mot de passe"

View file

@ -15,6 +15,7 @@
[uxbox.main.data.auth :as da] [uxbox.main.data.auth :as da]
[uxbox.main.ui.messages :refer [messages-widget]] [uxbox.main.ui.messages :refer [messages-widget]]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.i18n :refer (tr)]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[rumext.core :as mx :include-macros true] [rumext.core :as mx :include-macros true]
@ -61,7 +62,7 @@
:ref "email" :ref "email"
:value (:username data "") :value (:username data "")
:on-change #(on-change % :username) :on-change #(on-change % :username)
:placeholder "Email or Username" :placeholder (tr "auth.email-or-username")
:type "text"}] :type "text"}]
[:input.input-text [:input.input-text
{:name "password" {:name "password"
@ -69,22 +70,22 @@
:ref "password" :ref "password"
:value (:password data "") :value (:password data "")
:on-change #(on-change % :password) :on-change #(on-change % :password)
:placeholder "Password" :placeholder (tr "auth.password")
:type "password"}] :type "password"}]
[:input.btn-primary [:input.btn-primary
{:name "login" {:name "login"
:tab-index "4" :tab-index "4"
:class (when-not valid? "btn-disabled") :class (when-not valid? "btn-disabled")
:disabled (not valid?) :disabled (not valid?)
:value "Sign in" :value (tr "auth.signin")
:type "submit"}] :type "submit"}]
[:div.login-links [:div.login-links
[:a {:on-click #(st/emit! (rt/navigate :auth/recovery-request)) [:a {:on-click #(st/emit! (rt/navigate :auth/recovery-request))
:tab-index "5"} :tab-index "5"}
"Forgot your password?"] (tr "auth.forgot-password")]
[:a {:on-click #(st/emit! (rt/navigate :auth/register)) [:a {:on-click #(st/emit! (rt/navigate :auth/register))
:tab-index "6"} :tab-index "6"}
"Don't have an account?"]]]]))) (tr "auth.no-account")]]]])))
(mx/defc login-page (mx/defc login-page
{:mixins [mx/static (fm/clear-mixin st/store :login)] {:mixins [mx/static (fm/clear-mixin st/store :login)]

View file

@ -14,6 +14,7 @@
[uxbox.main.data.auth :as uda] [uxbox.main.data.auth :as uda]
[uxbox.main.ui.messages :refer [messages-widget]] [uxbox.main.ui.messages :refer [messages-widget]]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.i18n :refer (tr)]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[rumext.core :as mx :include-macros true] [rumext.core :as mx :include-macros true]
@ -50,16 +51,16 @@
{:name "password" {:name "password"
:value (:password data "") :value (:password data "")
:on-change (partial on-change :password) :on-change (partial on-change :password)
:placeholder "Password" :placeholder (tr "recover.password.placeholder")
:type "password"}] :type "password"}]
[:input.btn-primary [:input.btn-primary
{:name "login" {:name "login"
:class (when-not valid? "btn-disabled") :class (when-not valid? "btn-disabled")
:disabled (not valid?) :disabled (not valid?)
:value "Recover password" :value (tr "recover.recover-password")
:type "submit"}] :type "submit"}]
[:div.login-links [:div.login-links
[:a {:on-click #(st/emit! (rt/navigate :auth/login))} "Go back!"]]]]))) [:a {:on-click #(st/emit! (rt/navigate :auth/login))} (tr "recover.go-back")]]]])))
;; --- Recovery Page ;; --- Recovery Page

View file

@ -14,6 +14,7 @@
[uxbox.main.data.auth :as uda] [uxbox.main.data.auth :as uda]
[uxbox.main.ui.messages :refer [messages-widget]] [uxbox.main.ui.messages :refer [messages-widget]]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.i18n :refer (tr)]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[rumext.core :as mx :include-macros true] [rumext.core :as mx :include-macros true]
@ -47,16 +48,16 @@
{:name "username" {:name "username"
:value (:username data "") :value (:username data "")
:on-change on-change :on-change on-change
:placeholder "username or email address" :placeholder (tr "recovery-request.username-or-email.placeholder")
:type "text"}] :type "text"}]
[:input.btn-primary [:input.btn-primary
{:name "login" {:name "login"
:class (when-not valid? "btn-disabled") :class (when-not valid? "btn-disabled")
:disabled (not valid?) :disabled (not valid?)
:value "Recover password" :value (tr "recovery-request.recover-password")
:type "submit"}] :type "submit"}]
[:div.login-links [:div.login-links
[:a {:on-click #(st/emit! (rt/navigate :auth/login))} "Go back!"]]]]))) [:a {:on-click #(st/emit! (rt/navigate :auth/login))} (tr "recovery-request.go-back")]]]])))
;; --- Recovery Request Page ;; --- Recovery Request Page

View file

@ -14,6 +14,7 @@
[uxbox.main.data.auth :as uda] [uxbox.main.data.auth :as uda]
[uxbox.main.ui.messages :refer [messages-widget]] [uxbox.main.ui.messages :refer [messages-widget]]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.i18n :refer (tr)]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[rumext.core :as mx :include-macros true] [rumext.core :as mx :include-macros true]
@ -52,11 +53,11 @@
(on-error [{:keys [type code] :as payload}] (on-error [{:keys [type code] :as payload}]
(case code (case code
:uxbox.services.users/registration-disabled :uxbox.services.users/registration-disabled
(st/emit! "Registration is disabled") (st/emit! (tr "errors.api.form.registration-disabled"))
:uxbox.services.users/email-already-exists :uxbox.services.users/email-already-exists
(st/emit! (assoc-error :email "Email already exists")) (st/emit! (assoc-error :email (tr "errors.api.form.email-already-exists"))
:uxbox.services.users/username-already-exists :uxbox.services.users/username-already-exists
(st/emit! (assoc-error :username "Username already exists")))) (st/emit! (assoc-error :username (tr "errors.api.form.username-already-exists"))))
(on-submit [event] (on-submit [event]
(dom/prevent-default event) (dom/prevent-default event)
(st/emit! (uda/register data on-error)))] (st/emit! (uda/register data on-error)))]
@ -67,7 +68,7 @@
:tab-index "2" :tab-index "2"
:value (:fullname data "") :value (:fullname data "")
:on-change (partial on-change :fullname) :on-change (partial on-change :fullname)
:placeholder "Full Name" :placeholder (tr "register.fullname.placeholder")
:type "text"}] :type "text"}]
(fm/input-error errors :fullname) (fm/input-error errors :fullname)
@ -76,7 +77,7 @@
:tab-index "3" :tab-index "3"
:value (:username data "") :value (:username data "")
:on-change (partial on-change :username) :on-change (partial on-change :username)
:placeholder "Username" :placeholder (tr "register.username.placeholder")
:type "text"}] :type "text"}]
(fm/input-error errors :username) (fm/input-error errors :username)
@ -86,7 +87,7 @@
:ref "email" :ref "email"
:value (:email data "") :value (:email data "")
:on-change (partial on-change :email) :on-change (partial on-change :email)
:placeholder "Email" :placeholder (tr "register.email.placeholder")
:type "text"}] :type "text"}]
(fm/input-error errors :email) (fm/input-error errors :email)
@ -96,7 +97,7 @@
:ref "password" :ref "password"
:value (:password data "") :value (:password data "")
:on-change (partial on-change :password) :on-change (partial on-change :password)
:placeholder "Password" :placeholder (tr "register.password.placeholder")
:type "password"}] :type "password"}]
(fm/input-error errors :password) (fm/input-error errors :password)
@ -105,10 +106,10 @@
:tab-index "6" :tab-index "6"
:class (when-not valid? "btn-disabled") :class (when-not valid? "btn-disabled")
:disabled (not valid?) :disabled (not valid?)
:value "Get started" :value (tr "register.get-started")
:type "submit"}] :type "submit"}]
[:div.login-links [:div.login-links
[:a {:on-click #(st/emit! (rt/navigate :auth/login))} "Already have an account?"]]]]))) [:a {:on-click #(st/emit! (rt/navigate :auth/login))} (tr "register.already-have-account")]]]])))
;; --- Register Page ;; --- Register Page

View file

@ -61,37 +61,37 @@
(on-error [{:keys [code] :as payload}] (on-error [{:keys [code] :as payload}]
(case code (case code
:uxbox.services.users/registration-disabled :uxbox.services.users/registration-disabled
(st/emit! "Registration is disabled") (st/emit! (tr "errors.api.form.registration-disabled"))
:uxbox.services.users/email-already-exists :uxbox.services.users/email-already-exists
(st/emit! (assoc-error :email "Email already exists")) (st/emit! (assoc-error :email (tr "errors.api.form.email-already-exists")))
:uxbox.services.users/username-already-exists :uxbox.services.users/username-already-exists
(st/emit! (assoc-error :username "Username already exists")))) (st/emit! (assoc-error :username (tr "errors.api.form.username-already-exists")))))
(on-success [_] (on-success [_]
(st/emit! (clear-form))) (st/emit! (clear-form)))
(on-submit [event] (on-submit [event]
(st/emit! (udu/update-profile data on-success on-error)))] (st/emit! (udu/update-profile data on-success on-error)))]
[:form.profile-form [:form.profile-form
[:span.user-settings-label "Name, username and email"] [:span.user-settings-label (tr "settings.name-username-email")]
[:input.input-text [:input.input-text
{:type "text" {:type "text"
:on-change (partial on-change :fullname) :on-change (partial on-change :fullname)
:value (:fullname data "") :value (:fullname data "")
:placeholder "Your name"}] :placeholder (tr "settings.your-name")}]
[:input.input-text [:input.input-text
{:type "text" {:type "text"
:on-change (partial on-change :username) :on-change (partial on-change :username)
:value (:username data "") :value (:username data "")
:placeholder "Your username"}] :placeholder (tr "settings.your-username")}]
(fm/input-error errors :username) (fm/input-error errors :username)
[:input.input-text [:input.input-text
{:type "email" {:type "email"
:on-change (partial on-change :email) :on-change (partial on-change :email)
:value (:email data "") :value (:email data "")
:placeholder "Your email"}] :placeholder (tr "settings.your-email")}]
(fm/input-error errors :email) (fm/input-error errors :email)
#_[:span.user-settings-label "Choose a color theme"] #_[:span.user-settings-label (tr "settings.choose-color-theme")]
#_[:div.input-radio.radio-primary #_[:div.input-radio.radio-primary
[:input {:type "radio" [:input {:type "radio"
:checked (when (= theme "light") "checked") :checked (when (= theme "light") "checked")
@ -99,7 +99,7 @@
:id "light-theme" :id "light-theme"
:name "theme" :name "theme"
:value "light"}] :value "light"}]
[:label {:for "light-theme"} "Light theme"] [:label {:for "light-theme"} (tr "settings.light-theme")]
[:input {:type "radio" [:input {:type "radio"
:checked (when (= theme "dark") "checked") :checked (when (= theme "dark") "checked")
@ -107,7 +107,7 @@
:id "dark-theme" :id "dark-theme"
:name "theme" :name "theme"
:value "dark"}] :value "dark"}]
[:label {:for "dark-theme"} "Dark theme"] [:label {:for "dark-theme"} (tr "settings.dark-theme")]
[:input {:type "radio" [:input {:type "radio"
:checked (when (= theme "high-contrast") "checked") :checked (when (= theme "high-contrast") "checked")
@ -115,14 +115,14 @@
:id "high-contrast-theme" :id "high-contrast-theme"
:name "theme" :name "theme"
:value "high-contrast"}] :value "high-contrast"}]
[:label {:for "high-contrast-theme"} "High-contrast theme"]] [:label {:for "high-contrast-theme"} (tr "settings.high-contrast-theme")]]
[:input.btn-primary [:input.btn-primary
{:type "button" {:type "button"
:class (when-not valid? "btn-disabled") :class (when-not valid? "btn-disabled")
:disabled (not valid?) :disabled (not valid?)
:on-click on-submit :on-click on-submit
:value "Update settings"}]]))) :value (tr "settings.update-settings")}]])))
;; --- Profile Photo Form ;; --- Profile Photo Form
@ -156,6 +156,6 @@
(header) (header)
[:section.dashboard-content.user-settings [:section.dashboard-content.user-settings
[:section.user-settings-content [:section.user-settings-content
[:span.user-settings-label "Your avatar"] [:span.user-settings-label (tr "settings.your-avatar")]
(profile-photo-form) (profile-photo-form)
(profile-form)]]]) (profile-form)]]])