Skip to content

refactor(i18n): compute preferred locales lazily#8997

Merged
ematipico merged 3 commits intofeat/i18n-routingfrom
chore/make-globals-lazy
Nov 6, 2023
Merged

refactor(i18n): compute preferred locales lazily#8997
ematipico merged 3 commits intofeat/i18n-routingfrom
chore/make-globals-lazy

Conversation

@ematipico
Copy link
Copy Markdown
Member

Changes

From the API bash session, a suggestion was to compute preferredLocale and preferredLocaleList lazily. To do so, we agreed that i18n.locales cab be passed down to the point where we compute the context for the endpoints, and the Astro faux-global.

This PR does that by removing the computation of preferredLocale and preferredLocaleList from the three pipelines, and instead, we simply pass locales. The computation is moved inside two new getters.

Testing

This is a refactor, so existing functionality should not change and the existing tests should still pass.

Docs

N/A

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Nov 3, 2023

⚠️ No Changeset found

Latest commit: 25c644e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a 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 Nov 3, 2023
@ematipico ematipico requested a review from matthewp November 3, 2023 17:51
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.

3 participants