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

Twig "trans" filter with "trans_default_domain" does not work correctly #476

Closed
kherge opened this issue Apr 13, 2015 · 4 comments
Closed
Labels

Comments

@kherge
Copy link

kherge commented Apr 13, 2015

First off, this plugin is a godsend so thanks for all the work put into this!

Unfortunately, it appears that the plugin does not change the domain for the trans filter if I use trans_default_domain in my Twig template.

{% trans_default_domain "hello_world" -%}

<html>
  <head>
    <title>{{ 'page.title'|trans }}</title>
  </head>
  <body>
    <p>{{ 'page.content'|trans }}</p>
  </body>
</html>

The actual code works fine when I run it, but PhpStorm reports that the translations are missing. It may also be important to note that I may use the - character to trim whitespace on either side of trans_default_domain.

@Haehnchen
Copy link
Owner

-%} :)
there is a regular expression not allowing this. but now i am having a reason to optimize this :)

@kherge
Copy link
Author

kherge commented Apr 13, 2015

I checked to see if it would make a different whether I used -%} or not. It doesn't appear to affect anything, and the messages are still reported as missing.

@kherge
Copy link
Author

kherge commented Apr 13, 2015

Woops! It looks like if a dash is in the name of the domain, it does not work.

So, this works:

{% trans_default_domain "mydomain" %}

But not this:

{% trans_default_domain "my-domain" %}

So it looks like a dash anywhere breaks it.

@Haehnchen
Copy link
Owner

fixed

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

2 participants