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

Config option to disable Gettext listener #6

Open
althaus opened this issue Aug 29, 2014 · 3 comments
Open

Config option to disable Gettext listener #6

althaus opened this issue Aug 29, 2014 · 3 comments

Comments

@althaus
Copy link

althaus commented Aug 29, 2014

Hey,

we just added your nifty bundle to a project, but we already have some custom gettext handler/listener. It'd be great if there'd be a config option to en/disable the bundle's services. For now I've just overriden yours with an empty dummy listener.

http://symfony.com/doc/current/cookbook/bundles/configuration.html

Cheers
Matthias

@mevdschee
Copy link
Contributor

Hi Matthias, thank you for your comment. Can you be a little more specific in how you want this to work? What would be the name of the configuration parameter and what would it exactly do? Also, if you are willing to do a PR, then I am willing to merge that. As long as it enables the listener by default and does not break backwards compatibility. Kind regards, Maurits

@althaus
Copy link
Author

althaus commented Sep 10, 2014

Hey,

my issue is that the GettextLocaleListener is always executing setupGetText()

private function setupGetText()
{
    $versionFile = $this->rootDir.'/Resources/gettext/version';
    $version = file_exists($versionFile) ? file_get_contents($versionFile) : '';
    $domain = 'messages' . $version;
    bindtextdomain($domain, $this->rootDir . '/Resources/gettext/combined/');
    textdomain($domain);
    bind_textdomain_codeset($domain, 'UTF-8');
}

and that's breaking our custom Gettext setup. In addition we have our own listener setting the request locale. Therefore I'd be great if the config would include options to disable those listeners:

# app/config/config.yml
lsw_gettext:
    locale_listener: false

I'll check this out to see if I can to a PR. :)

Cheers

@mevdschee
Copy link
Contributor

That would be great! If I find some time I can also try to make this.. should not be too hard. :-)

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