Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trans_default_domain with embed #660

Closed
JonathanSenky opened this issue Dec 29, 2015 · 3 comments
Closed

trans_default_domain with embed #660

JonathanSenky opened this issue Dec 29, 2015 · 3 comments
Labels

Comments

@JonathanSenky
Copy link

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.

@CarsonF
Copy link

CarsonF commented Jan 5, 2016

I'm experiencing the same thing inside macros

@stof
Copy link
Contributor

stof commented Apr 18, 2016

embed defines an anonymous template, so the translation default domain is indeed separate. This looks like a bug in the plugin

@Haehnchen
Copy link
Owner

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants