i18n: scaffold panel.* and ui.* locale catalogs, wire panelCatalogs into officerdev's barrel
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import type { InterpolationParams, TranslationKeys } from 'i18n';
|
||||
import { useTranslation as useTranslationBase } from 'i18n';
|
||||
import type en from './en-GB.json';
|
||||
|
||||
type UiTranslationKey = TranslationKeys<typeof en>;
|
||||
|
||||
// The `ui.` prefix is namespace wiring for the merged catalog (D6) — callers never spell it, they
|
||||
// pass the same bare key the JSON file uses. `ui.*` may not name a feature (see the naming convention).
|
||||
export const useTranslation = () => {
|
||||
const { t: baseT, locale } = useTranslationBase();
|
||||
const t = (key: UiTranslationKey, params?: InterpolationParams) => baseT(`ui.${key}`, params);
|
||||
return { t, locale };
|
||||
};
|
||||
Reference in New Issue
Block a user