-
-
Notifications
You must be signed in to change notification settings - Fork 832
Expose FS translation system to plugins #2578
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
Expose FS translation system to plugins #2578
Conversation
🦋 Changeset detectedLatest commit: a6661b3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
✅ Deploy Preview for astro-starlight ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| ...otherStyleOverrides, | ||
| }, | ||
| getBlockLocale: ({ file }) => pathToLocale(file.path, { starlightConfig, astroConfig }), | ||
| getBlockLocale: ({ file }) => pathToLang(file.path, { astroConfig, starlightConfig }), |
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.
Expressive Code technically expects a Starlight language here so I changed it but this is not a bug fix (no changeset) as Expressive Code lower-cases the language identifier anyway.
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
delucis
left a comment
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.
This looks great @HiDeoo! Left some suggestions/questions/discussions, but they’re honestly all around the “outside” of the core functionality or on the docs. I think overall this seems very solid 🚀
| // strings. We let TypeScript merge them into a single union type so that plugins with a TypeScript | ||
| // configuration preventing `UserI18nKeys` to be properly inferred can still get auto-completion | ||
| // for built-in UI strings. | ||
| export type I18nKeys = keyof BuiltInStrings | UserI18nKeys | keyof StarlightApp.I18n; |
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.
Ahhhhhh, nice fix! 🧠
|
Thanks for the review 🙌 Holding off on the suggested changes so I can tackle them all at once when we have a clearer idea of what we want to do regarding the name. |
* main: (27 commits) i18n(ko-KR): update `site-search.mdx` [ci] release (withastro#2590) Support passing more options to the DocSearch component (withastro#2589) [ci] release (withastro#2587) Add changeset for withastro#2252 (withastro#2588) [ci] format Update dev dependencies (withastro#2582) Build performance optimizations for projects with large sidebars (withastro#2252) Fix a11y CI workflow (withastro#2503) Update `astro-expressive-code` to v0.38 (withastro#2551) Added social icon for Nostr (withastro#2579) [ci] format docs(showcase): add docs.reactbricks.com to showcase (withastro#2586) i18n(ja): Update site-search.mdx (withastro#2577) i18n(ja): Update pages.mdx (withastro#2576) i18n(fr): Update `reference/plugins.mdx` from withastro#2549 (withastro#2574) [ci] format docs: update showcase-sites.astro (withastro#2562) Throw an error if a showcase image does not have the required dimensions (withastro#2573) i18n(ja): Update frontmatter.md (withastro#2566) ...
Co-authored-by: Chris Swithinbank <[email protected]>
|
Updated the branch with the changes discussed above, hope I did not forget anything:
I have a question: this PR adds multiple changesets but I think |
Makes sense, that was also my guess, thanks. I added a new todo to the PR body to remember about that. |
delucis
left a comment
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.
Perfect! Just noticed one detail with the DocSearch update.
Co-authored-by: Chris Swithinbank <[email protected]>
delucis
left a comment
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.
Perfect! OK, should be ready to go I think! I’m thinking of trying to get Astro.locals ready too, so that these two changes breaking plugins can go out together. I think we’re almost there.
Makes sense 👍 I already gathered some feedback/concerns regarding the route data PR to publish when it's ready for review, really excited about this one 🤩 |
I'm not 100% sure, but I think that changesets just reads the files alphabetically, which means changing the filename from Altho I have to say, I personally would also double check it in the ci PR later, so leaving the ToDo is also my recommendation. Nonetheless, trying it out would be interesting 🤔
|
|
Wait, this PR also got merged today?!? Holy moly, how incredible is that! 💝 |
Co-authored-by: Chris Swithinbank <[email protected]>
* main: (493 commits) i18n(de): update `sidebar.mdx` (withastro#2900) Adding all samples for badges in sidebar as example (withastro#2881) i18n(fr): fix highlighting in `reference/plugins.md` (withastro#2898) i18n(fr): update `reference/plugins` & `guides/i18n` (withastro#2886) i18n(fr): update `reference/overrides` & `guides/sidebar` (withastro#2887) i18n(fr): add `guides/route-data` and `reference/route-data` (withastro#2884) i18n(fr): update `guides/overriding-components` (withastro#2885) i18n(fr): update `reference/configuration` (withastro#2888) i18n(de): update German translation with withastro#2578 (withastro#2882) [ci] format i18n(ru): update some translations (withastro#2895) i18n(de): update `reference/configuration.mdx` (withastro#2883) [ci] format i18n(ko-KR): update `configuration.mdx` (withastro#2892) i18n(ko-KR): update `overrides.md` (withastro#2893) i18n(ko-KR): update `overriding-components.mdx` (withastro#2890) i18n(ko-KR): update `i18n.mdx` and `plugins.md` (withastro#2889) [ci] format i18n(ko-KR): create `guides/route-data.mdx` and `reference/route-data.mdx` (withastro#2896) i18n(ko-KR): update `/resources/plugins.mdx` (withastro#2894) ...
Co-authored-by: Chris Swithinbank <[email protected]> Co-authored-by: Chris Swithinbank <[email protected]>

Description
This plugin exposes the file system translation system to Starlight plugins throught the
setuphook using a newuseTranslations()callback function.This change requires the addition of a new plugin hook (currently named
init, I picked the first thing coming to mind to get started) which now exposes theinjectTranslations()callback function (which was previously available in thesetuphook).The documentation so far is only a rough draft to get an idea of everything changed.
Remaining tasks
docs/astro.config.mjsfiledocs/package.jsonfiledocs/src/content/i18n/zh-CN.jsonfilepackages/demo-plugin/directorypnpm ito remove mention of thestarlight-demo-pluginpackage in the lockfile// TODO(HiDeoo)comments (if any).changeset/polite-fishes-remain.mdcomes first (Deprecates the Starlight plugin `setup` hook in favor of the new `config:setup` hook which provides the same functionality.)