Skip to content

Fix Astro i18n default locale regression#3306

Merged
delucis merged 1 commit intowithastro:mainfrom
HiDeoo:hd-fix-default-locale-root
Jul 16, 2025
Merged

Fix Astro i18n default locale regression#3306
delucis merged 1 commit intowithastro:mainfrom
HiDeoo:hd-fix-default-locale-root

Conversation

@HiDeoo
Copy link
Copy Markdown
Member

@HiDeoo HiDeoo commented Jul 16, 2025

Description

This PR fixes a regression introduced in #3288 where I forgot that if your default language is your root locale, you can skip the defaultLocale option, but one can still specify it explicitly to root in the config.

When transforming the Starlight i18n config to an Astro i18n config, we already have some logic in place to handle this when defining paths, but I forgot to apply the same logic when defining the defaultLocale.

I also added a new test suite where the Starlight config explicitly sets the default locale to root (we didn't have this before).

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jul 16, 2025

🦋 Changeset detected

Latest commit: 442b2a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link
Copy Markdown

netlify bot commented Jul 16, 2025

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 442b2a1
🔍 Latest deploy log https://app.netlify.com/projects/astro-starlight/deploys/687785c1bfff9f000872594d
😎 Deploy Preview https://deploy-preview-3306--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Jul 16, 2025
Copy link
Copy Markdown
Member

@delucis delucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, my poor API design choices bite again 😅 — really would be nice to refactor what the locale config looks like internally at some point to avoid having to remember to handle these edge cases everywhere.

Thanks for taking care of this one @HiDeoo!

@delucis delucis added the 🌟 patch Change that triggers a patch release label Jul 16, 2025
@delucis delucis merged commit 21fcd94 into withastro:main Jul 16, 2025
16 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Jul 16, 2025
HiDeoo added a commit to shubham-padia/starlight that referenced this pull request Jul 16, 2025
* main:
  Exclude banner content from Pagefind indexing (withastro#3276)
  Restrict remark/rehype plugins usage (withastro#3274)
  [ci] release (withastro#3307)
  Fix Astro i18n default locale regression (withastro#3306)
  i18n(de): translate `plugins.mdx` and `community-content.mdx` (withastro#3304)
Yoxnear pushed a commit to Yoxnear/starlight-custom that referenced this pull request Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The default locale root is not present in the i18n.locales array.

2 participants