{% load i18n menu_tags cms_tags %}{% spaceless %}
{% get_current_language as current_language_code %}
{% if languages|length > 1 %}
  <script data-language-selector type="application/json">
  {
    "currentLanguage": "{{ current_language_code }}",
    "languages": {
      {% for code, name in languages %}
      "{{ code }}": {
        "code": "{{ code }}",
        "name": "{{ name }}",
        "url": "{% page_language_url code %}"
      {% if forloop.last %}
      }
      {% else %}
      },
      {% endif %}
      {% endfor %}
    }
  }
  </script>
  <div class="richie-react richie-react--language-selector" data-props-source="[data-language-selector]"></div>
{% endif %}
{% endspaceless %}
