Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(i18n): emit an error when the index isn't found #9678

Merged
merged 5 commits into from
Jan 12, 2024

Conversation

ematipico
Copy link
Member

@ematipico ematipico commented Jan 12, 2024

Changes

We've had more than one report where users didn't add a index page when they use the option i18n.routing.prefixDefaultLocale to true.

The index page is required to create a redirect from / to /<defaultLocale>.

This PR adds a check during the build, and emits an error if the index is missing.

Testing

There was a case where a fixture didn't have the index, and the test cases were still passing.
These fixtures were now raising an error, and I added the index page.

Docs

/cc @withastro/maintainers-docs for feedback!

Copy link

changeset-bot bot commented Jan 12, 2024

🦋 Changeset detected

Latest commit: 00c9fb5

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

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

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review labels Jan 12, 2024
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

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

Docs is happy with the error message! (c @Princesseuh to confirm the syntax/formatting!)

.changeset/proud-guests-bake.md Outdated Show resolved Hide resolved
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

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

Format looks great!

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
@ematipico ematipico merged commit 091097e into main Jan 12, 2024
4 checks passed
@ematipico ematipico deleted the fix/i18n-error-missing-index branch January 12, 2024 14:14
@astrobot-houston astrobot-houston mentioned this pull request Jan 12, 2024
ematipico added a commit that referenced this pull request Jan 12, 2024
* fix(i18n): emit an error when the index isn't found

* changeset

* Update .changeset/proud-guests-bake.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* rename

* Update packages/astro/src/core/errors/errors-data.ts

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
ematipico added a commit that referenced this pull request Jan 17, 2024
* feat(i18n): disable redirect

* feat(i18n): add option to disable redirect to default language

* chore: add schema validation

* docs

* changeset

* Update packages/astro/src/core/config/schema.ts

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* chore: address feedback

* fix test

* Update .changeset/cyan-grapes-suffer.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* Fix discord fetch code (#9663)

* Force re-execution of Partytown's head snippet on view transitions (#9666)

* Remove the header script before a view transition takes place to force a reload on the next page

* Add changeset

* Save another char

* [ci] format

* fix(assets): Implement all hooks in the passthrough image service (#9668)

* fix(assets): Implement all hooks in the passthrough image service

* chore: changeset

* refactor(toolbar): Rename every internal reference of overlay/plugins to toolbar/apps (#9647)

* refactor(toolbar): Rename every internal reference of overlay/plugins to toolbar/apps

* refactor: rename vite plugin

* fix: update import

* nit: add setting fallback

* Disable file watcher for internal one-off vite servers (#9665)

* Use node:test and node:assert/strict (#9649)

* [ci] format

* fix(i18n): emit an error when the index isn't found (#9678)

* fix(i18n): emit an error when the index isn't found

* changeset

* Update .changeset/proud-guests-bake.md

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>

* rename

* Update packages/astro/src/core/errors/errors-data.ts

Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>

---------

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>

* feat(i18n): add option to disable redirect to default language

* chore: rebase

* Update packages/astro/src/@types/astro.ts

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>

* lock file update

---------

Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com>
Co-authored-by: Martin Trapp <martrapp@users.noreply.github.com>
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
Co-authored-by: Bjorn Lu <bluwy@users.noreply.github.com>
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) pr: docs A PR that includes documentation for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants