-
-
Notifications
You must be signed in to change notification settings - Fork 570
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
Silence i18n content collection warnings #1458
Conversation
🦋 Changeset detectedLatest commit: 4c71f27 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stop gap until we can upstream a fix!
Thanks for the review Nate 💖 |
Closes #1174
Currently, there are two warnings logged related to the i18n content collection when running our basic starter kit (i.e. with no i18n files set up):
A warning that an i18n collection is configured but doesn’t exist on disk (on dev/build start up):
A runtime error when Starlight actually calls
getCollection('i18n')
to again say that the collection directory doesn’t exist:Many of us Starlight users have trained ourselves to ignore these warnings, but they remain confusing especially for newer users who assume they need to fix something.
This PR addresses both of these points:
Removes the
i18n
collection set-up from our two starter templates, which stops Astro emitting that first warning. Means people have to add that manually if they need the custom i18n features, but we do already document that in our “Translate Starlight’s UI” docs.Hackily overrides
console.warn()
briefly while we make ourgetCollection('i18n')
call, so that we swallow the runtime error. Admittedly, this is a bit gross, but I considered the options and I feel like the warning does have quite a bit of value for your average Astro users, so removing it upstream seemed kind of unfair.@Princesseuh also suggested adding a “noWarn” option to the query APIs to support this officially. I think that could be a nice idea, but I’m not 100% sure the use case is widespread enough to justify that yet.