contentful.js
contentful.js copied to clipboard
How can I disable the locale fallback using this package?
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
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 tonull
.
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,
}),
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.