8000 [TwigBridge][Translation] TwigExtractor duplicates with trans_default_domain · Issue #6943 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBridge][Translation] TwigExtractor duplicates with trans_default_domain #6943

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

Closed
havvg opened this issue Feb 1, 2013 · 9 comments
Closed
Labels
Bug Good first issue Ideal for your first contribution! (some Symfony experience may be required) Translation TwigBundle

Comments

@havvg
Copy link
Contributor
havvg commented Feb 1, 2013

Given this template, all translations are extracted twice.

Once for the correct translation domain (as specified by {% trans_default_domain %} and once wrongly for the default domain. This applies to the current template, its parent and the embedded one.

{% extends '::base.html.twig' %}

{% trans_default_domain "users" %}

{% block content_header %}
    <h1>{{ 'heading.create'|trans }}</h1>
{% endblock %}

{% block content_layout %}
    {# .. #}

    {% embed ':Layout:content_full_size.html.twig'%}
        {% trans_default_domain "users" %}

        {# .. #}
    {% endembed %}
{% endblock %}
@dlsniper
Copy link
Contributor
dlsniper commented Feb 4, 2013

Hi, what version of Symfony2 are you using?

@havvg
Copy link
Contributor Author
havvg commented Feb 4, 2013

The issue occurred in 2.1.7 and is still there after upgrading to 2.2.0-BETA2.

@dlsniper
Copy link
Contributor
dlsniper commented Feb 4, 2013

Ok, thanks, I'll give it a shot today and see if I can fix it.

@dlsniper
Copy link
Contributor
dlsniper commented Feb 6, 2013

Hi.

Sorry for delay.
I've created the following gist but I've yet to encounter the problem.
Am I doing something wrong?

@havvg
Copy link
Contributor Author
havvg commented Feb 7, 2013

That looks the way, we have templates.

You don't get Symfony - Welcome dumped as key under domain messages, but only in the domain users?

@dlsniper
Copy link
Contributor
dlsniper commented Feb 7, 2013

@havvg actually the app/console translation:update --dump-messages --force en AcmeDemoBundle command will dump only messages.en.__format__.

Generating "en" translation files for "AcmeDemoBundle"
Parsing templates
Loading translation files

Displaying messages for domain messages:

'Symfony - Welcome': '__Symfony - Welcome'
embed: __embed

I'm using Symfony2 2.1.7 as well.

@havvg
Copy link
Contributor Author
havvg commented Feb 7, 2013

When I run php app/console translation:update de_DE OrmigoBundle --dump-messages, I got this result:

Generating "de_DE" translation files for "OrmigoBundle"
Parsing templates
Loading translation files

Displaying messages for domain messages:

settings.header: __settings.header
account.my_account: __account.my_account
account.settings: __account.settings
[ ... ]

Displaying messages for domain account:

settings.header: Einstellungen
[ ... ]

Displaying messages for domain breadcrumb:

home: Ormigo
account.my_account: 'Mein Konto'
account.settings: Einstellungen

[ ... ]

Adding the --force option will write all those into the output format (PDO), including the wrong/duplicate ones.
Maybe, there is something different, that's causing the issue, so I put up this gist with more details on the templates: https://gist.github.com/havvg/3a779bf221e09acb181e

@havvg
Copy link
Contributor Author
havvg commented Feb 7, 2013

Ah, so you only got it in messages? That would be wrong, too.
I guess, I got the correct ones, because some of them are already present (translated) in their correct domain.

@jfsimon
Copy link
Contributor
jfsimon commented Feb 27, 2013

@havvg the problem is that TwigExtractor seems not to take trans_default_domain in account.
I'll try to fix it today.

fabpot added a commit that referenced this issue Feb 28, 2013
This PR was squashed before being merged into the 2.1 branch (closes #7206).

Commits
-------

bae83c7 [TwigBridge] fixed trans twig extractor

Discussion
----------

[TwigBridge] fixed trans twig extractor

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6943
@fabpot fabpot closed this as completed Feb 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Good first issue Ideal for your first contribution! (some Symfony experience may be required) Translation TwigBundle
Projects
None yet
Development

No branches or pull requests

4 participants
0