Skip to content

Fix invalid Astro i18n config with a single root locale#1993

Merged
delucis merged 2 commits into
withastro:mainfrom
HiDeoo:hd-fix-i18n-404-single-root-locale
Jun 12, 2024
Merged

Fix invalid Astro i18n config with a single root locale#1993
delucis merged 2 commits into
withastro:mainfrom
HiDeoo:hd-fix-i18n-404-single-root-locale

Conversation

@HiDeoo
Copy link
Copy Markdown
Member

@HiDeoo HiDeoo commented Jun 10, 2024

Description

This PR fixes an issue in the generated Astro i18n config when using a single root locale. The issue boils down to 2 problems:

  • In our schema, we branch when we have a multilingual site or monolingual site with only 1 non-root locale. Altho, the existing check (configuredLocales.length >= 1) was not singling out a website with a single root locale.
  • In the Astro i18n config generation process, when the config locales is not defined (which is the case when for a site with only 1 root locale configured), the locales was always being the built-in default locale instead of the configured defaultLocale.

To test these changes, I added an entirely new test suite with a configuration using only a single root locale which is one suite we were missing.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 10, 2024

🦋 Changeset detected

Latest commit: f75c495

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
starlight ✅ Ready (Inspect) Visit Preview Jun 12, 2024 11:06am

@github-actions github-actions Bot added the 🌟 core Changes to Starlight’s main package label Jun 10, 2024
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.

Thank you for the fix @HiDeoo!

@delucis delucis added the 🌟 patch Change that triggers a patch release label Jun 12, 2024
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.

Status 404 for existing pages

2 participants