Translation Published Content: Sample Flows

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.

Fetch translations for hotel listings

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 can automatically fetch and display new translations when Wix users add, update, and delete them.

  1. Listen for the onPublishedContentCreated(), onPublishedContentUpdated(), and onPublishedContentDeleted() 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.

  2. Display the updated hotel listings in the appropriate languages for users browsing the app in different locales.

Update translated content for seasonal menu items

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.

  1. Use the queryPublishedContent() method to retrieve the current published translations for seasonal menu items. Filter the query by locale to ensure you get the right translations.

  2. 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.

  3. Call bulkUpdateContent() to update the existing published translations with the new seasonal content. Set "published": true to mark the updated content as ready to publish.

  4. 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.

Was this helpful?
Yes
No