Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Translation] Translator::getMessages() is not part of an interface #14529

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

Closed
mpdude opened this issue May 3, 2015 · 5 comments
Closed

[Translation] Translator::getMessages() is not part of an interface #14529

mpdude opened this issue May 3, 2015 · 5 comments

Comments

@mpdude
Copy link
Contributor

mpdude commented May 3, 2015

The Translator::getMessages() method is not part of any of the interfaces Translator implements. But as the Translator is @api, it probably is something "official".

FWIW, inside Symfony this method is used only from tests.

Is that something that should be adressed? If not, feel free to close this issue.

@aitboudad
Copy link
Contributor

It was useful before adding getCatalogue until now I think we need to deprecate it.

@mpdude
Copy link
Contributor Author

mpdude commented May 3, 2015

getMessages() can be implemented without leaking details about the (internal) organization of MessageCatalogues inside the Translator. TranslatorBagInterface cannot. See #14530.

@stof
Copy link
Member

stof commented May 4, 2015

The fact that it is not part of the interface means you cannot use it when you depend on the interface (which should be the case everywhere to be compatible with composition, as used in Symfony itself)

getMessages is less usable than the TranslatorBagInterface because it does not allow dealing with fallback locales properly (you don't know in which locale the messages were defined).

Btw, I think getMessages was a mistake. It was introduced in Symfony 2.6 in #9859 and then we introduced TranslatorBagInterface in 2.6 too but at a later date. getMessages should probably have been removed at such point in favor of TranslatorBagInterface

@mpdude
Copy link
Contributor Author

mpdude commented May 4, 2015

@stof As my current goal is to get as much encapsulation as possible inside the Translator (see #14530), deprecating the getMessages() method and dropping it in 3.0 would make me happy :-).

@aitboudad
Copy link
Contributor

done #14546

aitboudad added a commit that referenced this issue May 6, 2015
…logue. (aitboudad)

This PR was merged into the 2.8 branch.

Discussion
----------

[Translator] deprecate getMessages in favor of getCatalogue.

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #14529
| Tests pass?   | yes
| License       | MIT

Commits
-------

2869a32 [Translator] deprecate getMessages in favor of getCatalogue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants