Errorfile localization

Hello,

I’m looking for guidance on errorfile localization. I need to serve error pages in 3 different languages, supporting both HTML and JSON formats.

For HTML responses, I can determine the language using either cookies or domain name.
For JSON responses, I can use url parameter (?lang=xx).

What would be the recommended approach to implement this? Are there any existing solutions or best practices for serving localized error pages?

Thank you in advance for any suggestions!