Hi we have a client that wants a custom language switcher and they want to be able to personaly adjust images for each Language. I belive the best way to do this would be to have a repeater module set up and have it translate itself into a dictionary, here is my code so far:
{% set language_data = {} %}
{% for i in module.languages %}
{% set language_code = i.code|lower %}
{{ language_code }}
{% set language_name = i.full_name|capitalize %}
{% set language_image = i.image.src %}
{% set language_info = { "name": language_name, "image": language_image } %}
{% set language_data = language_data.update({language_code: language_info}) %}
{% endfor %}
But by the looks of the output it isn’t able to set the language_code as a dynamic key. Is there any solution for this or would be easier to write a dictionary of almost every language as just have it loop through and assign images based on the repeater module