Changeset 03fa548 in Klonkt for src/middleware


Ignore:
Timestamp:
06/20/2026 01:39:41 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
91c0a39
Parents:
d0f4c10
Message:

feat(i18n): interface language NL/EN/DE with visitor switcher (phase 1: chrome)

  • i18n.js (t helper + nl/en/de dictionary + resolveLang: session → browser → nl).
  • render.js passes t/lang/langs to all views; /lang/:code sets the language in the session.
  • Language switcher (select) in the footer; chrome translated: topnav (Archive/Login/Account/Admin/Logout/…), pill (Agenda/Solo/Circle/Timeline/Grid), post nav (Newer/Older), footer.
  • Content (posts/site name/bio) stays in the author's language. Admin + deeper page strings follow in a next phase.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/middleware/render.js

    rd0f4c10 r03fa548  
    2020import { isPremium as isPremiumInstance, premiumEnabled, premiumUnlocked } from '../services/PatreonService.js';
    2121import { PLATFORMS as PLATFORMS_CATALOG } from '../services/PlatformIcons.js';
     22import { t as i18nT, resolveLang, SUPPORTED as LANGS, LANG_NAMES } from '../services/i18n.js';
    2223
    2324const __dirname = path.dirname(fileURLToPath(import.meta.url));
     
    7778  const canSeeBeheer = !!(_u && (_role === 'god' || _role === 'admin' || _role === 'kijker' || userOwnsSite));
    7879
     80  // Interface-taal (bezoeker-instelbaar): sessie-keuze → browser-taal → nl.
     81  const _lang = resolveLang(req);
     82
    7983  // Common locals
    8084  const locals = {
    8185    user: _u,
     86    lang: _lang,
     87    t: (key, vars) => i18nT(_lang, key, vars),
     88    langs: LANGS.map((c) => ({ code: c, name: LANG_NAMES[c], active: c === _lang })),
    8289    userOwnsSite,
    8390    canSeeBeheer,
Note: See TracChangeset for help on using the changeset viewer.