Skip to content

Update translation.rst #9119

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
wants to merge 1 commit into from
Closed

Update translation.rst #9119

wants to merge 1 commit into from

Conversation

jakumi
Copy link
Contributor

@jakumi jakumi commented Jan 23, 2018

MessageSelector doesn't implement Symfony\Component\Translation\Formatter\MessageFormatterInterface - the expected second parameter for Translator::__construct, which is generated if not provided anyway. removing the second parameter in the example seems like the best option imho.

`MessageSelector` doesn't implement `Symfony\Component\Translation\Formatter\MessageFormatterInterface` - the expected second parameter for `Translator::__construct`, which is generated if not provided anyway. removing the second parameter in the example seems like the best option imho.

$translator = new Translator('fr_FR', new MessageSelector());
$translator = new Translator('fr_FR');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can replace with :

new MessageFormatter();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mh, I strongly disagree. My main reason being:

Neither the old MessageSelector nor the MessageFormatter appear in any of the texts surrounding the example and thus don't provide any value at all for the reader.

If the MessageFormatter were to be added, it would be helpful to provide the reader with some reason, opportunity or otherwise that can be gained by doing so. Since the text is targeted at developers wanting to include the Translator component, and the common use case described in the following texts don't include a MessageFormatter at all, I don't see the merits of adding a parameter that is not referenced at all.

I would agree, that the article could be improved by discussing the formatter parameter in some way, but this is way beyond the scope of this commit (and I would argue, that this would be going in some extra section)

@javiereguiluz javiereguiluz added this to the 3.4 milestone Feb 9, 2018
@javiereguiluz javiereguiluz modified the milestones: 3.4, 2.7 Feb 9, 2018
@javiereguiluz
Copy link
Member

@jakumi nice catch! Indeed removing this wrong argument is the best solution in this case. We've merged it on 3.4 branch, because that's the oldest maintained branch that contains the error (in 2.7 is not strictly an error, but passing the argument is not needed required, so we can remove it). When merging things in different branches GitHub makes it look as closed instead of merged ... but it's merged. Thanks!

javiereguiluz added a commit that referenced this pull request Feb 9, 2018
This PR was submitted for the 4.0 branch but it was squashed and merged into the 2.7 branch instead (closes #9119).

Discussion
----------

Update translation.rst

`MessageSelector` doesn't implement `Symfony\Component\Translation\Formatter\MessageFormatterInterface` - the expected second parameter for `Translator::__construct`, which is generated if not provided anyway. removing the second parameter in the example seems like the best option imho.

Commits
-------

33ac660 Update translation.rst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants