diff --git a/jam-ui/src/components/page/JKEditProfile.js b/jam-ui/src/components/page/JKEditProfile.js index 206d6f4fc..9f03b6afe 100644 --- a/jam-ui/src/components/page/JKEditProfile.js +++ b/jam-ui/src/components/page/JKEditProfile.js @@ -18,7 +18,7 @@ import { function JKEditProfile() { - const { t } = useTranslation(); + const { t } = useTranslation('profile'); const { currentUser } = useAuth(); const [musicInstruments, setMusicInstruments] = useState([]); const [genres, setGenres] = useState([]); @@ -36,9 +36,9 @@ function JKEditProfile() { const regionRef = useRef(null); const PROFICIENCIES = [ - { value: '1', label: 'Beginner' }, - { value: '2', label: 'Intermediate' }, - { value: '3', label: 'Advanced' } + { value: '1', label: t('profeciency.beginner') }, + { value: '2', label: t('profeciency.intermediate') }, + { value: '3', label: t('profeciency.advanced') } ]; const { register, control, handleSubmit, setValue, getValues } = useForm({ @@ -377,13 +377,13 @@ function JKEditProfile() { -
Basics
+
{t('basics')}
- + - + @@ -431,7 +431,7 @@ function JKEditProfile() { - + {countries.length > 0 && ( - + {regions.length > 0 && ( - + - + @@ -538,7 +538,7 @@ function JKEditProfile() { -
Interests
+
{t('interests')}
@@ -557,7 +557,7 @@ function JKEditProfile() { )} /> @@ -576,7 +576,7 @@ function JKEditProfile() { )} /> @@ -595,7 +595,7 @@ function JKEditProfile() { )} /> @@ -604,7 +604,7 @@ function JKEditProfile() { -
Instruments
+
{t('instruments')}
@@ -647,7 +647,7 @@ function JKEditProfile() {
-
Genres
+
{t('genres')}
diff --git a/jam-ui/src/components/profile/JKEditEmail.js b/jam-ui/src/components/profile/JKEditEmail.js index 296ead950..3338c3101 100644 --- a/jam-ui/src/components/profile/JKEditEmail.js +++ b/jam-ui/src/components/profile/JKEditEmail.js @@ -1,6 +1,5 @@ import React, { useState, useEffect } from 'react'; import { - Card, CardHeader, CardBody, @@ -50,7 +49,7 @@ const JKEditEmail = ({setAlert, toggleAlert}) => { const { new_email, current_password } = data; postUpdateAccountEmail(currentUser.id, { email: new_email, current_password }) .then(response => { - setAlert('A confirmation email has been sent to your email. Please check your email and click the link to confirm your new email address.'); + setAlert(t('identity.email_form.alerts.confirmation_email_sent')); setValue('current_password', ''); setValue('new_email', ''); toggleAlert() @@ -64,7 +63,7 @@ const JKEditEmail = ({setAlert, toggleAlert}) => { errors.current_password.forEach(error => { setError('current_password', { type: 'manual', - message: `Current password ${error}` + message: `${t('identity.email_form.current_password')} ${error}` }) }) } @@ -72,7 +71,7 @@ const JKEditEmail = ({setAlert, toggleAlert}) => { errors.update_email.forEach(error => { setError('new_email', { type: 'manual', - message: `New email ${error}` + message: `${t('identity.email_form.new_email')} ${error}` }) }) } @@ -87,21 +86,20 @@ const JKEditEmail = ({setAlert, toggleAlert}) => { return ( -
Email
+
{t('identity.email_form.title')}
- To update the email associated with your account, enter your current password (for security reasons) and the - new email, and click the "Save Email" button. + {t('identity.email_form.help_text')}
- + ( { type={showEmailPassword ? 'text' : 'password'} className="form-control" id="current_password" - placeholder="Current Password" + placeholder={t('identity.email_form.current_password')} /> { {errors.current_password &&
{errors.current_password.message}
}
- + ( @@ -144,14 +142,14 @@ const JKEditEmail = ({setAlert, toggleAlert}) => { type="email" className="form-control" id="new_email" - placeholder={user ? user.email : 'New Email'} + placeholder={user ? user.email : t('identity.email_form.new_email')} /> )} /> {errors.new_email &&
{errors.new_email.message}
}
- + { submitting && } diff --git a/jam-ui/src/components/profile/JKEditPassword.js b/jam-ui/src/components/profile/JKEditPassword.js index 55f199d81..0faec81cf 100644 --- a/jam-ui/src/components/profile/JKEditPassword.js +++ b/jam-ui/src/components/profile/JKEditPassword.js @@ -40,7 +40,7 @@ const JKEditPassword = ({ setAlert, toggleAlert }) => { const { new_password, current_password } = data; postUpdateAccountPassword(currentUser.id, { current_password, new_password }) .then(response => { - setAlert('Your password has been successfully updated.'); + setAlert(t('identity.password_form.alerts.updated')); setValue('current_password', ''); setValue('new_password', ''); toggleAlert(); @@ -55,7 +55,7 @@ const JKEditPassword = ({ setAlert, toggleAlert }) => { errors.current_password.forEach(error => { setError('current_password', { type: 'manual', - message: `Current password ${error}` + message: `${t('identity.password_form.current_password')} ${error}` }); }); } @@ -63,7 +63,7 @@ const JKEditPassword = ({ setAlert, toggleAlert }) => { errors.password.forEach(error => { setError('new_password', { type: 'manual', - message: `New password ${error}` + message: `${t('identity.password_form.new_password')} ${error}` }); }); } @@ -81,9 +81,7 @@ const JKEditPassword = ({ setAlert, toggleAlert }) => { } try { await requestPasswordReset(currentUser.id); - setAlert( - 'A password reset email has been sent to your email. Please check your email and click the link to reset your password.' - ); + setAlert(t('identity.password_form.alerts.password_reset_email_sent')); toggleAlert(); } catch (error) { console.log(error); @@ -97,17 +95,16 @@ const JKEditPassword = ({ setAlert, toggleAlert }) => { - To update the password associated with your account, enter your current password (for security reasons) and - the new password, and click the "Save Password" button. + {t('identity.password_form.help_text')} - + ( { type={showPassword ? 'text' : 'password'} className="form-control" id="current_password" - placeholder="Current Password" + placeholder={t('identity.password_form.current_password')} /> { - + ( { )}
- + {submitting && }
- If you can not remember your current password, Click here to reset - your password, and you will receive an email with instructions on how to reset your password to the email - address associated with your JamKazam account. + {t('identity.password_form.forgot_password.help_text_p1')} {t('identity.password_form.forgot_password.click_here')} {t('identity.password_form.forgot_password.help_text_p2')}
diff --git a/jam-ui/src/i18n/locales/en/account.json b/jam-ui/src/i18n/locales/en/account.json index a78f96aae..99ce0c134 100644 --- a/jam-ui/src/i18n/locales/en/account.json +++ b/jam-ui/src/i18n/locales/en/account.json @@ -5,7 +5,54 @@ "update_notification": { "title": "Account Identity Updated" } + }, + "email_form": { + "title": "Email", + "help_text": "To update the email associated with your account, enter your current password (for security reasons) and the new email, and click the \"Save Email\" button.", + "current_password": "Current Password", + "new_email": "New Email", + "submit": "Save Email", + "validations": { + "new_email": { + "required": "New Email is required", + "pattern": "Email is invalid" + }, + "current_password": { + "required": "Current password is required" + } + }, + "alerts": { + "updated": "Your account identity has been updated.", + "confirmation_email_sent": "A confirmation email has been sent to your email address. Please click the link in the email to confirm your email address." + + } + }, + "password_form": { + "title": "Password", + "help_text": "To update the password associated with your account, enter your current password (for security reasons) and the new password, and click the \"Save Password\" button.", + "current_password": "Current Password", + "new_password": "New Password", + "submit": "Save Password", + "validations": { + "new_password": { + "required": "New Password is required", + "pattern": "Password must be at least 8 characters long" + }, + "current_password": { + "required": "Current password is required" + } + }, + "alerts": { + "updated": "Your password has been successfully updated.", + "password_reset_email_sent": "A password reset email has been sent to your email. Please check your email and click the link to reset your password." + }, + "forgot_password": { + "help_text_p1": "If you can not remember your current password", + "click_here": "click here", + "help_text_p2": "to reset your password, and you will receive an email with instructions on how to reset your password to the email address associated with your JamKazam account." + } } + } } \ No newline at end of file diff --git a/jam-ui/src/i18n/locales/en/profile.json b/jam-ui/src/i18n/locales/en/profile.json index 2eade7bb7..3c0a61c4e 100644 --- a/jam-ui/src/i18n/locales/en/profile.json +++ b/jam-ui/src/i18n/locales/en/profile.json @@ -1,3 +1,23 @@ { - "page_title": "Profile" + "page_title": "Profile", + "profeciency": { + "beginner": "Beginner", + "intermediate": "Intermediate", + "advanced": "Advanced" + }, + "basics": "Basics", + "interests": "Interests", + "instruments": "Instruments", + "genres": "Genres", + "first_name": "First Name", + "last_name": "Last Name", + "change_photo": "Change Photo", + "country": "Country", + "state": "State/Province", + "city": "City", + "musical_biography": "Musical Biography", + "accept_emails": "Accept emails from JamKazam about the JamKazam services", + "interest_joining_virtual_band": "I'm interested in joining a virtual/online band", + "interest_joining_in_person_band": "I'm interested in joining an in-person band", + "interest_cowriting_songs": "I'm interested in co-writing songs with others" }