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?
Hi @zakoul do you still need help here?
Hi @jesschow thank you for your answer! Yes, help would still be appreciated 🙂
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
Yeah, the trick to remember here is that the
locale
param refers to the language for the data being accessed, but instead you're looking to set the
Accept-Language
on the request header. That is used to tell Payload what language the user expects.
More info on the header can be found here:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
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
thank you @dribbens you solved my problem too. It would be nice to get this in the doc
Star
Discord
online
Get dedicated engineering support directly from the Payload team..