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

Why PhpCode Extractor is not loading default gettext translation function #20

Closed
eusonlito opened this issue Jul 31, 2014 · 1 comment
Closed

Comments

@eusonlito
Copy link
Contributor

Why Extractors\PhpCode have not defined _ as a valid function in public static $functions?

I have edited your code to add support to default php gettext translations in Gettext\Extractors\PhpCode:

    public static $functions = array(
        '_' => '_',
        '__' => '__',
        '__e' => '__',
        'n__' => 'n__',
        'n__e' => 'n__',
        'p__' => 'p__',
        'p__e' => 'p__'
    );

Now I can load all strings from my code.

@eusonlito eusonlito changed the title Why phpCode Extractor is not loading default gettext translation function Why PhpCode Extractor is not loading default gettext translation function Jul 31, 2014
@oscarotero
Copy link
Member

By default it use the translator functions, but the $functions property is public so you can customize as you wish:

Gettext\Extractors\PhpCode::$functions = array(
    '_' => '__',
   'gettext' => '__',
    //etc
);

Note that the key is the function name you use (_, gettext, etc) and the value is the behaviour (it behaves like __ or like p__, etc), so '_' => '_' is not valid.

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

No branches or pull requests

2 participants