Skip to main content

Overview

The Contazen API supports localization for error messages and responses. Currently, the API supports:
  • English (en) - Default
  • Romanian (ro)

Setting the Language

There are three ways to specify your preferred language: Use the standard HTTP Accept-Language header:

2. Query Parameter

Include the locale parameter in the URL:

3. Request Body

For POST and PUT requests, include locale in the JSON body:

Priority

If multiple methods are used, the API follows this priority order:
  1. Query parameter (?locale=ro)
  2. Request body ("locale": "ro")
  3. Accept-Language header
  4. Default to English (en)

Response Header

The API includes a Content-Language header in all responses to indicate the language used:

Localized Elements

The following elements are localized:

Error Messages

Field Labels

Field validation messages are localized based on the context:

Examples

Creating an Invoice with Romanian Errors

Request:
Response:

Retrieving Non-existent Client

Request:
Response:

Language Detection

If no language preference is specified, the API attempts to detect the language from the Accept-Language header:
  • If the header contains ro (e.g., ro-RO, ro), Romanian is used
  • Otherwise, English is used as the default

Best Practices

  1. Consistency - Use the same language setting method throughout your application
  2. User Preference - Store user language preferences and apply them to all API requests
  3. Fallback Handling - Always handle English responses as a fallback
  4. Header Method - Prefer the Accept-Language header for RESTful compliance

Notes

Success messages and data field names remain in English regardless of the locale setting. Only error messages and validation messages are localized.
Not all error messages may be translated. If a translation is missing, the English version will be returned as a fallback.