## Summary Adds **Português (Brasil)** (`pt-BR`) as a supported locale: - Selectable as **Translation target language** (project settings) and as the dashboard / terminal UI language. - Full machine-drafted catalogs (`app`, `cli`, `common`), disclosed in `packages/i18n/locales/TRANSLATION_STATUS.md` following the pattern #1352 established — reviewed for glossary/register consistency (0.18% untranslated, matching only keys that are empty in `en`), but native-speaker corrections are welcome. - Brazilian Portuguese content-language detection (accent-stripped stopword list — the scorer strips diacritics before matching, so accented entries never match; `com`/`mais` deliberately omitted to avoid bare-domain `.com` and French collisions, with regression tests for both directions). - `pt`/`pt-PT` browser and environment locales resolve to `pt-BR` on all three detection paths (`FALLBACK_LNG` routing plus a `pt` branch in `normalizeToSupportedLocale`, mirroring the existing `zh` handling). - `README.pt-BR.md` + switcher links in all READMEs, docs updates (`settings-reference`, `cli-reference`, `i18n-contributing`, `--lang` help text), changeset (`minor`). Drive-by fixes bundled: `TRANSLATION_STATUS.md` was missing the `ko` row; the LanguageSelector endonym test was missing `한국어`; `docs/i18n-contributing.md` now names the two compile-enforced display maps (`LOCALE_LABELS`, `localeDisplayName`) a new locale must update; the `--lang` CLI help text no longer drifts from its validator. ## Test plan - `pnpm i18n:status` (key parity gate) green; catalogs are `i18n:sync`-idempotent. - Updated/extended suites: core `locale-settings`, i18n `config`/`parity`/`db-banner-catalog`/`i18n-gate-coverage`, dashboard `useLanguage`/`LanguageSelector`/`GeneralSection.importTranslate`/`detectContentLanguage` (incl. new pt-BR detection + bare-domain regression tests), CLI `settings`. - `pnpm verify:fast` (typecheck, build, boot smoke), `pnpm lint`, `pnpm check:changesets`, and the bounded `pnpm test` lane all green locally (the three `test:pg-gate` files fail locally only for lack of a Postgres instance; they fail identically on clean `main`). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Brazilian Portuguese (Português (Brasil)) across the dashboard, terminal interface, settings, and translation tools. * Added Portuguese translations for common interface and CLI content. * Added automatic Portuguese language detection, locale normalization, and fallback support. * Added a Portuguese (Brazil) README with product, setup, and usage documentation. * **Documentation** * Updated language selectors, CLI references, settings documentation, and translation guidance. * Added Portuguese README links to translated documentation. * Added French to the documented dashboard language options. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: gsxdsm <gsxdsm@users.noreply.github.com>
66 lines
2.8 KiB
TypeScript
66 lines
2.8 KiB
TypeScript
import {
|
|
defineConfig,
|
|
recommendedAcceptedAttributes,
|
|
recommendedAcceptedTags,
|
|
} from "i18next-cli";
|
|
|
|
|
|
const DEFERRED_I18N_LINT_FILES = [
|
|
// FNXC:i18n-LintBaseline 2026-06-20-00:00:
|
|
// FN-6770 and FN-6771 localized the remaining workflow/task/setup/PR and settings/sections clusters, so no dashboard component files remain deferred from hardcoded-string lint.
|
|
] as const;
|
|
|
|
/**
|
|
* i18next-cli workflow config for the whole monorepo.
|
|
*
|
|
* - `extract` pulls t()/<Trans> keys from the dashboard and CLI source into the
|
|
* authored `en` catalogs under @fusion/i18n.
|
|
* - `sync` propagates the `en` key structure to the secondary locales.
|
|
* - `types` regenerates key types from the `en` catalogs.
|
|
* - `status` runs the project key-parity gate: structure only, empty values allowed.
|
|
* - `status:report` preserves the upstream translation-completeness report.
|
|
* - `lint` flags hardcoded user-facing strings (primary guardrail).
|
|
*
|
|
* FNXC:i18n-ParityGate 2026-06-20-00:00:
|
|
* `pnpm i18n:status` points at packages/i18n/scripts/check-i18n-parity.mjs because empty secondary-locale values are intentional fallback placeholders, not gate failures.
|
|
* Use `pnpm i18n:status:report` when a human wants the upstream completeness report that still counts empty placeholders as untranslated.
|
|
*
|
|
* Namespaces are routed by the `ns:` prefix in keys / `useTranslation(ns)` in
|
|
* source, not by file path. `common` is the default namespace.
|
|
*/
|
|
export default defineConfig({
|
|
locales: ["en", "zh-CN", "zh-TW", "fr", "es", "ko", "pt-BR"],
|
|
extract: {
|
|
input: [
|
|
"packages/dashboard/app/**/*.{ts,tsx}",
|
|
"packages/cli/src/**/*.{ts,tsx}",
|
|
"!**/__tests__/**",
|
|
"!**/*.test.*",
|
|
],
|
|
output: "packages/i18n/locales/{{language}}/{{namespace}}.json",
|
|
primaryLanguage: "en",
|
|
defaultNS: "common",
|
|
keySeparator: ".",
|
|
nsSeparator: ":",
|
|
// FNXC:i18n-ParityGate 2026-06-20-00:00:
|
|
// Untranslated secondary-locale keys stay empty for runtime fallback to `en`; `status` now gates structural key parity only, while `status:report` measures real completion.
|
|
defaultValue: "",
|
|
},
|
|
types: {
|
|
input: ["packages/i18n/locales/en/*.json"],
|
|
output: "packages/i18n/src/i18next-resources.d.ts",
|
|
},
|
|
lint: {
|
|
/*
|
|
* FNXC:i18n-LintBaseline 2026-06-19-00:00:
|
|
* i18n lint must scan the same shipping surfaces as extract so it remains a trusted user-facing-copy guardrail.
|
|
* Tests and stories are excluded because they are non-shipping fixtures and extract already excludes test files.
|
|
* Keyboard-key glyphs inside <kbd> are technical tokens, not translated prose.
|
|
*/
|
|
ignore: ["**/__tests__/**", "**/*.test.*", "**/*.stories.*", ...DEFERRED_I18N_LINT_FILES],
|
|
ignoredTags: ["kbd"],
|
|
acceptedTags: recommendedAcceptedTags,
|
|
acceptedAttributes: recommendedAcceptedAttributes,
|
|
},
|
|
});
|