Concepts > HTTP Headers > Locale
OverviewConceptsHTTP HeadersLocale
Locale

The term Locale in our context refers to a combination of language and variant, such as British English vs Australian English. In this case, English is the language, while British English represents the locale. It's worth noting that other systems may use the term 'locale' more broadly, but in the context of this HTTP header, it only affects the language used.

Lana provides the flexibility to use multiple locales for your shops. Each shop will have a default locale configured. In the absence of a Locale header, the API assumes that all returned data is in the default locale. However, you can activate additional locales and then adjust selected portions of data for a specific language locale.

By specifying a value for the Locale header, the API strives to return data that aligns more closely with the requested locale. For instance, if you specify en-GB as the locale, but data is only defined for en and the shop's default locale is fr, the data returned will be in en. The fallback logic is not explicitly defined, but it primarily involves moving from the most specific locale to the least specific locale, and then to the shop's default locale.

Nonetheless, there may be instances where you need to determine if data is available for a specific locale, such as a set of images on a product variant. This is where the concept of a strict locale comes into play. By prefixing the header value with an exclamation point (e.g. !en-GB), all fallback logic is negated. The strict locale feature should only be used for data authoring purposes and holds no utility for end-user data consumption.

In summary:

  • When displaying data to end users, use the default form.
  • When manipulating data via the commerce API, use the strict form.
Loading module
PREVIOUS
Authorization
NEXT
Session-Id