i18n: officer-web catalog goes regional (en-GB, pt-PT), bridge deep-merges app/panel/ui and sets dir

This commit is contained in:
2026-08-23 03:43:01 +00:00
parent 6ac9187c52
commit 0bd8c6c16a
6 changed files with 196 additions and 7 deletions
+4 -2
View File
@@ -1,12 +1,14 @@
import type { TranslationKeys } from 'i18n';
import type { InterpolationParams } from 'i18n';
import { useTranslation as useTranslationBase } from 'i18n';
import type en from '../locales/en.json';
import type en from '../locales/en-GB.json';
type AppTranslationKey = TranslationKeys<typeof en>;
// The `app.` prefix is namespace wiring for the merged catalog (D6) — callers never spell it, they
// pass the same bare key the JSON file uses.
export const useTranslation = () => {
const { t: baseT, locale } = useTranslationBase();
const t = (key: AppTranslationKey, params?: InterpolationParams) => baseT(key, params);
const t = (key: AppTranslationKey, params?: InterpolationParams) => baseT(`app.${key}`, params);
return { t, locale };
};