diff --git a/app/src/App.tsx b/app/src/App.tsx index f481a20..0125f8b 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -1,4 +1,5 @@ import { useEffect, type ReactNode } from 'react'; +import { useTranslation } from 'react-i18next'; import { Routes, Route, Navigate } from 'react-router-dom'; import { useAuth } from './store/auth'; import { useMe } from './api/queries'; @@ -39,6 +40,7 @@ function TrainerOnly({ children }: { children: ReactNode }) { } export default function App() { + const { t } = useTranslation(); const { user, ready, init } = useAuth(); useEffect(() => { @@ -46,7 +48,9 @@ export default function App() { }, [init]); if (!ready) { - return
Ładowanie…
; + return ( +
{t('loading')}
+ ); } return ( diff --git a/app/src/components/AddressFields.tsx b/app/src/components/AddressFields.tsx index 1f46717..c32bee5 100644 --- a/app/src/components/AddressFields.tsx +++ b/app/src/components/AddressFields.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from 'react-i18next'; import { Field, Input, Select } from './ui'; /** @@ -5,13 +6,13 @@ import { Field, Input, Select } from './ui'; * kod pocztowy, miejscowość, kraj). Display string `location` składa serwer. */ -export const COUNTRIES: { code: string; label: string }[] = [ - { code: 'PL', label: 'Polska' }, - { code: 'DE', label: 'Niemcy' }, - { code: 'CZ', label: 'Czechy' }, - { code: 'SK', label: 'Słowacja' }, - { code: 'LT', label: 'Litwa' }, - { code: 'GB', label: 'Wielka Brytania' }, +export const COUNTRIES: { code: string; labelKey: string }[] = [ + { code: 'PL', labelKey: 'PL' }, + { code: 'DE', labelKey: 'DE' }, + { code: 'CZ', labelKey: 'CZ' }, + { code: 'SK', labelKey: 'SK' }, + { code: 'LT', labelKey: 'LT' }, + { code: 'GB', labelKey: 'GB' }, ]; /** Polskie kody pocztowe: 00-001. */ @@ -58,25 +59,26 @@ export function AddressFields({ onChange: (patch: Partial) => void; required?: boolean; }) { + const { t } = useTranslation('gyms'); const postalInvalid = values.postalCode.length > 0 && !PL_POSTAL_CODE.test(values.postalCode); return ( <> - + onChange({ addressLine1: e.target.value })} - placeholder="np. Mokotowska 12A" + placeholder={t('address.streetPh')} required={required} /> - + onChange({ addressLine2: e.target.value })} - placeholder="np. piętro 2, lokal 5" + placeholder={t('address.premisesPh')} /> - + onChange({ postalCode: formatPostalCodeInput(e.target.value) })} @@ -86,25 +88,27 @@ export function AddressFields({ aria-invalid={postalInvalid || undefined} required={required} /> - {postalInvalid &&

Format kodu: 00-001

} + {postalInvalid && ( +

{t('address.postalFormatError')}

+ )}
- + onChange({ city: e.target.value })} - placeholder="np. Warszawa" + placeholder={t('address.cityPh')} autoComplete="address-level2" required={required} /> - + diff --git a/app/src/components/AvailabilityEditor.tsx b/app/src/components/AvailabilityEditor.tsx index 38b5612..f86a843 100644 --- a/app/src/components/AvailabilityEditor.tsx +++ b/app/src/components/AvailabilityEditor.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from 'react-i18next'; import { TIME_SLOTS, dayFull } from '../lib/availability'; import { Select } from './ui'; import type { Availability, DayAvailability } from '../api/types'; @@ -12,6 +13,7 @@ export function AvailabilityEditor({ value: Availability; onChange: (value: Availability) => void; }) { + const { t } = useTranslation(); const setDay = (i: number, day: DayAvailability | null) => { const next = [...value]; next[i] = day; @@ -31,13 +33,13 @@ export function AvailabilityEditor({ {name} setDay(i, e.target.checked ? { start, end } : null)} className="size-4 accent-[var(--accent)]" /> –