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

CTF-next: locale per context (DRAFT) #31521

Draft
wants to merge 35 commits into
base: feat/contentful-schema-generation
Choose a base branch
from

Conversation

axe312ger
Copy link
Collaborator

@axe312ger axe312ger commented May 21, 2021

The current plugin creates a node for every translation you have for each entry. This leads to DB bloat, especially if you content is only partly translated.

This is part of #31385, the code yet still needs cleanup.

This change will:

  • pass the page locale as page context to the query, no more hard coded locales
  • get a field in another language. Useful for linking news in other languages.
  • will reduce the node count drastically. Before (entries + assets) * locales + a few, soon we will have entries + assets + a few
  • potentially allowing custom locale fallbacks

ToDos

  • proof of concept of context based i18n
  • we can finally mix languages in one query
  • let filters work with the new locale context
  • devs should be able to set the desired locale for filtering in the query root
  • load default locale from Contentful
  • finally disable node duplication
  • There is a call stack overflow in the e2e tests. Figure out what this is.
  • Update output of e2e test site
  • Update actual e2e tests
  • Cleanup

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 21, 2021
@vladar vladar added topic: source-contentful Related to Gatsby's integration with Contentful and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 21, 2021
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 4656166 to 61f846c Compare June 10, 2021 15:37
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 61f846c to a5ddad2 Compare June 10, 2021 16:06
@axe312ger axe312ger added the breaking change If implemented, this proposed work would break functionality for older versions of Gatsby label Jun 11, 2021
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 849e5a3 to 05324da Compare July 12, 2021 12:26
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch 2 times, most recently from 4f7e213 to 3a03727 Compare July 27, 2021 09:29
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 380d85b to c342248 Compare November 18, 2021 14:26
@axe312ger axe312ger changed the title CTF-v6: locale per context (DRAFT) CTF-next: locale per context (DRAFT) Nov 19, 2021
@axe312ger axe312ger force-pushed the feat/contentful-locale-per-context branch from cccee87 to b63e42c Compare November 26, 2021 14:26
@axe312ger axe312ger force-pushed the feat/contentful-locale-per-context branch from b63e42c to 1ba56ad Compare January 6, 2022 10:19
@axe312ger
Copy link
Collaborator Author

Note to myself: The rename of ContentfulReference to ContentfulEntity should be part of the original PR for this new major version!

@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 5ce5b86 to a5715aa Compare January 6, 2022 15:59
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from a5715aa to 6086c52 Compare January 14, 2022 15:10
@axe312ger axe312ger force-pushed the feat/contentful-locale-per-context branch 2 times, most recently from 5f3248b to 607af74 Compare January 14, 2022 15:17
// }
// @todo we need to figure out the querys locale

if (args.locale) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@todo when using GraphQL filters, the locale arg isn't supported yet

@@ -131,3 +131,5 @@ List of locales and their codes can be found in Contentful app -> Settings -> Lo
plugins: Joi.array(),
})
.external(validateContentfulAccess)

exports.pluginOptionsSchema = pluginOptionsSchema
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@todo es-module syntax!

@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from ddc5f0a to 6609fd2 Compare February 2, 2022 13:04
@axe312ger axe312ger force-pushed the feat/contentful-locale-per-context branch from c0a8627 to d92be35 Compare February 10, 2022 13:07
`id`,
`internal`,
`parent`,
]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This change should be part of #30855

@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 351d89e to ef6b579 Compare March 9, 2022 14:31
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 776a15e to bf32fae Compare April 14, 2022 09:55
@axe312ger axe312ger added the type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. label May 17, 2022
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch 3 times, most recently from c3fc6da to 8aa8f20 Compare May 17, 2022 13:25
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 8aa8f20 to 7ea4514 Compare May 24, 2022 12:22
@axe312ger
Copy link
Collaborator Author

The relevant changes of this PR are here: d92be35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change If implemented, this proposed work would break functionality for older versions of Gatsby topic: source-contentful Related to Gatsby's integration with Contentful type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants