Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Override the gettext functions with anything with the same argument signature #166

Closed
wants to merge 4 commits into from

Conversation

hmpf
Copy link

@hmpf hmpf commented Mar 3, 2016

This is a slightly smaller change than #160, and would also close #152.

@@ -17,7 +28,7 @@ class Twig_Extensions_Extension_I18n extends Twig_Extension
*/
public function getTokenParsers()
{
return array(new Twig_Extensions_TokenParser_Trans());
return array(new Twig_Extensions_TokenParser_Trans($singularFunc = $this->singularFunc, $pluralFunc = $this->pluralFunc));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you assigning local variables here ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On 03/03/16 12:13, Christophe Coevoet wrote:

In lib/Twig/Extensions/Extension/I18n.php
#166 (comment):

@@ -17,7 +28,7 @@ class Twig_Extensions_Extension_I18n extends Twig_Extension
*/
public function getTokenParsers()
{

  •    return array(new Twig_Extensions_TokenParser_Trans());
    
  •    return array(new Twig_Extensions_TokenParser_Trans($singularFunc = $this->singularFunc, $pluralFunc = $this->pluralFunc));
    

why are you assigning local variables here ?

Because I've lately been primarily programming in Python and don't know
"modern" php coding culture very well.

HM

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this what is causing the fail in php 7.0 or is that something else.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can take the assignments out, these don't do anything for you so are basically a no-op.
It is not the cause for the PHP7 fail btw.

hmpf added a commit to simplesamlphp/simplesamlphp that referenced this pull request Mar 7, 2016
@fabpot
Copy link
Contributor

fabpot commented Sep 30, 2016

see #193

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

Successfully merging this pull request may close these issues.

I18n: Option to specify alternatives for gettext / ngettext (extension config?)
4 participants