graduation-capCatalog Tutorials

How to localize your catalog

The name and the description attribute of a catalog support localization. This means that you can provide values in multiple languages and also retrieve those values either localized, or all together, as you choose. Localization is controlled by the Content-Language and Accept-Language headers:

  • Content-Language - this is used to specify which languages can be used in the request payload when creating or updating catalogs. The Content-Language request HTTP header defines language(s) that can be used in the payload. Request body may contain only translations that are matching the languages specified in the header. Possible values:

    • * - request body may contain translations for all languages specified in tenant configuration. This is also the default behaviour if the header is not set.

    • en, en,de, fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5 - request body may contain only translations for languages specified in the header (if they are available in tenant configuration).

  • Accept-Language - this is used to specify how to retrieve catalogs. If a value is provided, then the resources will be returned in that locale. If '*' is provided as a value, or the header is missing, all locales saved on a resource will be returned for that resource.

Note: When creating or updating catalogs, you must always provide localized fields (such as name and description) as maps of language codes to values, regardless of the Content-Language header value.

How to create a catalog and assign a category to it

You can assign categories to a catalog when creating or updating the catalog. The following procedure covers the latter scenario.

Create a catalog

circle-exclamation

To create a new catalog, you need to send a request to the Creating a new catalogarrow-up-right endpoint.

circle-check
rectangle-terminalAPI Referencechevron-right

Create a category

circle-exclamation
circle-check
rectangle-terminalAPI Referencechevron-right

Assign the category to the catalog

To assign the newly created category to a catalog, you need to send a request to the Partially updating a catalogarrow-up-right endpoint.

In the request body, insert the ID of the category into the categoryIds array. In this example, we also present how to set the visibility timeframe of the catalog with the visibility field.

circle-check
rectangle-terminalAPI Referencechevron-right
circle-exclamation

Last updated

Was this helpful?