feat: implement complete i18n support with French and English

Add comprehensive internationalization support:
- Browser language detection via Accept-Language header
- Cookie-based language preference persistence (1 year)
- Language switcher with flag emojis (🇫🇷 🇬🇧)
- 71 translation keys covering all UI elements
- Context-based translation injection via middleware

Replace Tailwind CDN with production build:
- Tailwind CLI v3.4.16 for CSS compilation
- Minified CSS output (5.9KB from several MB)
- Docker build integration
- Custom color palette configuration

Update all templates with i18n support:
- Main pages: home, sign, signatures, error
- Admin dashboard and document details
- Embed iframe widget (English only for international use)
- Language switcher preserves current page URL

Technical implementation:
- golang.org/x/text for language matching
- Middleware pattern for consistent i18n injection
- Fallback chain: Cookie → Accept-Language → English
- Separate translation files (locales/fr.json, locales/en.json)
This commit is contained in:
Benjamin
2025-10-01 00:13:40 +02:00
parent 6ff6966193
commit 9c53a8bf2b
24 changed files with 807 additions and 158 deletions
+13 -2
View File
@@ -1,7 +1,7 @@
# ---- Build ----
FROM golang:alpine AS builder
RUN apk update && apk add --no-cache ca-certificates git && rm -rf /var/cache/apk/*
RUN apk update && apk add --no-cache ca-certificates git curl && rm -rf /var/cache/apk/*
RUN adduser -D -g '' ackuser
WORKDIR /app
@@ -10,6 +10,14 @@ ENV GOTOOLCHAIN=auto
RUN go mod download && go mod verify
COPY . .
# Download Tailwind CSS CLI (use v3 for compatibility)
RUN curl -sL https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.16/tailwindcss-linux-x64 -o /tmp/tailwindcss && \
chmod +x /tmp/tailwindcss
# Build CSS
RUN mkdir -p ./static && \
/tmp/tailwindcss -i ./assets/input.css -o ./static/output.css --minify
ARG VERSION="dev"
ARG COMMIT="unknown"
ARG BUILD_DATE="unknown"
@@ -42,10 +50,13 @@ WORKDIR /app
COPY --from=builder /app/ackify /app/ackify
COPY --from=builder /app/migrate /app/migrate
COPY --from=builder /app/migrations /app/migrations
COPY --from=builder /app/locales /app/locales
COPY --from=builder /app/templates /app/templates
COPY --from=builder /app/static /app/static
ENV ACKIFY_TEMPLATES_DIR=/app/templates
ENV ACKIFY_LOCALES_DIR=/app/locales
ENV ACKIFY_STATIC_DIR=/app/static
EXPOSE 8080