/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited */ /** * Boot-time validator for the admin translation registry. Mirrors the * fail-fast posture of `validateRichTextFieldFlags` — surfacing wiring * mistakes at `initBylineCore()` rather than at first request. * * Rules enforced: * 1. `defaultLocale` must be in the permitted `locales` set. * 2. When `locales` is non-empty, `translations` must be present. * 3. Every locale in `locales` must have at least one namespace + * one key in `translations`. A locale with zero translations is * almost always a missing-bundle bug — at minimum the consumer * should opt out of the locale set entirely. * * Soft warning (returned, not thrown): * - Key set drift across locales. A namespace that carries `{ a, b }` * in `en` and `{ a }` in `fr` reports `fr` as missing `b`. Surfaces * translation gaps without blocking boot — partial translations are * normal during community-contributor flow. */ import type { TranslationBundleShape } from '../@types/site-config.js'; export interface AdminI18nConfig { defaultLocale: string; locales: string[]; translations?: TranslationBundleShape; } export interface TranslationDriftWarning { locale: string; namespace: string; /** Keys present in some other locale's same namespace but absent here. */ missingKeys: string[]; } export interface ValidateTranslationsResult { /** Soft warnings — caller decides whether to log or ignore. */ warnings: TranslationDriftWarning[]; } /** * Validate the admin translation slot against the configured interface * locale set. Throws on any structural error; returns soft warnings for * key-set drift between locales. */ export declare function validateTranslations(i18n: AdminI18nConfig): ValidateTranslationsResult;