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

feat(i18n): domain support #9143

Merged
merged 70 commits into from
Jan 31, 2024
Merged

feat(i18n): domain support #9143

merged 70 commits into from
Jan 31, 2024

Conversation

ematipico
Copy link
Member

@ematipico ematipico commented Nov 20, 2023

Changes

Closes PLT-1317

This PR adds domain support for i18n routing.

Here's the relevant RFC: withastro/roadmap#798

Technical changes

As stated in the RFC, there are a bunch of restrictions when enabling this functionality:

  • base must be set
  • output must be server
  • we shouldn't have pre-rendered pages

Hence, I added a bunch of errors and validation for the configuration schema

Theoretically, the Node.js adapter is the only one that would require less work to set up domains. Some work is still needed because the reserve proxy of the application needs to send the proper headers to the Node.js server, as explained in the RFC. Regardless, I preferred to mark the support as experimental.

Regarding the Vercel adapter, I decided to mark it unsupported for now, although I am open to considering "experimental" too. I want to highlight that serverless environments require more work to set multiple domains, and I am not sure if we were able to set them up from the vercel.json; for this reason I am not sure how to communicate it, and that's why I set unsupported.

Update: myself and @matthewp decided to flag the support as experimental.

Testing

I added new tests that should verify the new behaviour of the *Absolute functions.

I added new integrations tests to very that the Requests are correctly handled when we send the proper headers.

Docs

/cc @withastro/maintainers-docs for feedback!

Copy link

changeset-bot bot commented Nov 20, 2023

🦋 Changeset detected

Latest commit: 666f3e3

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 pkg: integration Related to any renderer integration (scope) labels Nov 20, 2023
@ematipico ematipico changed the title i18n(domains): validation and updated logic (#9099) feat(i18n): domain support Nov 21, 2023
@ematipico ematipico marked this pull request as ready for review November 21, 2023 15:11
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.

Did a quick review of the changeset first! (Have not yet looked at the API docs) because I want to make sure I understand what's happening here to get the API descriptions just right!

.changeset/tidy-carrots-jump.md Outdated Show resolved Hide resolved
.changeset/tidy-carrots-jump.md Outdated Show resolved Hide resolved
Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

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

I think it's better to use the 1 arg form of new URL unless there's a reason to do it the other way that I can't think of?

ematipico and others added 2 commits November 21, 2023 11:32
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by:  Matthew Phillips <[email protected]>
Copy link
Contributor

@matthewp matthewp left a comment

Choose a reason for hiding this comment

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

We're going to release this in 4.x

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.

Thanks for your help with this one, @ematipico ! I fixed some silly formatting/typos in the changeset, but I think it's now quite good!

Had a suggestion for each of the config items. They might be a bit verbose, but we can always refine them, and once we've finalized the guide, we'll know for sure which info we want there vs here. I think these are still the minimum we might want someone to see when they're looking things up in reference, though? Let's see what we think!

.changeset/tidy-carrots-jump.md Outdated Show resolved Hide resolved
.changeset/tidy-carrots-jump.md Outdated Show resolved Hide resolved
.changeset/tidy-carrots-jump.md Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
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.

OK! These update to the agreed-upon configuration set up! I'm happy with the changeset as is, but still want to fine-tune the docs entry, especially because of the experimental-ness of it. (This entry doesn't explicitly mention the experimental flag, for example and we must do that!

I'm thinking that maybe we should put the docs entry under Experimental Flags. I think that makes the most organizational sense, and would make the instruction to enable a flag, then add a domains to a pre-configured i18n site easier to include here. Being experimental, this feature might change anyway. And even if it doesn't that means editing more than just the name of this entry to update config-reference here. So I'm not convinced we save much by having it here vs experimental.

Another option could be to write this entry here as if it were NOT experimental, just not expose it to docs. Then, add a complete corresponding entry as if it IS expermental in the Experimental flags section that DOES show up in docs. When it's no longer experimental, we entirely delete the experimental entry and (making sure it's updated), then add back @docs here. (If I'm writing this once, copy and paste is free!)

Thoughts?

.changeset/tidy-carrots-jump.md Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
packages/astro/src/@types/astro.ts Outdated Show resolved Hide resolved
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.

ALRIGHT! I am approving for the sake of completion! 🥳

If there are any syntax errors or nits, I'll find them after this is merged on Wed. and I can check and make any quick fixes well before releasing on Thursday. 🫡

@ematipico ematipico dismissed stale reviews from github-actions[bot] and matthewp January 31, 2024 13:54

Merge day

@ematipico ematipico merged commit 041fdd5 into main Jan 31, 2024
14 checks passed
@ematipico ematipico deleted the feat/i18n-domain branch January 31, 2024 13:55
@astrobot-houston astrobot-houston mentioned this pull request Jan 31, 2024
@jlarmstrongiv
Copy link

I’m getting errors, despite not using i18nDomains

19:01:17 [ERROR] [config] The feature "i18nDomains" is not supported (used by astro-sst).
19:01:17 [ERROR] The adapter astro-sst doesn't support the feature i18nDomains. Your project won't be built. You should not use it.

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) pkg: create-astro Related to the `create-astro` package (scope) pkg: integration Related to any renderer integration (scope) pr: docs A PR that includes documentation for review semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants