feat: homepage animations; Arabic as default locale

This commit is contained in:
2026-09-24 00:22:40 +02:00
parent 2ff5cf47cf
commit 1879a206ad
14 changed files with 268 additions and 56 deletions
+10 -10
View File
@@ -5,8 +5,8 @@
plus {placeholder} interpolation. No i18next, no ICU MessageFormat - the
catalogues hold UI chrome only, page prose comes from Strapi.
English is the reference catalogue: `Messages` is derived from en.json, and
ar.json is typechecked against it, so a key added on one side and forgotten
Arabic is the reference catalogue: `Messages` is derived from ar.json, and
en.json is typechecked against it, so a key added on one side and forgotten
on the other is a compile error rather than a blank label in production.
========================================================================= */
@@ -15,8 +15,8 @@ import ar from "./messages/ar.json";
import { DEFAULT_LOCALE, type Locale } from "./config";
/** The shape of every catalogue. Derived from the English source of truth. */
export type Messages = typeof en;
/** The shape of every catalogue. Derived from the Arabic source of truth. */
export type Messages = typeof ar;
/** Anything that may be interpolated into a message. */
export type TranslationParams = Readonly<
@@ -44,13 +44,13 @@ export type Translator = (
params?: TranslationParams,
) => string;
/* The `Messages` annotation is the parity check: ar.json must supply every
key en.json declares, with a string in every leaf position. */
const arabicMessages: Messages = ar;
/* The `Messages` annotation is the parity check: en.json must supply every
key ar.json declares, with a string in every leaf position. */
const englishMessages: Messages = en;
const CATALOGUES: Readonly<Record<Locale, Messages>> = {
en,
ar: arabicMessages,
en: englishMessages,
ar,
};
/** The whole catalogue for a locale - handy for spreading into a component. */
@@ -90,7 +90,7 @@ export function interpolate(
}
/**
* Translate one key. Falls back to the English string when a locale is
* Translate one key. Falls back to the default-locale string when a locale is
* missing it, and finally to the key itself so a page never renders "".
*/
export function translate(