templates/static/proxy.html.twig line 1
{# this proxy template tries to get:
1- the current locale page: static/{page}_{locale}.html.twig
2- if not exists then it tries to get the default locale page: static/{page}_ar.html.twig
3- if not exists then fallback to the common page (non localized) : static/{page}.html.twig #}
{# [1] get default locale (Arabic) that will be used if no template for the current locale #}
{% set available_locales = app_locales|split('|') %} {# get locales from config #}
{% set locale_codes = [] %}
{% for key, value in available_locales %}
{% set locale_codes = locale_codes|merge({ (value): value }) %} {# no way to push to an array in twig except via merging to it #}
{% endfor %}
{% set default_locale= locale_codes['ar'] %}
{# [2] extending the appropriate twig template depending on "page" route parameter and the current locale #}
{% set localized_template_path = "static/" ~ app.request.get('page') ~ "_" ~ app.request.locale ~ ".html.twig" %}
{% set default_template_path = "static/" ~ app.request.get('page') ~ "_" ~ default_locale ~ ".html.twig" %}
{% set non_localized_template_path = "static/" ~ app.request.get('page') ~ ".html.twig" %}
{% extends [localized_template_path, default_template_path, non_localized_template_path] %}