Skip to content

[web-9081] The API Docs are translatable - #39684

Merged
bgdeutsch merged 8 commits into
jen.gilbert/astro-basefrom
brian.deutsch/web-9081-api-docs-translatable
Sep 4, 2026
Merged

bgdeutsch merged 8 commits into
jen.gilbert/astro-basefrom
brian.deutsch/web-9081-api-docs-translatable

Conversation

@bgdeutsch

@bgdeutsch bgdeutsch commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do? What is the motivation?

  • wires astro's i18n to the existing shared glossary via a new @shared alias, so translations come from shared/i18n/*.json now.
  • components now read their own locale from built-in Astro.currentLocale instead of requiring a lang prop threaded down from each page.
  • localizes the API docs side nav, breadcrumbs, schema tables, response/code-example headings, copy buttons (all prev hardcoded to english)
  • localizes the global header, footer, and mobile nav. these read from menuData.ts / footerMenus.ts, which had no locale at all and silently rendered english everywhere.
  • i18n(key, lang) requires the locale, these changes introduce useTranslations(locale) which returns a bound translate(key) so call sites can't forget it. inspired by a similar pattern i saw in websites-astro.
  • /{lang}/api/ now redirects to /{lang}/api/latest/ for all five locales, albeit with an open question about redirects.

Merge readiness

  • Ready for merge

For Datadog employees:

  • ⚠️ Your branch name MUST follow the <name>/<description> convention and include the forward slash (/). If you've already created your PR with an incorrect branch name, please rename your branch and open a fresh PR.
  • 🤖 New: Comment with /review to run an automated check that catches common issues before a Documentation team member reviews your PR.

AI assistance

Additional notes

to test, pull down this branch locally and start the dev server. translate.yaml config changes already landed and the shared directory is already pulled into the localization system.

Translations

  • Across all locales, API docs appear translated properly.
  • Left side nav is translated
  • Global header/footer/mobile menu
  • i18n strings ("Datadog Docs", "Overview", "Response", "Code Example", etc)
  • Links such as in the nav or on the category list page point to the correct locale

Redirects
English and localized pages redirect:

  • /api to /api-latest
  • /api/screenboards/ to /api/latest/dashboards/
  • /api/latest/downtimes/s to /api/latest/downtimes/
  • etc

bgdeutsch and others added 4 commits September 1, 2026 14:08
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… lang props

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…glish

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Preview links (active after the build_preview check completes)

No changed files under hugo/content/en/, e.g. this PR only touches the Astro API docs app:

@bgdeutsch
bgdeutsch marked this pull request as ready for review September 3, 2026 20:18
@bgdeutsch
bgdeutsch requested a review from a team as a code owner September 3, 2026 20:18
@bgdeutsch
bgdeutsch merged commit 09b871f into jen.gilbert/astro-base Sep 4, 2026
20 checks passed
@bgdeutsch
bgdeutsch deleted the brian.deutsch/web-9081-api-docs-translatable branch September 4, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants