Pedro Gomes 35e7027881 localization support
O que mudou
Infra (por app):

i18n/locales.ts — lista de locales (pt, en), default pt, labels para o seletor
i18n/request.ts — lê o cookie NEXT_LOCALE, carrega as mensagens
messages/pt.json + messages/en.json — todas as strings extraídas
next.config.ts — envolvido com withNextIntl (operator-pwa: withPWA(withNextIntl(...)))
app/layout.tsx — <html lang={locale}> dinâmico, NextIntlClientProvider
app/language-switcher.tsx — seletor PT | EN (cookie + router.refresh())
23 ficheiros de UI atualizados — todos os textos visíveis agora usam t('...') ou getTranslations.

Datas no relatório passaram de toLocaleString('pt-PT') fixo para useFormatter() do next-intl — localizam-se automaticamente.

Plurais em ICU no sync-chip: {count, plural, one {# pedido...} other {# pedidos...}}.

Resultado dos testes:

pnpm test:e2e — 3/3 ✓
pnpm test:e2e:auth — 4/4 ✓
tsc --noEmit em ambas as apps — limpo ✓
Para adicionar uma língua futura: criar messages/<locale>.json + adicionar o locale a i18n/locales.ts em cada app. O seletor aparece automaticamente.
2026-05-30 16:46:07 +01:00

71 lines
2.4 KiB
JSON

{
"metadata": {
"title": "FieldOps — Operator",
"description": "Industrial operator console.",
"appName": "FieldOps Operator"
},
"common": {
"enter": "Sign in",
"entering": "Signing in…",
"status": {
"open": "Open",
"claimed": "In progress",
"resolved": "Resolved"
}
},
"errors": {
"title500": "500",
"message500": "An unexpected error occurred.",
"retry": "Try again",
"title404": "404",
"message404": "Page not found.",
"backHome": "Back to home"
},
"auth": {
"pickerTitle": "Who are you?",
"pickerSubtitle": "Choose your profile to continue.",
"noOperators": "No operators found. Run pnpm db:seed.",
"back": "Back",
"operatorSelected": "Selected operator",
"invalidPin": "Incorrect PIN or account locked. Please try again.",
"unexpectedError": "Unexpected error. Please try again.",
"deleteDigit": "Delete",
"switchOperator": "Switch"
},
"home": {
"operator": "Operator",
"myRequests": "My requests",
"requestMaintenance": "Request maintenance",
"noRequests": "No requests yet."
},
"sync": {
"deadLetters": "{count, plural, one {# request failed — contact your supervisor.} other {# requests failed — contact your supervisor.}}",
"pending": "{count, plural, one {# request pending} other {# requests pending}}",
"synced": "All synced",
"requestFailed": "Request {id}… failed — contact your supervisor.",
"close": "Close"
},
"maintenance": {
"newTitle": "New maintenance request",
"workstationLabel": "Workstation",
"workstationRequired": "*",
"workstationLoading": "Loading workstations…",
"workstationPlaceholder": "Select a workstation…",
"photoLabel": "Photo (optional)",
"photoPreview": "Preview",
"photoButton": "Take / choose photo",
"descriptionLabel": "Description",
"descriptionRequired": "*",
"descriptionPlaceholder": "Describe the problem…",
"photoError": "Could not process the photo. Please try again.",
"saveError": "Error saving request. Please try again.",
"submit": "Submit request",
"submitting": "Saving…",
"sentTitle": "Request submitted",
"pendingTitle": "Request queued",
"sentMessage": "The maintenance team has been notified and will handle the issue.",
"pendingMessage": "Will be sent as soon as the connection is restored.",
"backHome": "Back to home"
}
}