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
@133357986616836096do you still need help here?
Hi
@854377910689202256thank you for your answer! Yes, help would still be appreciated 🙂
this is possible and the errors are already localized i believe
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-LanguageYou 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
@133357986616836096thank you
@969226489549713438you 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.