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

Unused param $domain in translation helpers/methods #9584

Closed
kamui545 opened this issue Jul 10, 2015 · 3 comments
Closed

Unused param $domain in translation helpers/methods #9584

kamui545 opened this issue Jul 10, 2015 · 3 comments

Comments

@kamui545
Copy link
Contributor

Hey guys,

The $domain param in the following functions/methods is not used:

Illuminate/Foundation/helpers.php

Illuminate/Translation/Translator.php

As per the doc, domains are declared in the key name like this trans('domain.message_key')

In Translator@trans() we can clearly see this param is not used

public function trans($id, array $parameters = [], $domain = 'messages', $locale = null)
{
    return $this->get($id, $parameters, $locale);
}

Now, the thing is, this param is needed in the Translator class because it implements the Symfony\Component\Translation\TranslatorInterface.

Maybe we could at least modify the trans() and trans_choice() helpers like this:

function trans($id = null, $parameters = [], $locale = null)
{
    if (is_null($id)) {
        return app('translator');
    }

    return app('translator')->trans($id, $parameters, null, $locale);
}

function trans_choice($id, $number, array $parameters = [], $locale = null)
{
    return app('translator')->transChoice($id, $number, $parameters, $locale);
}

but it would still be confusing for people dealing with the translator class directly.

Any thoughts?

@GrahamCampbell
Copy link
Member

We can't remove that param as that would be a breaking chanage, sorry.

@kamui545
Copy link
Contributor Author

kamui545 commented Aug 1, 2015

Yep I know, but isn't it possible to do this change for 5.2?

@GrahamCampbell
Copy link
Member

Please send a PR then. Proposal issues aren't much use to us, sorry.

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