-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix Twig dynamic translation #1618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra if.
@@ -374,6 +374,9 @@ public function translate($args, array $languages = null, $array_support = false | |||
{ | |||
if (is_array($args)) { | |||
$lookup = array_shift($args); | |||
if (is_array($args)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$args
is still an array, no need to check it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, in fact, just the one line with array_shift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right?
thanks |
Thank you all |
This addresses issues with the PR. It uses a new twig filter that gives full access to the langauges->translate() function.
Actually I had to revert this as it broke sprintf style text replacement in translations. I've created a new twig filter/function that will allow you to do translations in other languages: |
Here is my PR
A little for my poor english, a bit because I thought the solution was not exhaustive (the presence of the other two arguments: array_support and html_out) I hesitated to do this PR. I've done the tests I find necessary, I think it's okay 😄