Setting Language Filters in a Block


This guide will help you set up language filters for text fields in a block, ensuring that users see content in their preferred language based on their browser settings.

Step 1: Access the Filter Option

1. Open the Block:
  - Navigate to the block where you want to set the language filters.
  - Click inside the block on the text field

2. Find the Filter Option:
  - Look above the text field within the block for the filter option. 
  - Click on the filter icon to open the filtering settings.


Step 2: Set the Filter for English - this can be your pivot language

1. Choose the Attribute:
  - From the list of attributes, select `user_language`. 

2. Set the Condition:
  - Set the condition to `contains ignore case`.

3. Enter the Value (iso code "en"):
  - This ensures that only users with their browser language set to English will see this text.

4.  Pivot language (the fallback language used when there is no support for the user-language by the chatbot). Add another condition by selecting the “OR” option. The alternative condition should match a regex value containing the iso codes for your other filtered languages.

We used the regex:


We use this regex to get a "true" condition when the user language is different from the other two that we know are supported. As you can see, the languages are represented by their iso codes "it" and "es". If you support other languages different from the pivot one, you should add them as below:



Last Step: Add Filters for Additional Languages

1. Add a New Text Field:
  - Add another text field to the block for the next language translation.

2. Repeat Filter Setup:
  - Click on the filter option above the new text field.
  - Choose the `user_language` attribute again.
  - Set the condition to `contains ignore case`.

3. Enter the Language Value:
  - For Italian, enter `it` in the value field.
  - Repeat these steps for other languages by adding more text fields and setting the appropriate language codes (e.g., `es` for Spanish, `fr` for French).




Only the text fields that meet the conditions set by their respective filters will be displayed to the user.
Ensure each text field is correctly set up with the `user_language` attribute and the appropriate condition. By following these steps, you can effectively manage multilingual content in your blocks, ensuring users see content in their preferred language based on their browser settings.

For any feedback, don't be shy, shoot us an email at 🧡