Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Payload 2.0 Localize error

default discord avatar
artemszelenovlast year
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
    last year

    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
    artemszelenovlast year

    yes shure



    @969226489549713438

    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
    last year

    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

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.