[Proposal] Locale for Error Objects

So it boggles me to read there exists a statement about localization within the references for detail and title in the Error Objects, however there is no field for stating locale within error objects.

So here is a proposal for v1.1: Every Error Object SHOULD contain a locale member if the object is localized to a certain locale. This locale MUST follow the specification given by BCP47.

This proposal may extend to resource objects themselves, however that would better be left to the developer for obvious reasons.

I think this is what HTTP solved some years ago with the Accept-Language and Content-Language headers. :slight_smile:

The Content-Language entity header is used to describe the language(s) intended for the audience

Content-Language does not specify precisely what the locale is for a single resource.

Consider the following example:
Suppose you are given an API that delivers resources in English and German and the error in German. For the data, a possible (most probable) implementation of distinguishing locale would be directly in the attributes (given such an internationalized API). For the error, should we force ourselves to place the locale in the meta attribute? Deserialization would be simpler if the error object simply had it as a property as opposed to an embedded document. More so, serialization would be more of a nuisance because one must define a meta object especially for errors.