3.6 KiB
Purpose
Defines the content localisation system for the Qumo website, including the JSON content files structure and the i18n.ts helper that provides locale-appropriate content to pages and components.
Requirements
Requirement: Locale content JSON files contain global meta fields
src/content/en.json and src/content/nl.json SHALL each contain a top-level "meta" key with the following fields:
siteName: string— the site name (e.g.,"Qumo")defaultTitle: string— default page title (used as fallback)defaultDescription: string— default meta description (used as fallback)defaultOgImage: string— default OG image path; may be empty string initially
Scenario: en.json has correct meta structure
- WHEN
src/content/en.jsonis parsed as JSON - THEN it SHALL have a
metaobject with string values forsiteName,defaultTitle,defaultDescription, anddefaultOgImage
Scenario: nl.json has correct meta structure
- WHEN
src/content/nl.jsonis parsed as JSON - THEN it SHALL have the same
metaobject shape asen.json, with Dutch-language values fordefaultTitleanddefaultDescription
Requirement: i18n helper returns correct content for locale
src/content/i18n.ts SHALL export a function getContent(locale: string) that returns the parsed content object for the given locale. It SHALL return the EN content object for any unrecognized locale string.
Scenario: Returns EN content for "en" locale
- WHEN
getContent("en")is called - THEN the function SHALL return the parsed contents of
src/content/en.json
Scenario: Returns NL content for "nl" locale
- WHEN
getContent("nl")is called - THEN the function SHALL return the parsed contents of
src/content/nl.json
Scenario: Falls back to EN for unknown locale
- WHEN
getContent("fr")or any unrecognized locale string is called - THEN the function SHALL return the parsed contents of
src/content/en.json
Requirement: Locale content JSON files contain nav strings
src/content/en.json and src/content/nl.json SHALL each contain a top-level "nav" key with the following structure:
links: array of objects withlabel: stringandhref: stringfor each nav linkcta: string — label for the Connect CTA buttonctaHref: string — href for the Connect CTA buttonlangSwitch: object withen: stringandnl: stringlabels for the language switcher
Scenario: en.json nav section has correct structure
- WHEN
src/content/en.jsonis parsed as JSON - THEN it SHALL have a
navobject containinglinks(array of 3 items withlabelandhref),ctastring,ctaHrefstring, andlangSwitchobject withenandnlkeys
Scenario: nl.json nav section has Dutch labels
- WHEN
src/content/nl.jsonis parsed as JSON - THEN
nav.linksSHALL contain Dutch labels ("Diensten", "AI Launchpad", "Over Ons"),nav.ctaSHALL be "Verbind", andnav.ctaHrefSHALL be "/nl/contact"
Scenario: Build succeeds with nav strings added
- WHEN
npm run buildis executed after addingnavkeys to both JSON files - THEN the build SHALL complete without TypeScript errors
Requirement: Content files use static imports (no runtime fetch)
The i18n.ts helper SHALL use static ES module imports (import enContent from './en.json') rather than dynamic fetch or fs.readFile. This ensures type safety and tree-shaking at build time.
Scenario: Build succeeds with static imports
- WHEN
npm run buildis executed in thewebsite/directory - THEN the build SHALL complete without errors, with locale content bundled statically