As of this release, Streams can now support multiple locales in a single Streams API. Users can now request documents in a specific locale, or fetch documents from multiple.
For example, if you had profiles in both English and Spanish, you could use a Streams Endpoint which includes both English and Spanish locales. When a user visits your site, you could make a request for the Streams API to only fetch the profile for the relevant locale.
This can be used for developers utilizing the Streams API when building consumer-facing applications, to ensure the content is properly localized for end-users based on the localized profiles in the Knowledge Graph!
Below following is an example Streams Endpoint Resource with the new localization property:
{
"$id": "personEndpoint",
"$schema": "https://schema.yext.com/config/streams/streams-api/v1",
"Name": ”Person API",
"stream": {
"source": "knowledgeGraph",
"fields": [
"name",
"c_title”
],
"filter": {
"entityTypes": [
"ce_employees"
]
},
"localization": {
"locales": [
“en”, "es-ES"
],
"fallback": {
"es-ES": ["es"]
}
},
"fieldIndexes": [
{
"field": "c_title"
}
]
}
To learn more about Streams, visit the Streams API Documentation, or the Get Started with Streams guide.