Localize Errors

default discord avatar
5 months ago

Hi there!

Is there any possibility to localize the errors given back from the REST API?

I tried with "locale=de" for example, but it still gives me back the error in english.

If that's not possible, is there any possibility to get error codes instead of only messages so that I can create a way of translating it in the front-end?

  • discord user avatar
    Payload Team
    2 months ago

    Hi @zakoul do you still need help here?

  • default discord avatar
    2 months ago

    Hi @jesschow thank you for your answer! Yes, help would still be appreciated 🙂

  • discord user avatar
    Payload Team
    2 months ago

    this is possible and the errors are already localized i believe

    @dribbens will have detail there on how this is accomplished, but regardless, we need to get this in the docs

  • discord user avatar
    Payload Team
    2 months ago

    Yeah, the trick to remember here is that the


    param refers to the language for the data being accessed, but instead you're looking to set the


    on the request header. That is used to tell Payload what language the user expects.

    More info on the header can be found here:


    You can see it in action from the admin UI if you change your language in the account settings and then look at your http requests Headers:

    I hope this helps you @zakoul

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.