Payload 2.0 Localize error

default discord avatar
zelenovsky
last month
3

Accept-Language header worked before 2.0 update as described here


https://discord.com/channels/967097582721572934/1097227850404348005

, but after 2.0 it ignores this header

  • discord user avatar
    dribbens
    Payload Team
    last month

    I'll have to take a look at this. I thought we had test coverage on this, if not we should add them.


    Can you create a GitHub issue with Steps to recreate?

  • default discord avatar
    zelenovsky
    last month

    yes shure



    @dribbens I started to describe the issue and I thought why don't I replace fetch function provided by node to fetch function provided by sveltekit (I use payload with sveltekit app) and it worked! I got localized error.



    But I am still confused about the reason. Headers are the same, maybe you added some additional conditions in v2?



    here is my fetch function:



    export const login = async ({ fetch, email, password }: LoginParams) => {


    return fetch(

    ${BACKEND_URL}/api/users/login

    , {


    method: 'POST',


    credentials: 'include',


    headers: {


    'Content-Type': 'application/json',


    'Accept-Language': 'ru'


    },


    body: JSON.stringify({


    email,


    password


    }),


    });


    }

  • discord user avatar
    dribbens
    Payload Team
    last month

    I don't think the function for fetch would matter. Nothing changes AFAIK for 2.0 regarding the i18n support, same package, maybe a version change but nothing that would be breaking.


    If anything it would be a caching situation or something else even more obsecure.


    If you can reproduce the problem, please open an issue on github

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

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