Skip to content

Custom macro which starts with underscore #226

Description

@awps

Version: 2.8.1

Bug Description

I'm trying to create a macro which is starting with an underscore and it fails on thinking that it's a translation.

Also using a php function that starts with underscore fails as well.

In my case I'm trying to use this function __(): https://developer.wordpress.org/reference/functions/__/

Using the function directly or creating a macro, the problem still persists.

Steps To Reproduce

<a href="#" class="button">{__('Get an estimation', 'domain')}</a>
$this->latte->addFunction('__', [$this, '__']);
//...
public function __($text, $domain = 'default')
{
   return __($text, $domain);
}

Expected Behavior

Should execute the actual function __(), not trying to use the translation filter.

I'm using only the Latte engine and Tracy, without Nette framework.

The actual error:
image

Another question:

Is, it possible to remove this macro: _ ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions