contentful.js icon indicating copy to clipboard operation
contentful.js copied to clipboard

How can I disable the locale fallback using this package?

Open adamchipperfield opened this issue 4 years ago • 1 comments

Expected Behavior

To set some sort of parameter to tell the client not the fall back to the default locale.

Actual Behavior

No documented way to do this.

Context

I just have a query where we don't want to fall back because of country specific content. So if no content is specified in French, for example, then nothing should be returned.

Note that this is just for a single query, so I do not want to change my Contentful locale configuration.

Environment

Node.js

  • Language Version: v12.20.1
  • Package Manager Version: v12.20.1
  • Package Version: ^7.14.5
  • Which API are you using?: Delivery

adamchipperfield avatar Jan 11 '21 16:01 adamchipperfield

I have the exact same problem – how would I accomplish this?

I found this small part in the documentation:

If you don't want a locale to fallback to anything, set its fallbackCode property to null.

But I tried putting that into a getEntries request but that does not work:

$contentful.getEntries({
  limit: 500,
  content_type: 'coach',
  order: 'fields.name',
  locale: app.i18n.locale,
  fallbackCode: null,
}),

HerrBertling avatar Jan 31 '21 13:01 HerrBertling

This ticket has been closed due to inactivity. If you still need help resolving your issue, please reach out through our community Slack, or contact Contentful support directly.

mayakarabula avatar Jun 13 '23 15:06 mayakarabula