Hello!
I would like to know how to bind a localized list item’s value to an element.
Here is my symbol:
It has two input field:
A data reference, and a locale, so when I add this symbol to my page, I can pick dynamically the reference and the locale (symbol localization+custom field localization is my goal)
On my page you can see that:
For your help, my data entry has 4 property, but only two of them is localized:
As you can see, in the symbol I could bind a simple property (localized or not) to the element, and I could also achieve to repeat element with the list (localized or not), but I could not solve to bind the localizedItem.value to the element, I got undefined
I console.log the state, but was not able to find the localized item value:
{
"deviceSize": "large",
"location": {
"path": "",
"query": {}
},
"hero": {
"@type": "@builder.io/core:Reference",
"id": "b4f1a1eace524d39b97d2f8e0a07d813",
"model": "localizemodelexample",
"value": {
"createdBy": "uw0UJ7VD7hS21zDPkekcB9zZgAD3",
"createdDate": 1646399897370,
"data": {
"description": "Description without localization as well yes",
"listnolocale": [
{
"titlem": "elsonemlocale"
},
{
"titlem": "masodiknemlocale"
}
],
"localelist": {
"@type": "@builder.io/core:LocalizedValue",
"en": [
{
"titlem": "en first title"
},
{
"titlem": "en second item name"
}
],
"hu": [
{
"titlem": "magyar elso listitem"
},
{
"titlem": "magyar masodik listitem"
}
]
},
"title": {
"@type": "@builder.io/core:LocalizedValue",
"Default": "Hungarian text",
"de": "German text",
"en": "English text",
"hu": "Hungarian text"
},
"titlenolocale": "Ez nincs localized text"
},
"id": "b4f1a1eace524d39b97d2f8e0a07d813",
"lastUpdatedBy": "uw0UJ7VD7hS21zDPkekcB9zZgAD3",
"meta": {
"kind": "data"
},
"modelId": "a72b5ec0082646f7aaf702a80453410c",
"name": "test",
"published": "published",
"query": [],
"testRatio": 1,
"variations": {},
"lastUpdated": 1649154152629,
"firstPublished": 1646400091673,
"rev": "3b2igug546k"
}
},
"locale": {
"locales": "hu"
},
"isBrowser": true,
"isServer": false,
"device": "mobile",
"result": {
"results": [
{
"createdBy": "uw0UJ7VD7hS21zDPkekcB9zZgAD3",
"createdDate": 1646399897370,
"data": {
"description": "Description without localization as well yes",
"listnolocale": [
{
"titlem": "elsonemlocale"
},
{
"titlem": "masodiknemlocale"
}
],
"localelist": {
"@type": "@builder.io/core:LocalizedValue",
"en": [
{
"titlem": "en first title"
},
{
"titlem": "en second item name"
}
],
"hu": [
{
"titlem": "magyar elso listitem"
},
{
"titlem": "magyar masodik listitem"
}
]
},
"title": {
"@type": "@builder.io/core:LocalizedValue",
"Default": "Hungarian text",
"de": "German text",
"en": "English text",
"hu": "Hungarian text"
},
"titlenolocale": "Ez nincs localized text"
},
"id": "b4f1a1eace524d39b97d2f8e0a07d813",
"lastUpdatedBy": "uw0UJ7VD7hS21zDPkekcB9zZgAD3",
"meta": {
"kind": "data"
},
"modelId": "a72b5ec0082646f7aaf702a80453410c",
"name": "test",
"published": "published",
"query": [],
"testRatio": 1,
"variations": {},
"lastUpdated": 1649154152629,
"firstPublished": 1646400091673,
"rev": "4gvx51591z7"
}
]
},
"$index": 1,
"$item": {
"titlem": "magyar masodik listitem"
},
"resultsItem": {
"createdBy": "uw0UJ7VD7hS21zDPkekcB9zZgAD3",
"createdDate": 1646399897370,
"data": {
"description": "Description without localization as well yes",
"listnolocale": [
{
"titlem": "elsonemlocale"
},
{
"titlem": "masodiknemlocale"
}
],
"localelist": {
"@type": "@builder.io/core:LocalizedValue",
"en": [
{
"titlem": "en first title"
},
{
"titlem": "en second item name"
}
],
"hu": [
{
"titlem": "magyar elso listitem"
},
{
"titlem": "magyar masodik listitem"
}
]
},
"title": {
"@type": "@builder.io/core:LocalizedValue",
"Default": "Hungarian text",
"de": "German text",
"en": "English text",
"hu": "Hungarian text"
},
"titlenolocale": "Ez nincs localized text"
},
"id": "b4f1a1eace524d39b97d2f8e0a07d813",
"lastUpdatedBy": "uw0UJ7VD7hS21zDPkekcB9zZgAD3",
"meta": {
"kind": "data"
},
"modelId": "a72b5ec0082646f7aaf702a80453410c",
"name": "test",
"published": "published",
"query": [],
"testRatio": 1,
"variations": {},
"lastUpdated": 1649154152629,
"firstPublished": 1646400091673,
"rev": "4gvx51591z7"
},
"$resultsItemIndex": 0,
"locales]Item": {
"titlem": "magyar masodik listitem"
},
"$locales]ItemIndex": 1
}
Hope I was just dummy and did not notice anything, and you can tell me the easiest solution for this, because I have a lot of symbols where I should follow this approach!
My goal would be, if I add later localization to my entries, that I don’t have to change anything in my current bindings, only pass the [locale] property to it, which is working for simple properties, but looks like, the list binding is more difficult than that…
Thanks in advance!
Let me know please as soon as possible, because we are building our production app with Builder using Growth plan.