Create rules for localized experiences

Sitecore Search uses the locale values included in a search request as context when generating results. If your implementation uses Sitecore Search JS SDK for React, the changes in locale can be automatically communicated for all widgets.

In most cases, to offer localized experiences, you need to ensure that the following are available:

Note

Creating localized rules for your experiences is not essential.

By default, the locale values are used as context to generate search results and recommendations.

You only need to create localized rules when you want to alter widget behavior for different locales. This can include displaying different products by country or making specific recommendations by language. When no locale context is set, use the Locale Preview drop-down list to find content items for a specific locale, or to preview changes to your variation.

Important

Selecting a locale from the Locale Preview list does not limit where the rule applies. To ensure a rule affects only a specific locale, you must define the locale in the rule’s site context.

Exclude certain items for a specific audience

To exclude certain items for a specific audience:

  1. For a preview search widget, add a widget variation rule.

  2. On the rule definition page, on the menu bar, click Context.

  3. On the Site context tab, click Add Context Rule, select locale from the drop-down list and in the operator drop-down menu, select the locale country of the specific audience, for example, Canada.

  4. To set the attribute value, in the text box, enter the locale value of the specific audience or begin typing to select the locale.

  5. On the rule definition page, on the menu bar, click Strategies then click the Bury Rules tab.

  6. In the right pane on the Content items tab, to filter the list by name, in the search input field, enter text. Alternatively, to filter the list by other attributes, click Filter.

    For details and a performance analytics summary of an item, click Quick Look.

  7. Drag the item to the Bury Rules tab.

  8. (Optional) To restrict this rule to a specific entity, in the Output entity drop-down list, select that entity.

  9. Click Save and, to deploy, click Publish.

Make specific recommendations for particular language speakers

To make specific recommendations for particular language speakers:

  1. For a recommendation widget, add a widget variation rule.

  2. On the rule definition page, on the menu bar, click Context.

  3. On the Site context tab, click Add attribute and select a locale with the language for which you want to make specific recommendations, for example, Spanish.

  4. To set the attribute value, in the text box, enter the locale value or begin typing to select the locale.

  5. On the menu bar, click Recipe and turn on the Enable contextualized recipe switch.

  6. To change the default recipe, click Choose another.

  7. To select a recipe to use with this widget, on the Choose Recipes screen, in the Entities drop-down menu, select an entity or All.

  8. On the desired recipe card, click Choose.

    Important

    When selecting a recipe, make sure it is valid for the entity you intend to use it with. All entities supported by a particular recipe have a green checkmark next to them on the recipe card.

    To help you choose a recipe, you can filter recipes by:

    • Name - enter text in the Search input field.

    • Creator - select Domain or Sitecore in the drop-down menu.

  9. (Optional) For the recipe, to change the entity or entities you want to use that recipe for, select the check box beside the entity name.

    Tip

    An entity must have one recipe assigned for the widget to display recommendations for that entity.

  10. Click Save and, to deploy, click Publish.

Do you have some feedback for us?

If you have suggestions for improving this article,