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

[Translation] remove null domain inconsistency #14040

Closed
Tobion opened this issue Mar 24, 2015 · 4 comments

Comments

Projects
None yet
4 participants
@Tobion
Copy link
Member

commented Mar 24, 2015

https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Translation/TranslatorInterface.php uses $domain = null as default whereas https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Translation/MessageCatalogueInterface.php uses $domain = 'messages' which currently means the same.

Imo we should

  1. deprecate domain = null in 2.7 and remove it from 3.0
  2. add a constant TranslatorInterface::DEFAULT_DOMAIN = 'messages'
  3. change signature to trans($id, array $parameters = array(), $domain = self::DEFAULT_DOMAIN, $locale = null);
  4. https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php#L122 should also change translation_domain => messages or TranslatorInterface::DEFAULT_DOMAIN
@stof

This comment has been minimized.

Copy link
Member

commented Mar 24, 2015

Your 4th point is not possible, as it would mean that it cannot inherit it from the parent form anymore

@Tobion

This comment has been minimized.

Copy link
Member Author

commented Mar 24, 2015

@stof true I also found #4328. But this shows that null domain has many different meanings across symfony.

Some reasoning for null domain: 2a5758f

@Tobion

This comment has been minimized.

Copy link
Member Author

commented Mar 24, 2015

So to implement this we would basically need to revert #14041 in order to not throw deprecation warnings from twig or form.

@aitboudad aitboudad added the Translator label Apr 5, 2015

@Tobion

This comment has been minimized.

Copy link
Member Author

commented Apr 13, 2015

Remvong the domain = null might cause too much trouble for not much gain. So I would propose to go the opposite route to make things consistent.

  1. add a constant TranslatorInterface::DEFAULT_DOMAIN = 'messages'
  2. change signature of MessageCatalogueInterface to use null as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.