Changeset fefb80c in Klonkt


Ignore:
Timestamp:
06/21/2026 05:28:23 PM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
49f698b
Parents:
097da22
Message:

fix(zoeken): translate page labels in suggest route (res.locals.t doesn't exist there)

searchSite used res.locals.t (undefined in the JSON route) → labels remained the
raw key ('search.page_downloads') and 'archief' didn't match (key is English). Now
via resolveLang(req)+i18n: labels correctly translated and matching works per language.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/routes/search.js

    r097da22 rfefb80c  
    2020import { getSetting } from '../services/SettingsService.js';
    2121import { premiumUnlocked } from '../services/PatreonService.js';
     22import { t as i18nT, resolveLang } from '../services/i18n.js';
    2223
    2324const router = express.Router();
     
    5354  const base = res.locals.siteUrlBase || '';
    5455  const urlFor = (slug) => (isHub ? `/user/${site.slug}/${slug}` : `/${slug}`);
    55   const t = res.locals.t || ((k) => k);
     56  // Eigen vertaler (werkt ook in de JSON-route, waar res.locals.t niet bestaat).
     57  const lang = resolveLang(req);
     58  const t = (k) => i18nT(lang, k);
    5659
    5760  const out = { results: [], tracks: [], events: [], pages: [], queryError: null };
Note: See TracChangeset for help on using the changeset viewer.