FieldOps/.env.example
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

53 lines
2.4 KiB
Plaintext

# ---------------------------------------------------------------------------
# FieldOps — environment variables
# ---------------------------------------------------------------------------
# Copy this file to .env (cp .env.example .env) and adjust as needed for your
# local environment. Never commit .env.
# Postgres connection string. Matches docker-compose.yml defaults.
DATABASE_URL="postgresql://fieldops:fieldops@localhost:5432/fieldops?schema=public"
# Auth.js v5 — secret used to sign session tokens.
# In production, set this to a strong random value: `openssl rand -base64 32`.
AUTH_SECRET="dev-secret-do-not-use-in-production-please-change-me"
# Dev-only auto sign-in.
# When set to "true", the app will silently sign in as the seed admin user
# (admin@demo.local of the "Demo Factory" tenant) on every request that has
# no session. This skips the login UI in local development and CI/E2E.
#
# !!! NEVER set this to "true" in production. !!!
# Even if set to "true", this flag is IGNORED when NODE_ENV=production.
# The default of "false" here is intentional — a developer setting up locally
# must consciously opt in by editing their .env. See README "Auth" section.
AUTH_DEV_AUTOLOGIN="false"
# Base URL Auth.js uses to build callback/redirect URLs. Must match the host of
# the app being served. This shared .env holds ONE value — the operator-pwa
# (:3000). The admin-web (:3001) gets its own from apps/admin-web/.env.admin,
# which its `dev` script loads with precedence over this file — so admin login
# works with autologin OFF without any extra step.
# - Production: each app still gets its own AUTH_URL from the deploy env
# (a value already in the process wins over .env.admin).
NEXT_PUBLIC_APP_URL="http://localhost:3000"
AUTH_URL="http://localhost:3000"
# Pino log level — one of: fatal, error, warn, info, debug, trace.
LOG_LEVEL="info"
# Node environment — intentionally NOT set here.
# Next.js sets NODE_ENV automatically (development/production/test).
# Setting it via dotenv-cli before `next build` forces the dev runtime and
# breaks static page generation.
# MinIO / S3-compatible object storage. Matches docker-compose.yml defaults.
# S3_FORCE_PATH_STYLE=true is required for MinIO (and other self-hosted S3 impls).
S3_ENDPOINT="http://localhost:9000"
S3_REGION="us-east-1"
S3_BUCKET="fieldops"
S3_ACCESS_KEY="fieldops"
S3_SECRET_KEY="fieldops123"
S3_FORCE_PATH_STYLE="true"
MINIO_ROOT_USER="fieldops"
MINIO_ROOT_PASSWORD="fieldops123"