feat(i18n): traducir el onboarding (nombres de país desde Intl)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-11-03 13:59:41 -03:00
parent e2d9ddf569
commit dfb6951d7c
17 changed files with 501 additions and 115 deletions

View File

@@ -1,9 +1,11 @@
import type { CountryCode } from '@gruperly/shared'
import { COUNTRY_CURRENCY, COUNTRY_LABELS } from '@gruperly/shared'
import { COUNTRY_CURRENCY } from '@gruperly/shared'
import { ArrowLeft, ArrowRight } from 'lucide-react'
import { Button } from '../../components/ui'
import { cn } from '../../lib/utils'
import { useOnboarding } from './OnboardingProvider'
import { useTranslation } from 'react-i18next'
import { countryName, useIntlLocale } from '../../i18n'
export const COUNTRY_OPTIONS: readonly CountryCode[] = [
'AR',
@@ -30,17 +32,19 @@ type CountryStepProps = {
*/
export function CountryStep({ onNext, onBack }: CountryStepProps) {
const { country, setCountry } = useOnboarding()
const { t } = useTranslation(['onboarding', 'common', 'groups'])
const locale = useIntlLocale()
return (
<section className="space-y-5">
<header className="space-y-1">
<h2 className="text-2xl font-bold text-primary">¿En qué país vas a cobrar?</h2>
<h2 className="text-2xl font-bold text-primary">{t('country.title')}</h2>
<p className="text-sm text-foreground/60">
Tus links se generan en la moneda de ese país.
{t('country.description')}
</p>
</header>
<div role="radiogroup" aria-label="País" className="space-y-2">
<div role="radiogroup" aria-label={t('country.label')} className="space-y-2">
{COUNTRY_OPTIONS.map((code) => {
const isSelected = code === country
return (
@@ -60,7 +64,7 @@ export function CountryStep({ onNext, onBack }: CountryStepProps) {
className="size-4 accent-accent"
/>
<span className="flex-1 text-sm font-medium text-primary">
{COUNTRY_LABELS[code]}
{countryName(code, locale)}
</span>
<span className="text-sm text-foreground/50">{COUNTRY_CURRENCY[code]}</span>
</label>
@@ -71,10 +75,10 @@ export function CountryStep({ onNext, onBack }: CountryStepProps) {
<div className="flex items-center gap-3">
<Button variant="outline" onClick={onBack} className="hidden lg:inline-flex">
<ArrowLeft className="size-4" />
Volver
{t('common:actions.back')}
</Button>
<Button variant="primary" className="flex-1 lg:flex-none" onClick={() => onNext()}>
Continuar
{t('continue')}
<ArrowRight className="size-4" />
</Button>
</div>