feat(docs): add translations block to docs.yml#15172
Conversation
🌱 Seed Test SelectorSelect languages to run seed tests for:
How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR. |
03f545f to
8341ae9
Compare
|
@claude review |
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
Docs Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on
Docs generation runs |
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via |
Add a `translations` block to `docs.yml` that lets users declare which locales their documentation supports, with an optional `default` flag. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add noop handler for the new `translations` field in the exhaustive ObjectPropertiesVisitor<DocsConfiguration> call inside visitDocsConfigFileYamlAst, fixing the TS2345 compile error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ParsedDocsConfiguration gains translationPages: Record<locale, pages> - parseDocsConfiguration reads translations/<lang>/ directories, errors clearly when a declared locale directory is missing, and warns about individual missing files (partial translations are allowed) - DocsDefinitionResolver exposes getTranslationPages() after resolve() - publishDocs calls POST /v2/registry/docs/translations/register for each locale after finishDocsRegister, using a direct axios call (registerTranslation is not yet in the published fdr-sdk version) - visitDocsConfigFileYamlAst gains translations: noop to satisfy the exhaustive ObjectPropertiesVisitor<DocsConfiguration> type - Integration tests use real temp directories to exercise FS loading Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Upgrades fdr-sdk from 1.1.13-c1ad12a2b8 to 1.1.23-d25ead8e05 which includes the registerTranslation SDK call used by the docs translations feature. Fixes resulting type errors: - IntegrationsConfig.context7 changed from string to FileId — suppress the raw path string by setting context7: undefined in parseDocsConfiguration (the resolved AbsoluteFilePath is already stored as context7File) - AiChatLocation now excludes "discord" in the SDK type — cast at the API boundary in DocsDefinitionResolver - Remove now-resolved @ts-expect-error directive for agents field Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a locale listed in `translations:` has no corresponding `translations/<lang>/` directory, and that locale is the default (first entry or marked `default: true`), skip it silently rather than erroring. The default locale's pages already live in `pages/`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
For i18n translations, the CLI now: 1. Uses gray-matter (from docs-resolver) to parse sidebar-title and slug overrides from translated page frontmatter 2. Walks the navigation tree and updates PageNode title/slug where translated pages have frontmatter overrides 3. Sends the fully-computed DocsDefinition (with updated nav root) to FDR so the server can write a correct LoadDocsForUrlResponse to S3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nResolver Address reviewer feedback requesting a missing blank line. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Filter 'discord' from AIChatLocation at runtime instead of using type cast - Add TODO comment documenting that translated pages bypass MDX transformation pipeline 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix language code jp -> ja in docs.yml example - Add preview mode guard to prevent translations overwriting prod in preview - Remove slug override support (requires proper composition with parent slugs) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add getCollectedFileIds() and getDocsWorkspacePath() to DocsDefinitionResolver - Re-export stripMdxComments and replaceImagePathsAndUrls from docs-resolver - Apply stripMdxComments to translated pages to prevent comment leakage - Preserve editThisPageUrl/editThisPageLaunch from base pages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Apply replaceImagePathsAndUrls to translated pages using base page path for resolution - Add comprehensive tests for applyTranslatedFrontmatterToNavTree - Remaining TODOs: <Markdown src=.../>, <CodeBlock src=.../>, @-prefix imports 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Hoist default locale skip above existence check in loadTranslationPages - Add superRefine validation to reject multiple default translations - Handle section nodes in applyTranslatedFrontmatterToNavTree (overviewPageId) - Rewrite editThisPageUrl to point to translated file path - Add tests for section node handling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Spread telemetry headers (X-CLI-Version, X-CI-Source, etc.) into translation registration fetch - Add logging for frontmatter parse errors in applyTranslatedFrontmatterToNavTree 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace `as any` with helper functions using proper type casts - Fix import ordering in docs-resolver/index.ts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The translation tests were failing because they only specified a single
translation locale without marking any as the default. The code treats
the first translation without a `default: true` flag as the default locale,
which means it gets skipped during translation loading.
Fixed by adding `{ lang: "en", default: true }` to each test's translations
config so the other locales (fr, ja) are correctly treated as translations.
Also fixes TypeScript errors in applyTranslatedFrontmatterToNavTree tests
by using optional chaining on array access.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
78dc728 to
91edb64
Compare
Regenerates the TypeScript SDK types and JSON schemas for the docs-yml API definition to include the translations configuration documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Updates IR test definition snapshots to include the new tokenPlaceholder field added in main. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
translationsblock todocs.ymlthat declares the locales a documentation site supportslang(one of the supportedLanguageenum values) and an optionaldefault: trueflagExample usage
Files changed
DocsYmlSchemas.tsTranslationConfigZod schema;translationsadded toDocsConfigurationTranslationConfig.tsinterface;translationsadded toDocsConfiguration.tsTranslationConfig.tsserializer;translationsadded to serializationDocsConfiguration.tsParsedDocsConfiguration.tsparseDocsConfiguration.tstranslationstranslationsproperty +docs.TranslationConfigdefinition in bothdocs-yml.schema.jsonfilesTranslationConfigtype andtranslationsproperty indocs.ymlTest plan
TranslationConfigZod schema (valid langs, invalid codes, optionaldefault)DocsConfigurationwithtranslationsfield (absent, single, multiple, mixed withlanguages)parseDocsConfigurationconfirmingtranslationspasses through correctlypnpm turbo run compile --filter @fern-api/configuration --filter @fern-api/configuration-loader— clean🤖 Generated with Claude Code