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

getEntries with set locale

Open davidvm1 opened this issue 3 years ago • 1 comments

It's a simple issue. Idk if this is a feature request, but you can't specify the locale when executing contentfulClient.getEntries().

I' ve tried something like this: contentfulClient.getEntries({ content_type: 'some-content-type', }, {locale: 'en-US'}) but no success.

What can I do to fetch the entries of a content_type in another locale?

davidvm1 avatar May 26 '22 23:05 davidvm1

Hi David,

what you are trying to achieve should be possible like this:

client.getEntries({ content_type: 'some-content-type', locale: 'en-US' });

For further information check out the documentation: https://contentful.github.io/contentful.js/contentful/9.1.18/ContentfulClientAPI.html#.getEntries

Please let me know if this resolved your issue.

andreascful avatar May 30 '22 12:05 andreascful

Closing due to inactivity for now - please feel free to re-open.

marcolink avatar Oct 31 '22 10:10 marcolink

Seems like the locale param works, but the type definition does not include it and, at the moment, we need to use @ts-ignore. Any way around that?

arpadgabor avatar Aug 07 '23 14:08 arpadgabor