add language translation keys to session pages

This commit is contained in:
Nuwan 2024-02-14 17:31:30 +05:30
parent fd9632a26c
commit 6546cc08bc
8 changed files with 169 additions and 26 deletions

View File

@ -25,7 +25,7 @@ function JKMusicSessionsLobby() {
const INTERACTION_PAGE_ENTER = 'page:enter';
const INTERACTION_PAGE_EXIT = 'page:exit';
const { t } = useTranslation();
const { t } = useTranslation('sessions');
const { greaterThan } = useResponsive();
const dispatch = useDispatch();
const { currentUser } = useAuth();
@ -137,7 +137,7 @@ function JKMusicSessionsLobby() {
try {
if (!window.Notification) {
console.log('Your web browser does not support notifications.');
alert('Your web browser does not support notifications.');
alert(t('lobby.chat_notifications.browser_not_supported', { ns: 'sessions' }));
} else {
// check if permission is already granted
if (Notification.permission === 'granted') {
@ -149,7 +149,7 @@ function JKMusicSessionsLobby() {
if (p === 'granted') {
updateUser(currentUser.id, { accept_desktop_notifications: true }).then(() => {
console.log('User granted permission for desktop notifications');
new Notification('Lobby Chat Notifications', {
new Notification(t('lobby.chat_notifications.title'), {
body: 'Notifications will appear here.',
});
localStorage.setItem('showLobbyChatNotifications', true);
@ -185,9 +185,7 @@ function JKMusicSessionsLobby() {
<h5 className="mb-0 mr-1">{t('lobby.page_title', { ns: 'sessions' })}</h5>
<JKTooltip
placement="top"
title="
The Lobby shows all users who: 1) are currently on this page; or 2) have this page open in a tab in their browser and have given us permission to send browser notifications; or 3) have the JamKazam app running but arent currently in sessions, and have given us permission to send browser notifications. Use the Lobby to see what other users are currently online but not in sessions. You can message other users to see if they want to join a session with you, and use checkboxes plus the Create Session & Invite Selected Users button to get a session started with other Lobby users.
"
title={t('lobby.page_title_tooltip')}
/>
</div>
{greaterThan.sm && (
@ -198,7 +196,7 @@ function JKMusicSessionsLobby() {
onClick={handleClick}
disabled={submitted || selectedUsers.length === 0}
>
Create Session & Invite Selected Users
{t('lobby.create_session_button', { ns: 'sessions' })}
</Button>
</div>
)}
@ -225,12 +223,12 @@ function JKMusicSessionsLobby() {
<Nav tabs>
<NavItem>
<NavLink style={{ cursor: 'pointer'}} className={ activeTab === '1' ? 'active' : null } onClick={() => setActiveTab('1')}>
Users
{t('lobby.users.title', { ns: 'sessions' })}
</NavLink>
</NavItem>
<NavItem>
<NavLink style={{ cursor: 'pointer'}} className={ activeTab === '2' ? 'active' : null } onClick={() => setActiveTab('2')}>
Chat
{t('lobby.chat.title', { ns: 'sessions' })}
</NavLink>
</NavItem>
</Nav>

View File

@ -28,6 +28,8 @@ function JKLobbyChat() {
const [messagesArrived, setMessagesArrived] = useState(false);
//const [offset, setOffset] = useState(0);
const { t } = useTranslation('sessions');
const chatMessages = useSelector(state => state.lobbyChat.records.messages);
const next = useSelector(state => state.lobbyChat.records.next);
const createStatus = useSelector(state => state.lobbyChat.create_status);
@ -192,7 +194,7 @@ function JKLobbyChat() {
{messagesArrived && (
<div className="d-flex justify-content-center">
<Button color="info" size="sm" onClick={() => setMessagesArrived(prev => !prev)}>
New messages
{t('lobby.chat.new_messages')}
</Button>
</div>
)}
@ -208,7 +210,7 @@ function JKLobbyChat() {
</div>
<div className="d-flex justify-content-end" style={{ height: '10%' }}>
<Button color="primary" onClick={sendMessage} disabled={!newMessage}>
Send Message
{t('lobby.chat.send')}
</Button>
</div>
</div>

View File

@ -6,7 +6,7 @@ import { isIterableArray } from '../../helpers/utils';
import Loader from '../common/Loader';
function JKLobbyUserList({ loadingStatus, onlineMusicians, selectedUsers, setSelectedUsers }) {
const { t } = useTranslation();
const { t } = useTranslation('sessions');
return (
<>
@ -17,10 +17,10 @@ function JKLobbyUserList({ loadingStatus, onlineMusicians, selectedUsers, setSel
<thead className="bg-200 text-900">
<tr>
<th width="75%" scope="col">
{t('lobby.header.musician', { ns: 'sessions' })}
{t('lobby.users.header.musician', { ns: 'sessions' })}
</th>
<th scope="col" className="text-center">
{t('actions', { ns: 'common' })}
{t('lobby.users.header.actions', { ns: 'sessions' })}
</th>
</tr>
</thead>
@ -29,7 +29,7 @@ function JKLobbyUserList({ loadingStatus, onlineMusicians, selectedUsers, setSel
onlineMusicians.map(musician => <JKLobbyUser key={musician.id} user={musician} setSelectedUsers={setSelectedUsers} />)
) : (
<tr>
<td colSpan={2}>No musicians are currently available here.</td>
<td colSpan={2}>{t('lobby.users.not_found')}</td>
</tr>
)}
</tbody>

View File

@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import JKProfileAvatar from '../profile/JKProfileAvatar';
import { isIterableArray } from '../../helpers/utils';
import Loader from '../common/Loader';
import { useTranslation } from 'react-i18next';
// import Swiper core and required modules
import SwiperCore, { Navigation, Pagination, Scrollbar, A11y } from 'swiper';
@ -23,6 +24,7 @@ import { Card, CardBody, CardHeader } from 'reactstrap';
SwiperCore.use([Navigation, Pagination, Scrollbar, A11y]);
const JKLobbyUserSwiper = ({ onlineMusicians, setSelectedUsers, loadingStatus }) => {
const { t } = useTranslation('sessions');
return (
<>
{loadingStatus === 'loading' && onlineMusicians.length === 0 ? (
@ -72,7 +74,7 @@ const JKLobbyUserSwiper = ({ onlineMusicians, setSelectedUsers, loadingStatus })
</div>
</>
) : (
<div>No musicians are currently available here.</div>
<div className='mt-2 ml-2'>{t('lobby.users.not_found')}</div>
)}
</>
)}

View File

@ -2,7 +2,7 @@
"new": {
"page_title": "Create Session",
"privacy": "Session Privacy",
"privacy_help": "Public sessions can be seen in the Browse Sessions feature by other musicians in the JamKazam community, and others can join your session. If you choose the “Private - only invited musicians can join” option, your session will not be visible to the community as a whole, and only those musicians you invite will be able to see or join your session. If you choose the “Private anyone can request to join, but requires approval” option, your session will be visible to the community in the Browse Sessions feature, and non-invited musicians may request to join your session, but you will have to grant permission per user to allow users into your session.",
"privacy_help": "Public sessions can be seen in the Browse Sessions feature by other musicians in the JamKazam community, and others can join your session. If you choose the “Private - only invited musicians can join” option, your session will not be visible to the community as a whole, and only those musicians you invite will be able to see or join your session. If you choose the “Private anyone can request to join, but requires approval” option, your session will be visible to the community in the Browse Sessions feature, and non-invited musicians may request to join your session, but you will have to grant permission per user to allow users into your session.",
"privacy_opt_public": "Public anyone can join",
"privacy_opt_private_invite": "Private only invited musicians can join",
"privacy_opt_private_approve": "Private anyone can request to join, but requires approval",
@ -26,7 +26,7 @@
"instruments": "Instruments",
"actions": "Actions"
},
"alerts" : {
"alerts": {
"join_request_sent": "You have requested to join this private session. You will be notified when you are approved."
},
"descriptions": {
@ -41,16 +41,30 @@
},
"lobby": {
"page_title": "Lobby",
"header": {
"musician": "Musician",
"actions": "Actions"
"page_title_tooltip": "The Lobby shows all users who: 1) are currently on this page; or 2) have this page open in a tab in their browser and have given us permission to send browser notifications; or 3) have the JamKazam app running but arent currently in sessions, and have given us permission to send browser notifications.” Use the Lobby to see what other users are currently online but not in sessions. You can message other users to see if they want to join a session with you, and use checkboxes plus the Create Session & Invite Selected Users button to get a session started with other Lobby users.",
"create_session_button": "Create Session & Invite Selected Users",
"users": {
"title": "Users",
"header": {
"musician": "Musician",
"actions": "Actions"
},
"not_found": "No users found in the lobby"
},
"chat": {
"title": "Chat",
"placeholder": "Type your message here",
"new_messages": "New Messages",
"send": "Send"
},
"chat_notifications": {
"title": "Lobby Chat Notifications",
"body": "To avoid missing lobby chat messages when youre not actively watching this page, you can give us permission to give you browser notifications when this page is open in a tab on your browser, but youre not currently looking at this tab/page",
"dont_ask_again": "Dont ask me again",
"display_here": "Notifications will appear here.",
"grant_permission": "Grant Permission",
"no_thanks": "Not Now. Thanks"
"no_thanks": "Not Now. Thanks",
"browser_not_supported": "Sorry, your browser does not support notifications"
}
}
}
}

View File

@ -1,4 +1,58 @@
{
"identity": {
"page_title": "Identidad",
"modals": {
"update_notification": {
"title": "Account Identity Updated"
}
},
"email_form": {
"title": "Correo electrónico",
"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": "Contraseña",
"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."
}
}
}
}

View File

@ -1,3 +1,23 @@
{
"page_title": "Profile"
"page_title": "Perfil",
"profeciency": {
"beginner": "Beginner",
"intermediate": "Intermediate",
"advanced": "Advanced"
},
"basics": "Lo esencial",
"interests": "Intereses",
"instruments": "Instrumentos",
"genres": "Géneros",
"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"
}

View File

@ -1,3 +1,56 @@
{
"page_title": "Página de inicio"
"new": {
"page_title": "Crear sesión",
"privacy": "Session Privacy",
"privacy_help": "Public sessions can be seen in the Browse Sessions feature by other musicians in the JamKazam community, and others can join your session. If you choose the “Private - only invited musicians can join” option, your session will not be visible to the community as a whole, and only those musicians you invite will be able to see or join your session. If you choose the “Private anyone can request to join, but requires approval” option, your session will be visible to the community in the Browse Sessions feature, and non-invited musicians may request to join your session, but you will have to grant permission per user to allow users into your session.",
"privacy_opt_public": "Public anyone can join",
"privacy_opt_private_invite": "Private only invited musicians can join",
"privacy_opt_private_approve": "Private anyone can request to join, but requires approval",
"invitations": "Session Invitations",
"invitations_help": "If you invite other users to join your session, this will generate an in-app notification and in some cases also an email invitation to invitees. Invited users can join your session without further permission or action on your part, regardless of whether your session is public or private.",
"invitations_filter_placeholder": "Enter friend name",
"choose_friends": "Choose Friends",
"add_friends": "Add Friends",
"cancel": "Cancel",
"description": "Session Description",
"description_help": "If youre creating a public session, we strongly recommend that you enter a description of your session for example, what kinds of music youre interested in playing. This description will be displayed next to your session in the Browse Sessions feature, which will help other musicians in the community understand if your session is a good fit for them.",
"description_placeholder": "Enter session description. Recommended for public sessions to attract other musicians and them know what to expect in your session.",
"create_session": "Create Session"
},
"list": {
"page_title": "Explorar sesiones",
"header": {
"session": "Session",
"musicians": "Musicians",
"latency": "Latency",
"instruments": "Instruments",
"actions": "Actions"
},
"alerts" : {
"join_request_sent": "You have requested to join this private session. You will be notified when you are approved."
},
"descriptions": {
"public_open_session": "Public, open session. Feel free to join!",
"private_session": "Private session. Click the enter button in the right column to request to join",
"rsvp_session": "Only RSVP musicians may join"
},
"notes": {
"invited": "YOU WERE INVITED TO THIS SESSION",
"has_friend": "YOU HAVE A FRIEND IN THIS SESSION"
}
},
"lobby": {
"page_title": "Vestíbulo",
"header": {
"musician": "Musician",
"actions": "Actions"
},
"chat_notifications": {
"title": "Lobby Chat Notifications",
"body": "To avoid missing lobby chat messages when youre not actively watching this page, you can give us permission to give you browser notifications when this page is open in a tab on your browser, but youre not currently looking at this tab/page",
"dont_ask_again": "Dont ask me again",
"grant_permission": "Grant Permission",
"no_thanks": "Not Now. Thanks"
}
}
}