Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Translation] added method to expose collected message#9859

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromlaboro:translation-expose-messages
Aug 27, 2014
Merged

[Translation] added method to expose collected message#9859

fabpot merged 1 commit intosymfony:masterfromlaboro:translation-expose-messages
Aug 27, 2014

Conversation

@Grygir
Copy link
Contributor

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?no
Fixed tickets#2435
LicenseMIT
Doc PRsymfony/symfony-docs#3386

@jakzal
Copy link
Contributor

@Grygir there's no need to create a new PR. You could've just pushed to your branch and PR would be updated.

You have to merge master into your branch and resolve conflicts.

Please add a PR description with a table.

@Grygir
Copy link
ContributorAuthor

@jakzal thanks. That was a bit misunderstanding from my side.

I've applied all changes for comments from#8597 and created a paragraph insymfony/symfony-docs#3386.

@fabpot
Copy link
Member

@Grygir You should remove the merge commit (squashing you commits would help here).

Copy link
Member

Choose a reason for hiding this comment

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

Should be something like:Collects all messages.

@Grygir
Copy link
ContributorAuthor

@fabpot thanks, all commented issues are fixed.

Choose a reason for hiding this comment

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

is it a good idea to do it with for? not foreach? You have flipped$domains and left$catalogues

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

$domains is usually small array (several items) and$catalogues is often quite big. So thefor-loop is used here (instead ofarray_flip +foreach-loop) in only matter of performance.

@aitboudad
Copy link
Contributor

You should update the CHANGELOG file (in the component dir)

@Grygir
Copy link
ContributorAuthor

@aitboudad, do I understand correctly, this note should be in a section related to the coming version (2.5.0)?

@aitboudad
Copy link
Contributor

@Grygir
Copy link
ContributorAuthor

@aitboudad, done, thanks

@wouterj
Copy link
Member

@fabpot is there any change this can be merged?

@Grygir you have to rebase this PR, there are merge conflicts now.

@Grygir
Copy link
ContributorAuthor

@wouterj pull request is updated, thanks

@wouterj
Copy link
Member

👍 great!

Copy link
Member

Choose a reason for hiding this comment

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

I don't really like theexposeMessages() name. What about justgetMessages()?

@Grygir
Copy link
ContributorAuthor

@fabpot thank you, all comments are fixed (related symfony-docs pull request is updated as well)

@fabpot
Copy link
Member

👍

@wouterj
Copy link
Member

Great work,@fabpot, nice to see this one picked up that fast!

@sstok
Copy link
Contributor

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any difference between passingarray() andnull for domains. Then I would just usearray $domains = array() without null.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see@fabpot suggested that. But I don't agree with that. First of all, it makes the argument type dynamic and secondly, there is no semantic difference.

So when you see code like

$translator->getMessages(array());$translator->getMessages(null);

you would think both do something different and look at the implementation what the difference is. But in fact it's the same.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@Tobion agree with you. That how I first time made. Then@fabpot asked to change. But I think it's not critical. Both variants are fine for me.

Copy link
Member

Choose a reason for hiding this comment

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

Whatever. Usearray() if you want to, I don't really care.

Copy link
Member

Choose a reason for hiding this comment

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

Please note what the default means: every domain. It seems wrong to use every domain if you pass an empty list. Null stands for no argument, if you pass no argument to domain, it seems logical to get all domains.

Copy link
Contributor

Choose a reason for hiding this comment

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

@wouterj It's perfectly right to get every domain if you pass an empty list. The argument filters the required domains (see phpdoc), i.e. an empty filter will return everything. Pretty logical.
Btw, it's the same as inRoute::setSchemes.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I also find bad is that you can get all messages for all domains, but not for all locales.
I'd propose to simply remove the domains parameter. The logic that it implements can simply be done by the user. And the method should only have a single responsibility, and that is not filtering domains.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@Tobion Frankly, don't see anything bad of allowing to filter messages at the fetch method. It looks natural for me. Confident, that other developers will find it usefull.

Regarding "null vs.array()", I'm like 45/55. Your argument

to get every domain if you pass an empty list.

seems reasonable for me. That's how most UI filters works "empty filter list --> all records". That's why, have implemented it this way first time. But, really don't see a big deal to usenull for all messages. There's only matter of integrity and consistency, and IMHOarray() fits more those requirements.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it might be useful, but everything is useful for someone. The point is,

  1. it violates single responsibility
  2. is really simply to do in user-land, just `$messages['mydomain']

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@Tobion, you are definitely right. It won't be hard to pick proper domains by array's keys in afterwords. I've updated the method, the test and documentation as well.
Thank you.

@wouterj
Copy link
Member

👍 thanks@Grygir (although I have no vote permission)

Copy link
Contributor

Choose a reason for hiding this comment

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

Missing description that it returnsarray[array] indexed by catalog.

@Tobion
Copy link
Contributor

Apart from the phpdoc above, 👍

@Grygir
Copy link
ContributorAuthor

@Tobion, thank you. Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this calculated instead of setting the value explicitly in the data provider?

@fabpot
Copy link
Member

Thank you@Grygir.

@fabpotfabpot merged commitef5d7c5 intosymfony:masterAug 27, 2014
fabpot added a commit that referenced this pull requestAug 27, 2014
…(Grygir)This PR was merged into the 2.6-dev branch.Discussion----------[Translation] added method to expose collected message| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | no| Fixed tickets |#2435| License       | MIT| Doc PR        |symfony/symfony-docs#3386Commits-------ef5d7c5 [Translation] added method to expose collected messages
weaverryan added a commit to symfony/symfony-docs that referenced this pull requestNov 4, 2014
…(Grygir)This PR was merged into the master branch.Discussion----------[Translation] added method to expose collected message| Q             | A| ------------- | ---| Doc fix?      | no| New docs?     | yes (symfony/symfony#9859)| Applies to    | all (or 2.4+)| Fixed tickets |Commits-------f701f73 [Translation] added method to expose collected message
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@Grygir@jakzal@fabpot@aitboudad@wouterj@sstok@Tobion@stof@piotrpasich

[8]ページ先頭

©2009-2025 Movatter.jp