Skip to content

feat: add support for locales=* Contentful responses #24

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

Merged
merged 9 commits into from
Apr 16, 2020

Conversation

zernie
Copy link
Contributor

@zernie zernie commented Mar 31, 2020

Fixes #20

Overview

Add a new --localization flag. When enabled, generated fields will wrapped in LocalizedField helper , for example:

      export interface IMyContentTypeFields {
        /** Array field */
        arrayField: LocalizedField<(\"one\" | \"of\" | \"the\" | \"above\")[]>
      }

This flag is very useful when entries are being fetched with locale="*".

Notes

  • field.required is ignored, because contentful api ignores it as well.
  • we have to use a custom localized version of Asset

This change is Reviewable

@zernie
Copy link
Contributor Author

zernie commented Mar 31, 2020

@stevenpetryk btw, can you please explain the importance of this line?

From what I understand, if a key is present in the json fetched from contentful api, it will not be undefined, so the line below should be enough.

@zernie zernie force-pushed the feat/localization-flag branch from 8bbedc1 to 542b456 Compare March 31, 2020 13:04
@zernie zernie force-pushed the feat/localization-flag branch from 542b456 to 9d76a9b Compare March 31, 2020 13:04
Copy link
Contributor

@stevenpetryk stevenpetryk left a comment

Choose a reason for hiding this comment

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

Nicely done. Thanks a bunch for the contribution.

@stevenpetryk stevenpetryk changed the title [feat] localization flag feat: localization flag Apr 16, 2020
@stevenpetryk stevenpetryk changed the title feat: localization flag feat: Add support for locales=* Contentful responses Apr 16, 2020
@stevenpetryk stevenpetryk changed the title feat: Add support for locales=* Contentful responses feat: add support for locales=* Contentful responses Apr 16, 2020
@stevenpetryk stevenpetryk merged commit 0a13f48 into intercom:master Apr 16, 2020
@stevenpetryk
Copy link
Contributor

@stevenpetryk btw, can you please explain the importance of this line?

I'll admit, this is based on some odd typings in Intercom's marketing site codebase 😆I don't know if it's still necessary.

@stevenpetryk
Copy link
Contributor

🎉 This PR is included in version 3.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] Pulling multiple locales
2 participants