From e2d9ddf569bcaae88260d734e11087dace35585b Mon Sep 17 00:00:00 2001 From: Jose Selesan Date: Tue, 3 Nov 2026 13:57:44 -0300 Subject: [PATCH] feat(i18n): traducir WhatsApp Co-Authored-By: Claude Opus 5.5 --- .../groups/detail/GroupAutomationsCard.tsx | 4 +- .../features/whatsapp/WhatsappLinkModal.tsx | 34 ++++---- .../whatsapp/WhatsappPairingCodePanel.tsx | 27 +++---- .../features/whatsapp/WhatsappStatusCard.tsx | 36 +++++---- apps/web/src/features/whatsapp/copy.ts | 47 +++++------ apps/web/src/features/whatsapp/index.ts | 2 +- .../whatsapp/useDisconnectWhatsapp.ts | 6 +- .../whatsapp/useRequestWhatsappPairingCode.ts | 4 +- .../whatsapp/useStartWhatsappConnection.ts | 6 +- apps/web/src/i18n/i18next.d.ts | 2 + apps/web/src/i18n/locales/en/whatsapp.json | 80 +++++++++++++++++++ .../web/src/i18n/locales/es-419/whatsapp.json | 80 +++++++++++++++++++ apps/web/src/i18n/locales/es-AR/whatsapp.json | 80 +++++++++++++++++++ apps/web/src/i18n/locales/pt-BR/whatsapp.json | 80 +++++++++++++++++++ apps/web/test/whatsapp-copy.test.ts | 4 +- 15 files changed, 406 insertions(+), 86 deletions(-) create mode 100644 apps/web/src/i18n/locales/en/whatsapp.json create mode 100644 apps/web/src/i18n/locales/es-419/whatsapp.json create mode 100644 apps/web/src/i18n/locales/es-AR/whatsapp.json create mode 100644 apps/web/src/i18n/locales/pt-BR/whatsapp.json diff --git a/apps/web/src/features/groups/detail/GroupAutomationsCard.tsx b/apps/web/src/features/groups/detail/GroupAutomationsCard.tsx index ef3b775..b7578b6 100644 --- a/apps/web/src/features/groups/detail/GroupAutomationsCard.tsx +++ b/apps/web/src/features/groups/detail/GroupAutomationsCard.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next' import { Badge, Switch } from '../../../components/ui' import { hasPlanFeature, useBillingStatus } from '../../billing' import { cn } from '../../../lib/utils' -import { automationBlockedReason, useWhatsappStatus, WEEKLY_SEND_LABEL } from '../../whatsapp' +import { automationBlockedReason, useWhatsappStatus, weeklySendLabel } from '../../whatsapp' import { useGroupDetail } from './GroupDetailProvider' type Automation = { @@ -87,7 +87,7 @@ export function GroupAutomationsCard() { {expanded ? (

- {WEEKLY_SEND_LABEL} + {weeklySendLabel()} {includedInPlan ? null : ( <> {' '} diff --git a/apps/web/src/features/whatsapp/WhatsappLinkModal.tsx b/apps/web/src/features/whatsapp/WhatsappLinkModal.tsx index e3b177d..53237b4 100644 --- a/apps/web/src/features/whatsapp/WhatsappLinkModal.tsx +++ b/apps/web/src/features/whatsapp/WhatsappLinkModal.tsx @@ -6,6 +6,7 @@ import { cn } from '../../lib/utils' import { defaultLinkMethod, linksWithPairingCode, type WhatsappLinkMethod } from './copy' import { useWhatsappStatus } from './useWhatsappStatus' import { WhatsappPairingCodePanel } from './WhatsappPairingCodePanel' +import { Trans, useTranslation } from 'react-i18next' type WhatsappLinkModalProps = { isOpen: boolean @@ -14,10 +15,10 @@ type WhatsappLinkModalProps = { initialQrCode: string | null } -const METHOD_LABELS: Record = { - phone: 'Con tu número', - qr: 'Con código QR', -} +const METHOD_LABELS = { phone: 'link.methodPhone', qr: 'link.methodQr' } as const satisfies Record< + WhatsappLinkMethod, + string +> /** * Vinculación de WhatsApp como "dispositivo vinculado", por QR o con el número @@ -29,6 +30,7 @@ const METHOD_LABELS: Record = { */ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLinkModalProps) { const toast = useToast() + const { t } = useTranslation('whatsapp') const isMobile = useIsMobile() const statusQuery = useWhatsappStatus({ enabled: isOpen }) const status = statusQuery.data?.status @@ -43,10 +45,10 @@ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLi useEffect(() => { if (!isOpen) return if (status === 'active') { - toast.success('¡Listo! Tu WhatsApp quedó vinculado.') + toast.success(t('link.linked')) onClose() } else if (status === 'disconnected') { - toast.error('La vinculación no se completó. Volvé a intentarlo.') + toast.error(t('link.failed')) onClose() } }, [isOpen, status, onClose, toast]) @@ -58,11 +60,11 @@ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLi @@ -88,7 +90,7 @@ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLi ) : ( )} - {METHOD_LABELS[option]} + {t(METHOD_LABELS[option])} ))}

@@ -100,26 +102,24 @@ export function WhatsappLinkModal({ isOpen, onClose, initialQrCode }: WhatsappLi <>
{qrCode ? ( - Código QR para vincular WhatsApp + {t('link.qrAlt')} ) : ( )}
    -
  1. 1. Abrí WhatsApp en tu teléfono.
  2. +
  3. 1. {t('link.qrStep1')}
  4. - 2. Tocá Dispositivos vinculados y - después Vincular un dispositivo. + 2. }} />
  5. -
  6. 3. Apuntá la cámara a este código.
  7. +
  8. 3. {t('link.qrStep3')}
)}

- Los mensajes van a salir desde tu número. Podés desvincularlo cuando quieras desde - Ajustes o desde tu teléfono. + {t('link.footnote')}

diff --git a/apps/web/src/features/whatsapp/WhatsappPairingCodePanel.tsx b/apps/web/src/features/whatsapp/WhatsappPairingCodePanel.tsx index 8cefe66..8f5770c 100644 --- a/apps/web/src/features/whatsapp/WhatsappPairingCodePanel.tsx +++ b/apps/web/src/features/whatsapp/WhatsappPairingCodePanel.tsx @@ -3,6 +3,7 @@ import { type FormEvent, useState } from 'react' import { Button, Input, Label } from '../../components/ui' import { formatPairingCode } from './copy' import { useRequestWhatsappPairingCode } from './useRequestWhatsappPairingCode' +import { Trans, useTranslation } from 'react-i18next' /** * Vinculación con el número de teléfono: el profesor escribe su número, @@ -12,6 +13,7 @@ import { useRequestWhatsappPairingCode } from './useRequestWhatsappPairingCode' export function WhatsappPairingCodePanel() { const { requestCode, pairingCode, isRequesting, error, reset } = useRequestWhatsappPairingCode() const [phoneNumber, setPhoneNumber] = useState('') + const { t } = useTranslation('whatsapp') const [copied, setCopied] = useState(false) const handleSubmit = (event: FormEvent) => { @@ -39,31 +41,26 @@ export function WhatsappPairingCodePanel() {
    +
  1. 1. {t('pairing.step1')}
  2. - 1. Abrí WhatsApp. Te va a llegar una notificación para vincular un dispositivo: - tocala. + 2. }} />
  3. -
  4. - 2. Si no te llega, tocá Dispositivos vinculados{' '} - → Vincular un dispositivo →{' '} - Vincular con el número de teléfono. -
  5. -
  6. 3. Ingresá este código. Esta pantalla se actualiza sola.
  7. +
  8. 3. {t('pairing.step3')}

- Esperando el código… + {t('pairing.waiting')}

@@ -73,20 +70,20 @@ export function WhatsappPairingCodePanel() { return (
- + setPhoneNumber(event.target.value)} />

- El del teléfono donde usás WhatsApp, con el código de área. + {t('pairing.phoneHint')}

{error ? ( @@ -99,7 +96,7 @@ export function WhatsappPairingCodePanel() { disabled={isRequesting || !phoneNumber.trim()} > {isRequesting ? : } - {isRequesting ? 'Pidiendo código…' : 'Obtener código'} + {isRequesting ? t('pairing.requesting') : t('pairing.request')} ) diff --git a/apps/web/src/features/whatsapp/WhatsappStatusCard.tsx b/apps/web/src/features/whatsapp/WhatsappStatusCard.tsx index a50d218..354f77d 100644 --- a/apps/web/src/features/whatsapp/WhatsappStatusCard.tsx +++ b/apps/web/src/features/whatsapp/WhatsappStatusCard.tsx @@ -6,7 +6,7 @@ import { formatMpConnectionDate } from '../mp' import { linksWithQr, readinessLabel, - WEEKLY_SEND_LABEL, + weeklySendLabel, whatsappStatusBadgeVariant, whatsappStatusErrorMessage, whatsappStatusLabel, @@ -15,6 +15,7 @@ import { useDisconnectWhatsapp } from './useDisconnectWhatsapp' import { useStartWhatsappConnection } from './useStartWhatsappConnection' import { useWhatsappStatus } from './useWhatsappStatus' import { WhatsappLinkModal } from './WhatsappLinkModal' +import { useTranslation } from 'react-i18next' /** * WhatsApp en Ajustes: vincular el número desde el que salen los recordatorios @@ -23,6 +24,7 @@ import { WhatsappLinkModal } from './WhatsappLinkModal' */ export function WhatsappStatusCard() { const statusQuery = useWhatsappStatus() + const { t } = useTranslation(['whatsapp', 'common']) const connection = useStartWhatsappConnection() const { disconnectWhatsapp: disconnect, isDisconnecting } = useDisconnectWhatsapp() const [isConfirmingDisconnect, setIsConfirmingDisconnect] = useState(false) @@ -31,7 +33,7 @@ export function WhatsappStatusCard() { return (
-

Consultando tu WhatsApp…

+

{t('card.loading')}

) } @@ -63,7 +65,7 @@ export function WhatsappStatusCard() { {whatsappStatusLabel(status)}

- Tu número para los recordatorios de pago y los mensajes de reenganche automáticos. + {t('card.description')}

@@ -75,10 +77,10 @@ export function WhatsappStatusCard() {

- {data.displayPhoneNumber ?? 'Número vinculado'} + {data.displayPhoneNumber ?? t('card.linkedNumber')}

{connectedAt ? ( -

Vinculado el {connectedAt}

+

{t('card.linkedOn', { date: connectedAt })}

) : null}
-
Recordatorio de pago
+
{t('card.paymentReminder')}
{readinessLabel(data.readiness.PAYMENT_REMINDER)}
-
Mensaje de reenganche
+
{t('card.reengagement')}
{readinessLabel(data.readiness.REENGAGEMENT)}

- Los activás en cada grupo. {WEEKLY_SEND_LABEL} + {t('card.perGroup')} {weeklySendLabel()}

@@ -116,12 +118,12 @@ export function WhatsappStatusCard() {

- {status === 'requires_reconnect' ? 'Volvé a vincular tu número' : 'Vinculá tu número'} + {status === 'requires_reconnect' ? t('card.relink') : t('card.linkNumber')}

{linksWithQr(data.provider) - ? 'Lo vinculás con tu número o con un código QR, como WhatsApp Web.' - : 'Te llevamos a Meta para conectar tu cuenta de WhatsApp Business.'} + ? t('card.qrHint') + : t('card.metaHint')}

)} @@ -154,13 +156,13 @@ export function WhatsappStatusCard() { setIsConfirmingDisconnect(false)} - title="Desvincular WhatsApp" - description="Los recordatorios y los mensajes de reenganche automáticos dejan de enviarse hasta que lo vuelvas a vincular." + title={t('disconnect.title')} + description={t('disconnect.description')} maxWidth="sm" >
diff --git a/apps/web/src/features/whatsapp/copy.ts b/apps/web/src/features/whatsapp/copy.ts index dadf2b1..dfa5caf 100644 --- a/apps/web/src/features/whatsapp/copy.ts +++ b/apps/web/src/features/whatsapp/copy.ts @@ -5,16 +5,19 @@ import type { WhatsappReadiness, WhatsappStatusDto, } from '@gruperly/shared' +import { i18n } from '../../i18n/instance' /* Copy de WhatsApp en un solo lugar: el paso del onboarding, la tarjeta de Ajustes y las automatizaciones del grupo dicen exactamente lo mismo. Las funciones son puras para cubrirlas con tests sin renderizar nada. */ -export const WHATSAPP_CONNECT_ERROR_MESSAGE = - 'No pudimos empezar la vinculación. Revisá tu conexión e intentá de nuevo.' +export function whatsappConnectErrorMessage(): string { + return i18n.t('whatsapp:connectError') +} -export const WHATSAPP_UNAVAILABLE_MESSAGE = - 'La vinculación con WhatsApp no está disponible en este momento.' +export function whatsappUnavailableMessage(): string { + return i18n.t('whatsapp:unavailable') +} /** * Mensaje para un fallo al consultar el estado. Solo un 503 significa "WhatsApp @@ -22,13 +25,16 @@ export const WHATSAPP_UNAVAILABLE_MESSAGE = * verdad y se muestra con su número para poder rastrearlo. */ export function whatsappStatusErrorMessage(httpStatus: number | null): string { - if (httpStatus === 503) return WHATSAPP_UNAVAILABLE_MESSAGE - const code = httpStatus ? ` (error ${httpStatus})` : '' - return `No pudimos consultar el estado de tu WhatsApp${code}. Intentá de nuevo en un rato.` + if (httpStatus === 503) return whatsappUnavailableMessage() + return httpStatus + ? i18n.t('whatsapp:statusErrorCode', { code: httpStatus }) + : i18n.t('whatsapp:statusError') } /** Día y hora en que salen los mensajes automáticos (lo fija el job del backend). */ -export const WEEKLY_SEND_LABEL = 'Se envían los lunes a las 10:00 (hora de Argentina).' +export function weeklySendLabel(): string { + return i18n.t('whatsapp:weeklySend') +} /** El resultado de una vinculación por redirect (Kapso), tal como vuelve en `?wa=`. */ export type WhatsappCallbackFeedback = @@ -57,28 +63,19 @@ export function readWhatsappCallbackFeedback( } } -const REASON_MESSAGES: Record = { - invalid_setup: 'La vinculación venció o ya se había usado. Volvé a intentarlo.', - setup_failed: 'No se pudo terminar la vinculación en Meta. Volvé a intentarlo.', - provider_error: 'WhatsApp no pudo completar la vinculación.', - number_in_use: 'Ese número de WhatsApp ya está vinculado a otro profesor.', -} - export function whatsappCallbackErrorMessage(reason: WhatsappCallbackReason): string { - return REASON_MESSAGES[reason] + return i18n.t(`whatsapp:reason.${reason}`) } export function whatsappStatusLabel(status: WhatsappAccountStatus): string { switch (status) { case 'active': - return 'Vinculado' case 'pending': - return 'Vinculando…' case 'requires_reconnect': - return 'Necesita vincularse de nuevo' + return i18n.t(`whatsapp:status.${status}`) case 'disconnected': case 'none': - return 'Sin vincular' + return i18n.t('whatsapp:status.none') } } @@ -102,11 +99,9 @@ export function whatsappStatusBadgeVariant( export function readinessLabel(readiness: WhatsappReadiness): string { switch (readiness) { case 'ready': - return 'Listo para enviar' case 'pending': - return 'En revisión por Meta' case 'blocked': - return 'No disponible' + return i18n.t(`whatsapp:readiness.${readiness}`) } } @@ -146,14 +141,14 @@ export function automationBlockedReason( kind: 'PAYMENT_REMINDER' | 'REENGAGEMENT', ): string | null { if (!status || status.status !== 'active') { - return 'Vinculá tu WhatsApp en Ajustes para activar los envíos automáticos.' + return i18n.t('whatsapp:blocked.notLinked') } switch (status.readiness[kind]) { case 'ready': return null case 'pending': - return 'Meta todavía está revisando el mensaje. Suele tardar hasta 24 horas.' + return i18n.t('whatsapp:blocked.pending') case 'blocked': - return 'Meta rechazó este mensaje. Escribinos para revisarlo.' + return i18n.t('whatsapp:blocked.rejected') } } diff --git a/apps/web/src/features/whatsapp/index.ts b/apps/web/src/features/whatsapp/index.ts index b8ee487..8428087 100644 --- a/apps/web/src/features/whatsapp/index.ts +++ b/apps/web/src/features/whatsapp/index.ts @@ -6,7 +6,7 @@ export { linksWithQr, readinessLabel, readWhatsappCallbackFeedback, - WEEKLY_SEND_LABEL, + weeklySendLabel, type WhatsappLinkMethod, type WhatsappCallbackFeedback, whatsappCallbackErrorMessage, diff --git a/apps/web/src/features/whatsapp/useDisconnectWhatsapp.ts b/apps/web/src/features/whatsapp/useDisconnectWhatsapp.ts index 903f719..dac3df7 100644 --- a/apps/web/src/features/whatsapp/useDisconnectWhatsapp.ts +++ b/apps/web/src/features/whatsapp/useDisconnectWhatsapp.ts @@ -2,6 +2,8 @@ import { useMutation, useQueryClient } from '@tanstack/react-query' import { useToast } from '../../components/ui' import { disconnectWhatsapp } from '../../lib/api' import { whatsappStatusQueryKey } from './useWhatsappStatus' +import { errorMessage } from '../../i18n' +import { i18n } from '../../i18n/instance' export function useDisconnectWhatsapp() { const queryClient = useQueryClient() @@ -11,13 +13,13 @@ export function useDisconnectWhatsapp() { mutationFn: disconnectWhatsapp, onSuccess: (result) => { if (result.disconnected) { - toast.success('Desvinculamos tu WhatsApp. Los envíos automáticos quedan en pausa.') + toast.success(i18n.t('whatsapp:disconnect.done')) } void queryClient.invalidateQueries({ queryKey: whatsappStatusQueryKey }) void queryClient.invalidateQueries({ queryKey: ['onboarding', 'status'] }) }, onError: (error: Error) => { - toast.error(error.message || 'No pudimos desvincular tu WhatsApp.') + toast.error(errorMessage(error, i18n.t('whatsapp:disconnect.error'))) }, }) diff --git a/apps/web/src/features/whatsapp/useRequestWhatsappPairingCode.ts b/apps/web/src/features/whatsapp/useRequestWhatsappPairingCode.ts index f37d1eb..1bdd89f 100644 --- a/apps/web/src/features/whatsapp/useRequestWhatsappPairingCode.ts +++ b/apps/web/src/features/whatsapp/useRequestWhatsappPairingCode.ts @@ -1,5 +1,7 @@ import { useMutation } from '@tanstack/react-query' import { requestWhatsappPairingCode } from '../../lib/api' +import { errorMessage } from '../../i18n' +import { i18n } from '../../i18n/instance' /** * Pide el código para vincular con el número de teléfono. La vinculación ya @@ -13,7 +15,7 @@ export function useRequestWhatsappPairingCode() { requestCode: (phoneNumber: string) => mutation.mutate(phoneNumber), pairingCode: mutation.data?.pairingCode ?? null, isRequesting: mutation.isPending, - error: mutation.error ? mutation.error.message || 'No pudimos pedir el código.' : null, + error: mutation.error ? errorMessage(mutation.error, i18n.t('whatsapp:pairing.error')) : null, reset: mutation.reset, } } diff --git a/apps/web/src/features/whatsapp/useStartWhatsappConnection.ts b/apps/web/src/features/whatsapp/useStartWhatsappConnection.ts index 6a3f92e..41e3cd4 100644 --- a/apps/web/src/features/whatsapp/useStartWhatsappConnection.ts +++ b/apps/web/src/features/whatsapp/useStartWhatsappConnection.ts @@ -2,7 +2,7 @@ import type { WhatsappReturnTo } from '@gruperly/shared' import { useQueryClient } from '@tanstack/react-query' import { useState } from 'react' import { ApiError, startWhatsappConnection } from '../../lib/api' -import { WHATSAPP_CONNECT_ERROR_MESSAGE, WHATSAPP_UNAVAILABLE_MESSAGE } from './copy' +import { whatsappConnectErrorMessage, whatsappUnavailableMessage } from './copy' import { whatsappStatusQueryKey } from './useWhatsappStatus' /** @@ -36,8 +36,8 @@ export function useStartWhatsappConnection() { } catch (caught) { setError( caught instanceof ApiError && caught.status === 503 - ? WHATSAPP_UNAVAILABLE_MESSAGE - : WHATSAPP_CONNECT_ERROR_MESSAGE, + ? whatsappUnavailableMessage() + : whatsappConnectErrorMessage(), ) } setIsStarting(false) diff --git a/apps/web/src/i18n/i18next.d.ts b/apps/web/src/i18n/i18next.d.ts index 5c78d0c..a7fbc90 100644 --- a/apps/web/src/i18n/i18next.d.ts +++ b/apps/web/src/i18n/i18next.d.ts @@ -16,6 +16,7 @@ import type classAttendance from './locales/es-AR/classAttendance.json' import type payments from './locales/es-AR/payments.json' import type billing from './locales/es-AR/billing.json' import type mp from './locales/es-AR/mp.json' +import type whatsapp from './locales/es-AR/whatsapp.json' import type validation from './locales/es-AR/validation.json' // es-AR es la fuente: una clave que no exista ahí rompe el typecheck. @@ -30,6 +31,7 @@ declare module 'i18next' { pwa: typeof pwa settings: typeof settings validation: typeof validation + 'whatsapp': typeof whatsapp 'mp': typeof mp 'billing': typeof billing 'payments': typeof payments diff --git a/apps/web/src/i18n/locales/en/whatsapp.json b/apps/web/src/i18n/locales/en/whatsapp.json new file mode 100644 index 0000000..ab80315 --- /dev/null +++ b/apps/web/src/i18n/locales/en/whatsapp.json @@ -0,0 +1,80 @@ +{ + "connectError": "We couldn't start linking. Check your connection and try again.", + "unavailable": "Linking with WhatsApp isn't available right now.", + "statusError": "We couldn't check your WhatsApp status. Try again in a bit.", + "statusErrorCode": "We couldn't check your WhatsApp status (error {{code}}). Try again in a bit.", + "weeklySend": "They're sent on Mondays at 10:00 (Argentina time).", + "reason": { + "invalid_setup": "The link request expired or was already used. Please try again.", + "setup_failed": "We couldn't finish linking on Meta. Please try again.", + "provider_error": "WhatsApp couldn't finish linking.", + "number_in_use": "That WhatsApp number is already linked to another teacher." + }, + "status": { + "active": "Linked", + "pending": "Linking…", + "requires_reconnect": "Needs relinking", + "none": "Not linked" + }, + "readiness": { + "ready": "Ready to send", + "pending": "Under review by Meta", + "blocked": "Unavailable" + }, + "blocked": { + "notLinked": "Link your WhatsApp in Settings to turn on automatic messages.", + "pending": "Meta is still reviewing the message. It usually takes up to 24 hours.", + "rejected": "Meta rejected this message. Contact us so we can review it." + }, + "disconnect": { + "done": "Your WhatsApp was unlinked. Automatic messages are paused.", + "error": "We couldn't unlink your WhatsApp.", + "title": "Unlink WhatsApp", + "description": "Automatic reminders and re-engagement messages stop until you link it again.", + "confirm": "Unlink" + }, + "pairing": { + "error": "We couldn't get the code.", + "copy": "Copy code", + "step1": "Open WhatsApp. You'll get a notification to link a device: tap it.", + "step2": "If it doesn't arrive, tap Linked devices → Link a device → Link with phone number instead.", + "step3": "Enter this code. This screen updates on its own.", + "waiting": "Waiting for the code…", + "otherNumber": "Use another number", + "phone": "Your WhatsApp number", + "phonePlaceholder": "555 123 4567", + "phoneHint": "The one on the phone where you use WhatsApp, with the area code.", + "requesting": "Getting code…", + "request": "Get code" + }, + "link": { + "linked": "All set! Your WhatsApp is linked.", + "failed": "Linking didn't finish. Please try again.", + "title": "Link your WhatsApp", + "phoneDescription": "We'll give you a code to enter in WhatsApp, on the phone where you use it.", + "qrDescription": "Scan the code with the phone where you use WhatsApp.", + "methodPhone": "With your number", + "methodQr": "With a QR code", + "qrAlt": "QR code to link WhatsApp", + "qrStep1": "Open WhatsApp on your phone.", + "qrStep2": "Tap Linked devices and then Link a device.", + "qrStep3": "Point the camera at this code.", + "footnote": "Messages will be sent from your number. You can unlink it anytime from Settings or your phone." + }, + "card": { + "loading": "Checking your WhatsApp…", + "description": "Your number for payment reminders and automatic re-engagement messages.", + "linkedNumber": "Linked number", + "linkedOn": "Linked on {{date}}", + "disconnect": "Unlink", + "paymentReminder": "Payment reminder", + "reengagement": "Re-engagement message", + "perGroup": "You turn them on in each group.", + "relink": "Link your number again", + "linkNumber": "Link your number", + "qrHint": "Link it with your number or a QR code, like WhatsApp Web.", + "metaHint": "We'll take you to Meta to connect your WhatsApp Business account.", + "opening": "Opening…", + "connect": "Link" + } +} diff --git a/apps/web/src/i18n/locales/es-419/whatsapp.json b/apps/web/src/i18n/locales/es-419/whatsapp.json new file mode 100644 index 0000000..e7fc28c --- /dev/null +++ b/apps/web/src/i18n/locales/es-419/whatsapp.json @@ -0,0 +1,80 @@ +{ + "connectError": "No pudimos empezar la vinculación. Revisa tu conexión e inténtalo de nuevo.", + "unavailable": "La vinculación con WhatsApp no está disponible en este momento.", + "statusError": "No pudimos consultar el estado de tu WhatsApp. Inténtalo de nuevo en un rato.", + "statusErrorCode": "No pudimos consultar el estado de tu WhatsApp (error {{code}}). Inténtalo de nuevo en un rato.", + "weeklySend": "Se envían los lunes a las 10:00 (hora de Argentina).", + "reason": { + "invalid_setup": "La vinculación venció o ya se había usado. Vuelve a intentarlo.", + "setup_failed": "No se pudo terminar la vinculación en Meta. Vuelve a intentarlo.", + "provider_error": "WhatsApp no pudo completar la vinculación.", + "number_in_use": "Ese número de WhatsApp ya está vinculado a otro profesor." + }, + "status": { + "active": "Vinculado", + "pending": "Vinculando…", + "requires_reconnect": "Necesita vincularse de nuevo", + "none": "Sin vincular" + }, + "readiness": { + "ready": "Listo para enviar", + "pending": "En revisión por Meta", + "blocked": "No disponible" + }, + "blocked": { + "notLinked": "Vincula tu WhatsApp en Ajustes para activar los envíos automáticos.", + "pending": "Meta todavía está revisando el mensaje. Suele tardar hasta 24 horas.", + "rejected": "Meta rechazó este mensaje. Escríbenos para revisarlo." + }, + "disconnect": { + "done": "Desvinculamos tu WhatsApp. Los envíos automáticos quedan en pausa.", + "error": "No pudimos desvincular tu WhatsApp.", + "title": "Desvincular WhatsApp", + "description": "Los recordatorios y los mensajes de reenganche automáticos dejan de enviarse hasta que lo vuelvas a vincular.", + "confirm": "Desvincular" + }, + "pairing": { + "error": "No pudimos pedir el código.", + "copy": "Copiar código", + "step1": "Abre WhatsApp. Te llegará una notificación para vincular un dispositivo: tócala.", + "step2": "Si no te llega, toca Dispositivos vinculados → Vincular un dispositivo → Vincular con el número de teléfono.", + "step3": "Ingresa este código. Esta pantalla se actualiza sola.", + "waiting": "Esperando el código…", + "otherNumber": "Usar otro número", + "phone": "Tu número de WhatsApp", + "phonePlaceholder": "55 1234 5678", + "phoneHint": "El del teléfono donde usas WhatsApp, con la lada.", + "requesting": "Pidiendo código…", + "request": "Obtener código" + }, + "link": { + "linked": "¡Listo! Tu WhatsApp quedó vinculado.", + "failed": "La vinculación no se completó. Vuelve a intentarlo.", + "title": "Vincula tu WhatsApp", + "phoneDescription": "Te damos un código para ingresar en WhatsApp, en el teléfono donde lo usas.", + "qrDescription": "Escanea el código con el teléfono donde usas WhatsApp.", + "methodPhone": "Con tu número", + "methodQr": "Con código QR", + "qrAlt": "Código QR para vincular WhatsApp", + "qrStep1": "Abre WhatsApp en tu teléfono.", + "qrStep2": "Toca Dispositivos vinculados y después Vincular un dispositivo.", + "qrStep3": "Apunta la cámara a este código.", + "footnote": "Los mensajes saldrán desde tu número. Puedes desvincularlo cuando quieras desde Ajustes o desde tu teléfono." + }, + "card": { + "loading": "Consultando tu WhatsApp…", + "description": "Tu número para los recordatorios de pago y los mensajes de reenganche automáticos.", + "linkedNumber": "Número vinculado", + "linkedOn": "Vinculado el {{date}}", + "disconnect": "Desvincular", + "paymentReminder": "Recordatorio de pago", + "reengagement": "Mensaje de reenganche", + "perGroup": "Los activas en cada grupo.", + "relink": "Vuelve a vincular tu número", + "linkNumber": "Vincula tu número", + "qrHint": "Lo vinculas con tu número o con un código QR, como WhatsApp Web.", + "metaHint": "Te llevamos a Meta para conectar tu cuenta de WhatsApp Business.", + "opening": "Abriendo…", + "connect": "Vincular" + } +} diff --git a/apps/web/src/i18n/locales/es-AR/whatsapp.json b/apps/web/src/i18n/locales/es-AR/whatsapp.json new file mode 100644 index 0000000..abbfc1d --- /dev/null +++ b/apps/web/src/i18n/locales/es-AR/whatsapp.json @@ -0,0 +1,80 @@ +{ + "connectError": "No pudimos empezar la vinculación. Revisá tu conexión e intentá de nuevo.", + "unavailable": "La vinculación con WhatsApp no está disponible en este momento.", + "statusError": "No pudimos consultar el estado de tu WhatsApp. Intentá de nuevo en un rato.", + "statusErrorCode": "No pudimos consultar el estado de tu WhatsApp (error {{code}}). Intentá de nuevo en un rato.", + "weeklySend": "Se envían los lunes a las 10:00 (hora de Argentina).", + "reason": { + "invalid_setup": "La vinculación venció o ya se había usado. Volvé a intentarlo.", + "setup_failed": "No se pudo terminar la vinculación en Meta. Volvé a intentarlo.", + "provider_error": "WhatsApp no pudo completar la vinculación.", + "number_in_use": "Ese número de WhatsApp ya está vinculado a otro profesor." + }, + "status": { + "active": "Vinculado", + "pending": "Vinculando…", + "requires_reconnect": "Necesita vincularse de nuevo", + "none": "Sin vincular" + }, + "readiness": { + "ready": "Listo para enviar", + "pending": "En revisión por Meta", + "blocked": "No disponible" + }, + "blocked": { + "notLinked": "Vinculá tu WhatsApp en Ajustes para activar los envíos automáticos.", + "pending": "Meta todavía está revisando el mensaje. Suele tardar hasta 24 horas.", + "rejected": "Meta rechazó este mensaje. Escribinos para revisarlo." + }, + "disconnect": { + "done": "Desvinculamos tu WhatsApp. Los envíos automáticos quedan en pausa.", + "error": "No pudimos desvincular tu WhatsApp.", + "title": "Desvincular WhatsApp", + "description": "Los recordatorios y los mensajes de reenganche automáticos dejan de enviarse hasta que lo vuelvas a vincular.", + "confirm": "Desvincular" + }, + "pairing": { + "error": "No pudimos pedir el código.", + "copy": "Copiar código", + "step1": "Abrí WhatsApp. Te va a llegar una notificación para vincular un dispositivo: tocala.", + "step2": "Si no te llega, tocá Dispositivos vinculados → Vincular un dispositivo → Vincular con el número de teléfono.", + "step3": "Ingresá este código. Esta pantalla se actualiza sola.", + "waiting": "Esperando el código…", + "otherNumber": "Usar otro número", + "phone": "Tu número de WhatsApp", + "phonePlaceholder": "11 2345-6789", + "phoneHint": "El del teléfono donde usás WhatsApp, con el código de área.", + "requesting": "Pidiendo código…", + "request": "Obtener código" + }, + "link": { + "linked": "¡Listo! Tu WhatsApp quedó vinculado.", + "failed": "La vinculación no se completó. Volvé a intentarlo.", + "title": "Vinculá tu WhatsApp", + "phoneDescription": "Te damos un código para ingresar en WhatsApp, en el teléfono donde lo usás.", + "qrDescription": "Escaneá el código con el teléfono donde usás WhatsApp.", + "methodPhone": "Con tu número", + "methodQr": "Con código QR", + "qrAlt": "Código QR para vincular WhatsApp", + "qrStep1": "Abrí WhatsApp en tu teléfono.", + "qrStep2": "Tocá Dispositivos vinculados y después Vincular un dispositivo.", + "qrStep3": "Apuntá la cámara a este código.", + "footnote": "Los mensajes van a salir desde tu número. Podés desvincularlo cuando quieras desde Ajustes o desde tu teléfono." + }, + "card": { + "loading": "Consultando tu WhatsApp…", + "description": "Tu número para los recordatorios de pago y los mensajes de reenganche automáticos.", + "linkedNumber": "Número vinculado", + "linkedOn": "Vinculado el {{date}}", + "disconnect": "Desvincular", + "paymentReminder": "Recordatorio de pago", + "reengagement": "Mensaje de reenganche", + "perGroup": "Los activás en cada grupo.", + "relink": "Volvé a vincular tu número", + "linkNumber": "Vinculá tu número", + "qrHint": "Lo vinculás con tu número o con un código QR, como WhatsApp Web.", + "metaHint": "Te llevamos a Meta para conectar tu cuenta de WhatsApp Business.", + "opening": "Abriendo…", + "connect": "Vincular" + } +} diff --git a/apps/web/src/i18n/locales/pt-BR/whatsapp.json b/apps/web/src/i18n/locales/pt-BR/whatsapp.json new file mode 100644 index 0000000..2b94bc0 --- /dev/null +++ b/apps/web/src/i18n/locales/pt-BR/whatsapp.json @@ -0,0 +1,80 @@ +{ + "connectError": "Não conseguimos iniciar a vinculação. Verifique sua conexão e tente novamente.", + "unavailable": "A vinculação com o WhatsApp não está disponível no momento.", + "statusError": "Não conseguimos consultar o status do seu WhatsApp. Tente novamente daqui a pouco.", + "statusErrorCode": "Não conseguimos consultar o status do seu WhatsApp (erro {{code}}). Tente novamente daqui a pouco.", + "weeklySend": "São enviadas às segundas-feiras às 10:00 (horário da Argentina).", + "reason": { + "invalid_setup": "A vinculação expirou ou já tinha sido usada. Tente novamente.", + "setup_failed": "Não foi possível concluir a vinculação na Meta. Tente novamente.", + "provider_error": "O WhatsApp não conseguiu concluir a vinculação.", + "number_in_use": "Esse número de WhatsApp já está vinculado a outro professor." + }, + "status": { + "active": "Vinculado", + "pending": "Vinculando…", + "requires_reconnect": "Precisa vincular de novo", + "none": "Não vinculado" + }, + "readiness": { + "ready": "Pronto para enviar", + "pending": "Em análise pela Meta", + "blocked": "Indisponível" + }, + "blocked": { + "notLinked": "Vincule seu WhatsApp em Ajustes para ativar os envios automáticos.", + "pending": "A Meta ainda está analisando a mensagem. Costuma levar até 24 horas.", + "rejected": "A Meta recusou esta mensagem. Fale com a gente para revisá-la." + }, + "disconnect": { + "done": "Desvinculamos seu WhatsApp. Os envios automáticos ficam pausados.", + "error": "Não conseguimos desvincular seu WhatsApp.", + "title": "Desvincular WhatsApp", + "description": "Os lembretes e as mensagens de reengajamento automáticas deixam de ser enviados até você vincular de novo.", + "confirm": "Desvincular" + }, + "pairing": { + "error": "Não conseguimos pedir o código.", + "copy": "Copiar código", + "step1": "Abra o WhatsApp. Você vai receber uma notificação para vincular um dispositivo: toque nela.", + "step2": "Se não chegar, toque em Dispositivos conectados → Conectar um dispositivo → Conectar com número de telefone.", + "step3": "Digite este código. Esta tela se atualiza sozinha.", + "waiting": "Aguardando o código…", + "otherNumber": "Usar outro número", + "phone": "Seu número de WhatsApp", + "phonePlaceholder": "11 91234-5678", + "phoneHint": "O do celular onde você usa o WhatsApp, com DDD.", + "requesting": "Pedindo código…", + "request": "Obter código" + }, + "link": { + "linked": "Pronto! Seu WhatsApp foi vinculado.", + "failed": "A vinculação não foi concluída. Tente novamente.", + "title": "Vincule seu WhatsApp", + "phoneDescription": "Damos um código para você digitar no WhatsApp, no celular onde você usa.", + "qrDescription": "Escaneie o código com o celular onde você usa o WhatsApp.", + "methodPhone": "Com seu número", + "methodQr": "Com QR code", + "qrAlt": "QR code para vincular o WhatsApp", + "qrStep1": "Abra o WhatsApp no seu celular.", + "qrStep2": "Toque em Dispositivos conectados e depois em Conectar um dispositivo.", + "qrStep3": "Aponte a câmera para este código.", + "footnote": "As mensagens vão sair do seu número. Você pode desvincular quando quiser em Ajustes ou pelo celular." + }, + "card": { + "loading": "Consultando seu WhatsApp…", + "description": "Seu número para os lembretes de pagamento e as mensagens automáticas de reengajamento.", + "linkedNumber": "Número vinculado", + "linkedOn": "Vinculado em {{date}}", + "disconnect": "Desvincular", + "paymentReminder": "Lembrete de pagamento", + "reengagement": "Mensagem de reengajamento", + "perGroup": "Você ativa em cada grupo.", + "relink": "Vincule seu número de novo", + "linkNumber": "Vincule seu número", + "qrHint": "Você vincula com seu número ou com um QR code, como no WhatsApp Web.", + "metaHint": "Vamos te levar à Meta para conectar sua conta do WhatsApp Business.", + "opening": "Abrindo…", + "connect": "Vincular" + } +} diff --git a/apps/web/test/whatsapp-copy.test.ts b/apps/web/test/whatsapp-copy.test.ts index bb7a3f1..6109e95 100644 --- a/apps/web/test/whatsapp-copy.test.ts +++ b/apps/web/test/whatsapp-copy.test.ts @@ -9,7 +9,7 @@ import { readinessLabel, readWhatsappCallbackFeedback, whatsappCallbackErrorMessage, - WHATSAPP_UNAVAILABLE_MESSAGE, + whatsappUnavailableMessage, whatsappStatusBadgeVariant, whatsappStatusErrorMessage, whatsappStatusLabel, @@ -85,7 +85,7 @@ describe('automationBlockedReason', () => { describe('whatsappStatusErrorMessage', () => { test('solo un 503 dice que no está disponible', () => { - expect(whatsappStatusErrorMessage(503)).toBe(WHATSAPP_UNAVAILABLE_MESSAGE) + expect(whatsappStatusErrorMessage(503)).toBe(whatsappUnavailableMessage()) }) test('otro error muestra su código', () => {