watermarkchurch / wcc-contentful

An alternative to Contentful's contentful.rb ruby client, contentful_model, and contentful_rails gems all in one.
MIT License
2 stars 1 forks source link

Full Locale support #271

Closed gburgett closed 1 year ago

gburgett commented 1 year ago

This PR adds locale support to the gem. I've been working on it for a while and finally got a spot where I think it can be merged and tested.

This PR also corrects a mistake I made when designing the gem the first time. Currently the CDN Adapter always requests locale=* to get entry fields in this format:

"fields" {
  "title" {
    "en-US": "foobar"
  }
}

It made it easier to integrate it with the Model layer, because the Sync endpoint also gets entries in that format and we store them in the sync stores in that format. But ultimately, it's better to request the specific locales we want. To this end I've modified most of the query fixtures to be the locale=en-US format, rather than the locale=* format.

I was able to accomplish the translation between the locale=* format and the locale=en-US format using a Store middleware, that made it really easy to isolate that code!

fixes #121

watermarkchurch-deployment commented 1 year ago
2 Warnings
:warning: This is a big pull request - please break it up into smaller units of work
:warning: No issue referenced - please create an issue describing a single unit of work and reference it using "closes #[the issue number]"

Generated by :no_entry_sign: Danger

gburgett commented 1 year ago

Used in https://github.com/watermarkchurch/reengage.com/pull/330