I have such a template. It displays a list of categories that comes to me from the server.
Here is an example of the data coming from the server.
"categories":[{
"id": "a",
"url": "#a"
}, {
"id": "b",
"url": "#b"
}, {
"id": "c",
"url": "#c"
}]
The difficulty is that the category names do not come from the server. I keep them in the template in order to be localized.
{let $names: [
"a": "Category A",
"b": "Category B",
"c": "Category C"
]/}
So I need before calling the template categories augment the original list with localized names. Somethink like this:
{let $categoriesLocalized}
{foreach $category in $categories}
augmentMap($category, ["name": $names[$category.id]])
{/foreach}
{/let}
{call .categories}
{param $categories: $categoriesLocalized /}
{/let}
But this does not work, because all that is written inside block let becomes a string. :-(
Is there a way to dynamically create or expand the list?