Closed
Description
Hey guys,
The $domain param in the following functions/methods is not used:
Illuminate/Foundation/helpers.php
- trans($id = null, $parameters = [], $domain = 'messages', $locale = null)
- trans_choice($id, $number, array $parameters = [], $domain = 'messages', $locale = null)
Illuminate/Translation/Translator.php
- trans($id, array $parameters = [], $domain = 'messages', $locale = null)
- transChoice($id, $number, array $parameters = [], $domain = 'messages', $locale = null)
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?
Metadata
Metadata
Assignees
Labels
No labels