Translate Product Data
General
You can use the create attribute translations endpoint to create new or update existing simple attribute translations.
Translations for advanced attributes are provided with the respective entity itself.
Admin API
Create Attribute Translations
When you work with attribute translations, you can only create and update simple attributes with this endpoint. Simple attributes contain clearly defined single values, e.g., size or color options.
About this Method
The method is used to create new or update existing simple attribute translations.
This method cannot be used to create or update advanced attribute translations. Please use the endpoints to create products/variants if you need to modify advanced attributes and their translations.
Method Signature
adminApi.apis.Translations.updateOrCreateAttributeTranslations({attributeName: attributeName}, {requestBody: translations});
Details
The provided value must include a translation for the default system language. It is used to resolve an existing attribute value you wish to add translations for. This means, that it is not possible to add translations for an attribute, which has not been yet created via the product creation or a similar endpoint.
Create Attribute Translations
let translations = {
de_DE: "weiß",
en_GB: "white"
};
adminApi.apis.Translations.updateOrCreateAttributeTranslations({attributeName: "color"}, {requestBody: translations});
Get a Collection of Attribute Translations
You can not only retrieve translations for single simple attributes. By extending your query, you can also get multiple translations.
About this Method
This method can be used to get a collection of translations for an existing simple attribute.
The method does not return advanced attribute translations.
Method Signature
$translationCollection = $adminApi->attributeTranslations->all(string $attributeName);
Parameters
Parameter | Details |
---|---|
entities | Object A collection of attribute translations. |
Examples
let response = await adminApi.apis.Translations.getAttributeTranslations({attributeName: "color"});
let translations = response.body.entities;