Skip to content

Commit 925eebb

Browse files
committed
feat: add next-intl i18n support with Polish and English
- Install next-intl and configure plugin in next.config.ts - Move (frontend) route group into [locale] segment with as-needed prefix - Add NextIntlClientProvider to layout with dynamic lang attribute - Extract all hardcoded Polish UI strings into messages/pl.json - Add English translation in messages/en.json - Add middleware for locale detection and routing
1 parent 847e10b commit 925eebb

29 files changed

Lines changed: 6279 additions & 8850 deletions

messages/en.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"home": {
3+
"greeting": "Hey, {name}",
4+
"yourTrainingPlans": "Your training plans",
5+
"noPlans": "You don't have a plan assigned yet. Contact your coach.",
6+
"seriesPrefix": "Sets",
7+
"repsPrefix": "Reps",
8+
"durationPrefix": "Time",
9+
"restPrefix": "Rest"
10+
},
11+
"exercise": {
12+
"video": "▶ video",
13+
"addSet": "+ add set",
14+
"duplicateSet": "Duplicate last set"
15+
},
16+
"seriesForm": {
17+
"note": "Note",
18+
"notePlaceholder": "note",
19+
"save": "Save",
20+
"cancel": "Cancel",
21+
"bodyweightActive": "bodyweight ✕",
22+
"bodyweightTitle": "Bodyweight",
23+
"atLeastOneValue": "Enter at least one value"
24+
},
25+
"login": {
26+
"title": "Sign in",
27+
"subtitle": "Enter the credentials provided by your coach.",
28+
"emailLabel": "E-mail",
29+
"passwordLabel": "Password",
30+
"loggingIn": "Signing in…",
31+
"button": "Sign in",
32+
"invalidCredentials": "Invalid e-mail or password.",
33+
"genericError": "Something went wrong. Please try again."
34+
},
35+
"nav": {
36+
"logout": "Sign out"
37+
},
38+
"workout": {
39+
"activeContext": "Active context"
40+
}
41+
}

messages/pl.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"home": {
3+
"greeting": "Cześć, {name}",
4+
"yourTrainingPlans": "Twoje plany treningowe",
5+
"noPlans": "Nie masz jeszcze przypisanego planu. Skontaktuj się z trenerem.",
6+
"seriesPrefix": "Serie",
7+
"repsPrefix": "Powt.",
8+
"durationPrefix": "Czas",
9+
"restPrefix": "Przerwa"
10+
},
11+
"exercise": {
12+
"video": "▶ wideo",
13+
"addSet": "+ dodaj serię",
14+
"duplicateSet": "Duplikuj ostatnią serię"
15+
},
16+
"seriesForm": {
17+
"note": "Notatka",
18+
"notePlaceholder": "notatka",
19+
"save": "Zapisz",
20+
"cancel": "Anuluj",
21+
"bodyweightActive": "masa własna ✕",
22+
"bodyweightTitle": "Masa własnego ciała",
23+
"atLeastOneValue": "Podaj co najmniej jedną wartość"
24+
},
25+
"login": {
26+
"title": "Zaloguj się",
27+
"subtitle": "Wpisz dane otrzymane od trenera.",
28+
"emailLabel": "E-mail",
29+
"passwordLabel": "Hasło",
30+
"loggingIn": "Logowanie…",
31+
"button": "Zaloguj",
32+
"invalidCredentials": "Nieprawidłowy e-mail lub hasło.",
33+
"genericError": "Coś poszło nie tak. Spróbuj ponownie."
34+
},
35+
"nav": {
36+
"logout": "Wyloguj"
37+
},
38+
"workout": {
39+
"activeContext": "Aktywny kontekst"
40+
}
41+
}

next.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { withPayload } from '@payloadcms/next/withPayload'
22
import type { NextConfig } from 'next'
3+
import createNextIntlPlugin from 'next-intl/plugin'
34
import path from 'path'
45
import { fileURLToPath } from 'url'
56

7+
const withNextIntl = createNextIntlPlugin('./src/i18n/request.ts')
8+
69
const __filename = fileURLToPath(import.meta.url)
710
const dirname = path.dirname(__filename)
811

@@ -30,4 +33,4 @@ const nextConfig: NextConfig = {
3033
allowedDevOrigins: ['192.168.10.50']
3134
}
3235

33-
export default withPayload(nextConfig, { devBundleServerPackages: false })
36+
export default withPayload(withNextIntl(nextConfig), { devBundleServerPackages: false })

0 commit comments

Comments
 (0)