Was this article helpful?
Thanks for your feedback
In this section, we will look at a few real-world scenarios to understand how the localization operator helps perform more accurate searches in Contentstack.
Consider a scenario where you have the following languages available within your stack: English (United States), French (France), Chinese (China), and Spanish (Spain). English (United States) is set as the master language of the stack.
You have created 6 entries within a content type, and these entries have been localized in different languages. The following table shows the localized entries’ fallback relationships between each of the languages in which these entries have been localized:
Entry No. | Master Language | Localized in |
Entry 1 | English (United States) |
|
Entry 2 | English (United States) |
|
Entry 3 | English (United States) |
|
Entry 4 | English (United States) |
|
Entry 5 | English (United States) |
|
Entry 6 | English (United States) |
|
Now, let’s see some scenarios to understand how the localization operator will work in your search queries.
To do this, select “Chinese (China)” as value for the Language field in the condition. Then use the Localized in operator and then select Any Locales as value:
The search result will include the following entry versions:
Notice that it brings the list of entries that are either localized in Chinese or can be localized in Chinese (but are not yet localized in Chinese). In the case of entries that are not yet localized in Chinese, it brings the immediate predecessor in the fallback lineage, if available.
So, in the above example, it returned Entry 2 (localized in French), but did not bring Entry 2 (English).
To do this, select “Chinese (China)” as value for the Language field in the condition. Then use the Localized in operator and select Chinese (China) as value:
The search result will include the following entry versions:
Here, only the entries localized in Chinese (China) show up in the search results.
To do this, select “Chinese (China)” as value for the Language field in the condition. Then use the Not localized in operator and select Chinese (China) as value:
The search result will include the following entry versions:
Here, all entries except the ones localized in Chinese (China) show up in the search results. It fetches the entries that can be localized in Chinese (but are not yet localized in Chinese).
To do this, select “Chinese (China)” as value for the Language field in the condition. Then use the Localized in operator and select French (France) as value:
The search result will include the following entry versions:
Here, only the entries present in Chinese (China) language that have been localized in French (France) show up in the search results.
Was this article helpful?
Thanks for your feedback