From 486fbaf2ca2bb221e1a46c95dd1d522db54646ab Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Tue, 3 Nov 2026 14:02:56 -0300 Subject: [PATCH] =?UTF-8?q?feat(i18n):=20traducir=20el=20acceso=20de=20alu?= =?UTF-8?q?mnos=20(links,=20passkey,=20recuperaci=C3=B3n)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../ConfirmRecoveryEmailView.tsx | 23 ++++++---- .../features/student-access/LinkUsedView.tsx | 12 ++--- .../student-access/PasskeyLoginButton.tsx | 6 ++- .../student-access/RecoveryLinkForm.tsx | 16 ++++--- .../student-access/StudentLinkView.tsx | 29 ++++++------ apps/web/src/i18n/i18next.d.ts | 2 + .../src/i18n/locales/en/studentAccess.json | 44 +++++++++++++++++++ .../i18n/locales/es-419/studentAccess.json | 44 +++++++++++++++++++ .../src/i18n/locales/es-AR/studentAccess.json | 44 +++++++++++++++++++ .../src/i18n/locales/pt-BR/studentAccess.json | 44 +++++++++++++++++++ 10 files changed, 230 insertions(+), 34 deletions(-) create mode 100644 apps/web/src/i18n/locales/en/studentAccess.json create mode 100644 apps/web/src/i18n/locales/es-419/studentAccess.json create mode 100644 apps/web/src/i18n/locales/es-AR/studentAccess.json create mode 100644 apps/web/src/i18n/locales/pt-BR/studentAccess.json diff --git a/apps/web/src/features/student-access/ConfirmRecoveryEmailView.tsx b/apps/web/src/features/student-access/ConfirmRecoveryEmailView.tsx index d38b613..463eeae 100644 --- a/apps/web/src/features/student-access/ConfirmRecoveryEmailView.tsx +++ b/apps/web/src/features/student-access/ConfirmRecoveryEmailView.tsx @@ -4,11 +4,13 @@ import { CheckCircle2, Loader2, MailWarning, Mail } from 'lucide-react' import { Button } from '../../components/ui' import { confirmStudentRecoveryEmail } from '../../lib/api' import { StudentAuthShell } from './StudentAuthShell' +import { Trans, useTranslation } from 'react-i18next' /* Confirming takes a tap (POST), like entering with a link: a mail scanner that opens the URL doesn't confirm anything by itself. */ export function ConfirmRecoveryEmailView({ token }: { token: string }) { const mutation = useMutation({ mutationFn: () => confirmStudentRecoveryEmail(token) }) + const { t } = useTranslation('studentAccess') return ( @@ -19,13 +21,18 @@ export function ConfirmRecoveryEmailView({ token }: { token: string }) { diff --git a/apps/web/src/features/student-access/PasskeyLoginButton.tsx b/apps/web/src/features/student-access/PasskeyLoginButton.tsx index 76f24ba..8b393eb 100644 --- a/apps/web/src/features/student-access/PasskeyLoginButton.tsx +++ b/apps/web/src/features/student-access/PasskeyLoginButton.tsx @@ -4,11 +4,13 @@ import { useQueryClient } from '@tanstack/react-query' import { Fingerprint, Loader2 } from 'lucide-react' import { Button } from '../../components/ui' import { isPasskeyCancel, loginWithPasskey, supportsPasskeys } from './passkeys' +import { useTranslation } from 'react-i18next' export function PasskeyLoginButton() { const navigate = useNavigate() const queryClient = useQueryClient() const [pending, setPending] = useState(false) + const { t } = useTranslation('studentAccess') const [failed, setFailed] = useState(false) if (!supportsPasskeys()) return null @@ -31,11 +33,11 @@ export function PasskeyLoginButton() {
{failed ? (

- No pudimos verificar tu Face ID o huella en este teléfono. + {t('passkey.error')}

) : null}
diff --git a/apps/web/src/features/student-access/RecoveryLinkForm.tsx b/apps/web/src/features/student-access/RecoveryLinkForm.tsx index 76b4e2f..5df1aeb 100644 --- a/apps/web/src/features/student-access/RecoveryLinkForm.tsx +++ b/apps/web/src/features/student-access/RecoveryLinkForm.tsx @@ -3,11 +3,13 @@ import { useMutation } from '@tanstack/react-query' import { Loader2, MailCheck } from 'lucide-react' import { Button, Input, Label } from '../../components/ui' import { ApiError, requestStudentRecoveryLink } from '../../lib/api' +import { Trans, useTranslation } from 'react-i18next' /* "Pedir un link a mi mail". The answer is the same whether the email exists or not, so the screen says it conditionally. */ export function RecoveryLinkForm() { const [email, setEmail] = useState('') + const { t } = useTranslation('studentAccess') const mutation = useMutation({ mutationFn: requestStudentRecoveryLink }) const handleSubmit = (event: FormEvent) => { @@ -20,8 +22,12 @@ export function RecoveryLinkForm() {
) @@ -32,7 +38,7 @@ export function RecoveryLinkForm() { return (
- + {mutation.isError ? (

- {tooMany ? 'Pediste varios links seguidos. Probá de nuevo en 15 minutos.' : 'No pudimos enviar el pedido. Probá de nuevo.'} + {tooMany ? t('recovery.tooMany') : t('recovery.error')}

) : null} ) diff --git a/apps/web/src/features/student-access/StudentLinkView.tsx b/apps/web/src/features/student-access/StudentLinkView.tsx index 9b91f25..108f26f 100644 --- a/apps/web/src/features/student-access/StudentLinkView.tsx +++ b/apps/web/src/features/student-access/StudentLinkView.tsx @@ -3,22 +3,24 @@ import { Avatar, Button } from '../../components/ui' import { LinkUsedView } from './LinkUsedView' import { StudentAuthShell } from './StudentAuthShell' import { useStudentLink } from './StudentLinkProvider' +import { useTranslation } from 'react-i18next' const CAPABILITIES = [ - { icon: CalendarX2, text: 'Avisar si no vas a una clase' }, - { icon: Receipt, text: 'Informar pagos con el comprobante' }, - { icon: CalendarDays, text: 'Ver tus próximas clases' }, -] + { icon: CalendarX2, text: 'link.capNotify' }, + { icon: Receipt, text: 'link.capReport' }, + { icon: CalendarDays, text: 'link.capClasses' }, +] as const export function StudentLinkView() { const { info, infoPending, infoFailed, enter, entering, consumedElsewhere, enterFailed } = useStudentLink() + const { t } = useTranslation('studentAccess') if (infoPending) { return (
) @@ -44,13 +46,13 @@ export function StudentLinkView() { className={`size-14 rounded-full text-lg ring-4 ring-surface ${info.teacherName ? '-ml-3' : ''}`} />
-

Hola, {firstName}

+

{t('link.greeting', { name: firstName })}

{isRecovery - ? 'Este es tu link para volver a entrar a gruperly.' + ? t('link.recovery') : info.teacherName && info.groupName - ? `${info.teacherName} te invitó a ${info.groupName} en gruperly.` - : 'Te invitaron a gruperly.'} + ? t('link.invitedBy', { teacher: info.teacherName, group: info.groupName }) + : t('link.invited')}

@@ -59,7 +61,7 @@ export function StudentLinkView() { {CAPABILITIES.map(({ icon: Icon, text }) => (
  • ))} @@ -68,18 +70,17 @@ export function StudentLinkView() {
    {enterFailed ? (

    - No pudimos conectarte. Revisá tu conexión y probá de nuevo. + {t('link.error')}

    ) : null}

    diff --git a/apps/web/src/i18n/i18next.d.ts b/apps/web/src/i18n/i18next.d.ts index 6ec5600..17a147e 100644 --- a/apps/web/src/i18n/i18next.d.ts +++ b/apps/web/src/i18n/i18next.d.ts @@ -20,6 +20,7 @@ import type whatsapp from './locales/es-AR/whatsapp.json' import type onboarding from './locales/es-AR/onboarding.json' import type account from './locales/es-AR/account.json' import type public from './locales/es-AR/public.json' +import type studentAccess from './locales/es-AR/studentAccess.json' import type validation from './locales/es-AR/validation.json' // es-AR es la fuente: una clave que no exista ahí rompe el typecheck. @@ -34,6 +35,7 @@ declare module 'i18next' { pwa: typeof pwa settings: typeof settings validation: typeof validation + 'studentAccess': typeof studentAccess 'public': typeof public 'account': typeof account 'onboarding': typeof onboarding diff --git a/apps/web/src/i18n/locales/en/studentAccess.json b/apps/web/src/i18n/locales/en/studentAccess.json new file mode 100644 index 0000000..79c5ced --- /dev/null +++ b/apps/web/src/i18n/locales/en/studentAccess.json @@ -0,0 +1,44 @@ +{ + "loading": "Loading…", + "confirmEmail": { + "doneTitle": "Email confirmed", + "done": "If you ever lose access, request a link to {{email}}.", + "goToApp": "Go to gruperly", + "expiredTitle": "This link no longer works", + "expired": "It was already used or has expired. You can add your email again from Profile in the app.", + "title": "Confirm your email", + "description": "You'll be able to use it to request a link if you lose access.", + "confirm": "Confirm email" + }, + "linkUsed": { + "usedTitle": "This link was already used", + "signedOutTitle": "Sign in again", + "used": "gruperly links work only once. If you already signed in from another phone, continue there. If it wasn't you, ask your teacher to send you a new one: the old one stops working.", + "signedOut": "We couldn't find your session on this phone. Ask your teacher for a new link or use one of these options.", + "askEmail": "Email me a link", + "note": "These options only work if you turned them on before." + }, + "passkey": { + "login": "Sign in with Face ID or fingerprint", + "error": "We couldn't verify your Face ID or fingerprint on this phone." + }, + "recovery": { + "sent": "If {{email}} is your recovery email, we sent you a sign-in link. It expires in 15 minutes.", + "label": "Your recovery email", + "tooMany": "You requested several links in a row. Try again in 15 minutes.", + "error": "We couldn't send the request. Please try again.", + "submit": "Send me the link" + }, + "link": { + "greeting": "Hi, {{name}}", + "recovery": "This is your link to get back into gruperly.", + "invitedBy": "{{teacher}} invited you to {{group}} on gruperly.", + "invited": "You were invited to gruperly.", + "capNotify": "Let your teacher know if you'll miss a class", + "capReport": "Report payments with the receipt", + "capClasses": "See your upcoming classes", + "enter": "Continue", + "error": "We couldn't connect you. Check your connection and try again.", + "security": "No passwords: you'll stay signed in on this phone. This link is personal and works only once. If you're not {{name}}, don't continue." + } +} diff --git a/apps/web/src/i18n/locales/es-419/studentAccess.json b/apps/web/src/i18n/locales/es-419/studentAccess.json new file mode 100644 index 0000000..20fbd76 --- /dev/null +++ b/apps/web/src/i18n/locales/es-419/studentAccess.json @@ -0,0 +1,44 @@ +{ + "loading": "Cargando…", + "confirmEmail": { + "doneTitle": "Mail confirmado", + "done": "Si algún día pierdes el acceso, pide un link a {{email}}.", + "goToApp": "Ir a gruperly", + "expiredTitle": "Este link ya no sirve", + "expired": "Ya se usó o venció. Puedes volver a registrar tu mail desde Perfil en la app.", + "title": "Confirma tu mail", + "description": "Podrás usarlo para pedir un link si pierdes el acceso.", + "confirm": "Confirmar mail" + }, + "linkUsed": { + "usedTitle": "Este link ya fue usado", + "signedOutTitle": "Vuelve a entrar", + "used": "Los links de gruperly sirven una sola vez. Si ya entraste desde otro teléfono, sigue desde ahí. Si no fuiste tú, avísale a tu profe para que te envíe uno nuevo: el anterior deja de funcionar.", + "signedOut": "No encontramos tu sesión en este teléfono. Pídele a tu profe un link nuevo o usa una de estas opciones.", + "askEmail": "Pedir un link a mi mail", + "note": "Estas opciones funcionan solo si las activaste antes." + }, + "passkey": { + "login": "Entrar con Face ID o huella", + "error": "No pudimos verificar tu Face ID o huella en este teléfono." + }, + "recovery": { + "sent": "Si {{email}} es tu mail de recuperación, te enviamos un link para entrar. Vence en 15 minutos.", + "label": "Tu mail de recuperación", + "tooMany": "Pediste varios links seguidos. Inténtalo de nuevo en 15 minutos.", + "error": "No pudimos enviar la solicitud. Inténtalo de nuevo.", + "submit": "Enviarme el link" + }, + "link": { + "greeting": "Hola, {{name}}", + "recovery": "Este es tu link para volver a entrar a gruperly.", + "invitedBy": "{{teacher}} te invitó a {{group}} en gruperly.", + "invited": "Te invitaron a gruperly.", + "capNotify": "Avisar si no vas a una clase", + "capReport": "Informar pagos con el comprobante", + "capClasses": "Ver tus próximas clases", + "enter": "Ingresar", + "error": "No pudimos conectarte. Revisa tu conexión e inténtalo de nuevo.", + "security": "Sin contraseñas: quedarás conectado/a en este teléfono. Este link es personal y sirve una sola vez. Si no eres {{name}}, no continúes." + } +} diff --git a/apps/web/src/i18n/locales/es-AR/studentAccess.json b/apps/web/src/i18n/locales/es-AR/studentAccess.json new file mode 100644 index 0000000..d414d29 --- /dev/null +++ b/apps/web/src/i18n/locales/es-AR/studentAccess.json @@ -0,0 +1,44 @@ +{ + "loading": "Cargando…", + "confirmEmail": { + "doneTitle": "Mail confirmado", + "done": "Si algún día perdés el acceso, pedí un link a {{email}}.", + "goToApp": "Ir a gruperly", + "expiredTitle": "Este link ya no sirve", + "expired": "Ya fue usado o venció. Podés volver a cargar tu mail desde Perfil en la app.", + "title": "Confirmá tu mail", + "description": "Lo vas a poder usar para pedir un link si perdés el acceso.", + "confirm": "Confirmar mail" + }, + "linkUsed": { + "usedTitle": "Este link ya fue usado", + "signedOutTitle": "Volvé a entrar", + "used": "Los links de gruperly sirven una sola vez. Si ya entraste desde otro teléfono, seguí desde ahí. Si no fuiste vos, avisale a tu profe para que te mande uno nuevo: el anterior deja de funcionar.", + "signedOut": "No encontramos tu sesión en este teléfono. Pedile a tu profe un link nuevo o usá una de estas opciones.", + "askEmail": "Pedir un link a mi mail", + "note": "Estas opciones funcionan solo si las activaste antes." + }, + "passkey": { + "login": "Entrar con Face ID o huella", + "error": "No pudimos verificar tu Face ID o huella en este teléfono." + }, + "recovery": { + "sent": "Si {{email}} es tu mail de recuperación, te mandamos un link para entrar. Vence en 15 minutos.", + "label": "Tu mail de recuperación", + "tooMany": "Pediste varios links seguidos. Probá de nuevo en 15 minutos.", + "error": "No pudimos enviar el pedido. Probá de nuevo.", + "submit": "Mandarme el link" + }, + "link": { + "greeting": "Hola, {{name}}", + "recovery": "Este es tu link para volver a entrar a gruperly.", + "invitedBy": "{{teacher}} te invitó a {{group}} en gruperly.", + "invited": "Te invitaron a gruperly.", + "capNotify": "Avisar si no vas a una clase", + "capReport": "Informar pagos con el comprobante", + "capClasses": "Ver tus próximas clases", + "enter": "Ingresar", + "error": "No pudimos conectarte. Revisá tu conexión y probá de nuevo.", + "security": "Sin contraseñas: vas a quedar conectado/a en este teléfono. Este link es personal y sirve una sola vez. Si no sos {{name}}, no continúes." + } +} diff --git a/apps/web/src/i18n/locales/pt-BR/studentAccess.json b/apps/web/src/i18n/locales/pt-BR/studentAccess.json new file mode 100644 index 0000000..fe336bd --- /dev/null +++ b/apps/web/src/i18n/locales/pt-BR/studentAccess.json @@ -0,0 +1,44 @@ +{ + "loading": "Carregando…", + "confirmEmail": { + "doneTitle": "E-mail confirmado", + "done": "Se algum dia você perder o acesso, peça um link para {{email}}.", + "goToApp": "Ir para o gruperly", + "expiredTitle": "Este link não vale mais", + "expired": "Ele já foi usado ou expirou. Você pode cadastrar seu e-mail de novo em Perfil, no app.", + "title": "Confirme seu e-mail", + "description": "Você vai poder usá-lo para pedir um link se perder o acesso.", + "confirm": "Confirmar e-mail" + }, + "linkUsed": { + "usedTitle": "Este link já foi usado", + "signedOutTitle": "Entre de novo", + "used": "Os links do gruperly valem uma única vez. Se você já entrou por outro celular, continue por lá. Se não foi você, avise seu professor para enviar um novo: o anterior deixa de funcionar.", + "signedOut": "Não encontramos sua sessão neste celular. Peça um novo link ao seu professor ou use uma destas opções.", + "askEmail": "Pedir um link no meu e-mail", + "note": "Estas opções só funcionam se você as ativou antes." + }, + "passkey": { + "login": "Entrar com Face ID ou digital", + "error": "Não conseguimos verificar seu Face ID ou digital neste celular." + }, + "recovery": { + "sent": "Se {{email}} for seu e-mail de recuperação, enviamos um link para entrar. Ele vence em 15 minutos.", + "label": "Seu e-mail de recuperação", + "tooMany": "Você pediu vários links seguidos. Tente novamente em 15 minutos.", + "error": "Não conseguimos enviar o pedido. Tente novamente.", + "submit": "Enviar o link" + }, + "link": { + "greeting": "Olá, {{name}}", + "recovery": "Este é o seu link para entrar de novo no gruperly.", + "invitedBy": "{{teacher}} convidou você para {{group}} no gruperly.", + "invited": "Você foi convidado para o gruperly.", + "capNotify": "Avisar se não for a uma aula", + "capReport": "Informar pagamentos com o comprovante", + "capClasses": "Ver suas próximas aulas", + "enter": "Entrar", + "error": "Não conseguimos conectar você. Verifique sua conexão e tente novamente.", + "security": "Sem senhas: você fica conectado neste celular. Este link é pessoal e vale uma única vez. Se você não é {{name}}, não continue." + } +}