filter or querying list based on locale

default discord avatar
3 months ago

hi all!

i.e. set localization to ['gb', 'us', 'au']

there is a "Page" collection with locale (select) field with same options as localization

is it possible to filter list based on locale?

i want to render (or apply filter automatically) the list only with certain locale that chosen

is there a way to do this in payload?

thank you

just found that we can retrieve current locale from req, so the solution is something like this in collection access control

access: {
        // @ts-ignore
        read: ({req: {locale}}) => {
            return {
                locale: {
                    equals: locale
    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!


    Connect with the Payload Community on Discord



    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.