The Translation Published Content API allows you to query translated content that has been marked as ready to publish and listen for events when this content is created, updated, or deleted. Use the API to ensure that site visitors see the relevant translation for their locale, providing a seamless multilingual experience.
With the Translation Published Content API, your app can:
This API is based on Wix Multilingual.
It's important to note the following points before starting to code:
You can only query content that has been marked as ready to publish. This happens when:
"published": true
with the Create Content or Update Content methods of the Translation Content API.published
status to true
.You can only use this API on sites where the Wix user has installed the Wix Multilingual app.
This article presents possible use cases and corresponding sample flows that your app can support. It provides a useful starting point as you plan your app's implementation.
Suppose you're developing a hotel booking app that lists various hotels. To ensure your app displays the most up-to-date hotel descriptions in multiple languages, your app should automatically fetch and display new translations when Wix users add, update, and delete them.
Listen for the Published Content Created, Published Content Updated, and Published Content Deleted events to detect when hotel translations marked for publication have been added, updated, or deleted. Retrieve the latest translations for hotel descriptions in the relevant locales from the event object.
Display the updated hotel listings in the appropriate languages for users browsing the app in different locales.
Suppose your restaurant app has seasonal menu items. As the seasons change, you need to update the translations for these items to reflect the new offerings. This process ensures that site visitors see the latest translated content relevant for the current season.
Use the Query Published Content method to retrieve the current published translations for seasonal menu items. Filter the query by locale
to ensure you get the right translations.
Collect the new seasonal menu items in the primary language (English) from the Wix user. Once you have the original content, use an external service or a translator to translate these seasonal items into the different languages.
Call the Bulk Update Content method to update the existing published translations with the new seasonal content. Set "published": true
to mark the updated content as ready to publish.
Make sure that the updated translations for the seasonal menu items are displayed correctly in the appropriate locales for site visitors browsing the site in different languages.
This article covers field support for filtering and sorting in the Translation Published Content API.
The following table shows field support for filters and sorting for the translation published content object when using Query Published Content:
Field | Required | Supported Filters | Sortable |
---|---|---|---|
id | No | eq , ne , exists , in , hasSome , startsWith , ascending , descending | Sortable |
schemaKey.appId | Yes | eq , ne , exists , in , hasSome , startsWith , ascending , descending | Sortable |
schemaKey.entityType | Yes | eq , ne , exists , in , hasSome , startsWith , ascending , descending | Sortable |
schemaKey.scope | Yes | eq , ne , exists , in , hasSome , startsWith , ascending , descending | Sortable |
entityId | No | eq , ne , exists , in , hasSome , startsWith , ascending , descending | Sortable |
locale | No | eq , ne , exists , in , hasSome , startsWith , ascending , descending | Sortable |
parentEntityId | No | eq , ne , exists , in , hasSome , startsWith , ascending , descending | Sortable |
Published content ID.
Schema key of the published content.
A unique identifier defined by the app developer to differentiate translation content for various entities within the site. For example, if an app developer is creating translation content for blog posts, the entityId
can be 'blog-posts-1'
.
Published content locale.
List of fields that have been translated and published for the given locale.
A reference to the parent content. For example, if the content is a menu item, this property would contain the entityId
of the menu it belongs to.
Custom field data for the published content object.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a list of published translation content given the provided paging, filtering, and sorting. Up to 100 published content items can be returned per request.
The default sort
is id
in ASC
.
The following query filter fields are required:
schemaKey.appId
schemaKey.entityType
schemaKey.scope
For additional field support for filters and sorting, see Translation Published Content: Supported Filters and Sorting.
To learn how to query translation consent items, see API Query Language.
Query options. Note that some query filters are required. See the API description for a list of required filters.
The published translation content.
Details on the paged set of results returned.
curl -X POST 'https://www.wixapis.com/translation-published-content/v3/published-contents/query' \
-H 'Content-Type: application/json' \
-H 'Authorization: <AUTH>' \
--data-binary '{
"query": {
"filter": {
"schemaKey.appId": {"$eq": "14271d6f-ba62-d045-549b-ab972ae1f70e"},
"schemaKey.entityType": {"$eq": "Gallery"},
"schemaKey.scope": {"$eq": "GLOBAL"}
}
}
}'
{
"publishedContent": [
{
"id": "076f7724-8e95-44f3-b737-02e2a24913e9",
"schemaKey": {
"appId": "14271d6f-ba62-d045-549b-ab972ae1f70e",
"entityType": "Gallery",
"scope": "GLOBAL"
},
"entityId": "aa1dfffb-6d02-49da-9cb2-fc7c07b2cd4e",
"locale": "en",
"fields": [
{
"textValue": "The new garden",
"schemaFieldKey": "items()-title",
"sequenceIds": ["0a672f39-f9ec-405b-b139-353d18dc1fd9"]
},
{
"textValue": "Grandma's tree",
"schemaFieldKey": "items()-title",
"sequenceIds": ["a6bf9eb4-cf80-4819-90b7-6a947826f8de"]
},
{
"textValue": "The orange tree grandma planted many years ago...",
"schemaFieldKey": "items()-description",
"sequenceIds": ["a6bf9eb4-cf80-4819-90b7-6a947826f8de"]
}
]
},
{
"id": "c54aa1ef-6129-4368-aa0a-0a01775d32a4",
"schemaKey": {
"appId": "14271d6f-ba62-d045-549b-ab972ae1f70e",
"entityType": "Gallery",
"scope": "GLOBAL"
},
"entityId": "aa1dfffb-6d02-49da-9cb2-fc7c07b2cd4e",
"locale": "frr",
"fields": [
{
"textValue": "Le nouveau jardin",
"schemaFieldKey": "items()-title",
"sequenceIds": ["0a672f39-f9ec-405b-b139-353d18dc1fd9"]
},
{
"textValue": "L'arbre de grand-mère'",
"schemaFieldKey": "items()-title",
"sequenceIds": ["a6bf9eb4-cf80-4819-90b7-6a947826f8de"]
},
{
"textValue": "L'oranger que grand-mère a planté il y a de nombreuses années...'",
"schemaFieldKey": "items()-description",
"sequenceIds": ["a6bf9eb4-cf80-4819-90b7-6a947826f8de"]
}
]
}
],
"pagingMetadata": {
"count": 2,
"cursors": {},
"hasNext": false
}
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when published content is created.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.multilingual.localization_public.v3.published_content
.
Event name. Expected created
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.multilingual.localization_public.v3.published_content_created",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
{
"id": "32e07bda-9b38-4109-a385-e216b9d9d816",
"entityFqdn": "wix.multilingual.localization_public.v3.published_content",
"slug": "created",
"entityId": "160edd15-2836-4340-9d1c-b437085731e3",
"createdEvent": {
"entityAsJson": "{\"id\":\"160edd15-2836-4340-9d1c-b437085731e3\",\"schemaKey\":{\"appId\":\"cbdb1c1c-5a76-40d6-a9cf-202825ffcefc\",\"entityType\":\"movie-review\",\"scope\":\"GLOBAL\"},\"entityId\":\"377e393e-737b-4dbc-9928-ea26490d8f33\",\"locale\":\"en\",\"fields\":[{\"textValue\":\"Best movie I have ever seen. And I have seen the first!\",\"schemaFieldKey\":\"title\",\"sequenceIds\":[]}],\"parentEntityId\":\"terminator-2\"}"
},
"eventTime": "2024-08-15T12:46:35.736477191Z",
"triggeredByAnonymizeRequest": false,
"entityEventSequence": "1"
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when published content is updated.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.multilingual.localization_public.v3.published_content
.
Event name. Expected updated
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.multilingual.localization_public.v3.published_content_updated",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
{
"id": "4f08d6c6-2fc3-42b5-b0c6-633603fdd447",
"entityFqdn": "wix.multilingual.localization_public.v3.published_content",
"slug": "updated",
"entityId": "3f3bca52-a173-4236-8512-1985bbd73616",
"updatedEvent": {
"currentEntityAsJson": "{\"id\":\"3f3bca52-a173-4236-8512-1985bbd73616\",\"schemaKey\":{\"appId\":\"1380b703-ce81-ff05-f115-39571d94dfcd\",\"entityType\":\"shipping-rule\",\"scope\":\"GLOBAL\"},\"entityId\":\"00000000-0000-0000-0000-000000000002\",\"locale\":\"en\",\"fields\":[{\"textValue\":\"International\",\"schemaFieldKey\":\"shippingRule-name\",\"sequenceIds\":[]},{\"textValue\":\"Fast turtle delivery\",\"schemaFieldKey\":\"shippingRule-option()-title\",\"sequenceIds\":[\"00000000-0000-0000-0000-000000000001\"]},{\"textValue\":\"Up to 30 minutes or the pizza is free\",\"schemaFieldKey\":\"shippingRule-option()-deliveryTime\",\"sequenceIds\":[\"00000000-0000-0000-0000-000000000001\"]}]}",
"modifiedFields": {
"fields[2].textValue": ""
}
},
"eventTime": "2024-08-15T12:46:33.348833287Z",
"triggeredByAnonymizeRequest": false,
"entityEventSequence": "3"
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when published content is deleted.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.multilingual.localization_public.v3.published_content
.
Event name. Expected deleted
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.multilingual.localization_public.v3.published_content_deleted",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
{
"id": "557a2b62-2df7-4459-8a1d-857acb061117",
"entityFqdn": "wix.multilingual.localization_public.v3.published_content",
"slug": "deleted",
"entityId": "146de18d-d208-43fd-a3cf-16c2d4706b7a",
"deletedEvent": {
"deletedEntityAsJson": "{\"id\":\"146de18d-d208-43fd-a3cf-16c2d4706b7a\",\"schemaKey\":{\"appId\":\"00000000-0000-0000-0000-000000000013\",\"entityType\":\"wysiwyg.viewer.components.WRichText\",\"scope\":\"GLOBAL\"},\"entityId\":\"comp-ikgp3ypw\",\"locale\":\"en\",\"fields\":[{\"textValue\":\"<p class=\\\"font_7\\\">Deleted paragraph</p>\",\"schemaFieldKey\":\"compFeatures-wRichText-data-styledText-text\",\"sequenceIds\":[]}],\"parentEntityId\":\"masterPage\"}"
},
"eventTime": "2024-08-15T13:04:12.420887487Z",
"triggeredByAnonymizeRequest": false,
"entityEventSequence": "9223372036854775807"
}