Skip to content

trans_default_domain with embed #660

@JonathanSenky

Description

@JonathanSenky

Hello,

I don't think it's a normal behavior of the plugin, I added the trans_default_domain in a file which have an embed.

{% trans_default_domain "price_option" %}

{% embed "...:Embed:section.html.twig" %}
    {% block title %}
        {{ 'parking_per_hour_fee.title'|trans }}
    {% endblock %}
    {% block content %}
        <div>
            <div class="section">
                <div class="col-sm-4">
                    <h2>{{ 'parking_per_hour_fee.form.airport.label'|trans }}</h2>
                </div>
                <div class="col-sm-4">
                    <h2>{{ 'parking_per_hour_fee.form.fees_per_hour.label'|trans }} ({{ currency_symbol() }})</h2>
                </div>
                <div class="col-sm-4">
                    {% if hasRightForWrite('pricing') %}
                        <h2>{{ 'action'|trans }}</h2>
                    {% endif %}
                </div>
            </div>

            <div class="airport-add-fees-content">
                {% for resource in resources %}
                    <div class="price-option-ajax-resource-container">
                        {{ render(path('dt_ajax_parking_per_hour_fee_price_option_update', {id: resource.id})) }}
                    </div>
                {% endfor %}
            </div>

            <div class="update-zero-ajax-resource-container">
                {% if hasRightForWrite('pricing') %}
                    {{ render(path('dt_ajax_parking_per_hour_fee_price_option_create')) }}
                {% endif %}
            </div>
        </div>
    {% endblock %}
{% endembed %}

With the code above, phpstorm recognize the default domain and doesn't show any error, but the translations don't work.

And with the code below (the translation_default_domain in the embed), the translations work fine but phpstorm doesn't recognize the translations and warn the developper.

{% embed "...:Embed:section.html.twig" %}
    {% trans_default_domain "price_option" %}
    {% block title %}
        {{ 'parking_per_hour_fee.title'|trans }}
    {% endblock %}
    {% block content %}
        <div>
            <div class="section">
                <div class="col-sm-4">
                    <h2>{{ 'parking_per_hour_fee.form.airport.label'|trans }}</h2>
                </div>
                <div class="col-sm-4">
                    <h2>{{ 'parking_per_hour_fee.form.fees_per_hour.label'|trans }} ({{ currency_symbol() }})</h2>
                </div>
                <div class="col-sm-4">
                    {% if hasRightForWrite('pricing') %}
                        <h2>{{ 'action'|trans }}</h2>
                    {% endif %}
                </div>
            </div>

            <div class="airport-add-fees-content">
                {% for resource in resources %}
                    <div class="price-option-ajax-resource-container">
                        {{ render(path('dt_ajax_parking_per_hour_fee_price_option_update', {id: resource.id})) }}
                    </div>
                {% endfor %}
            </div>

            <div class="update-zero-ajax-resource-container">
                {% if hasRightForWrite('pricing') %}
                    {{ render(path('dt_ajax_parking_per_hour_fee_price_option_create')) }}
                {% endif %}
            </div>
        </div>
    {% endblock %}
{% endembed %}

Don't know if it's an issue or if I am doing something wrong... thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions