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

[FrameworkBundle] fixed custom domain for translations in php templates#21359

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:2.7fromrobinlehrmann:issue-20135
Feb 3, 2017
Merged

[FrameworkBundle] fixed custom domain for translations in php templates#21359

fabpot merged 1 commit intosymfony:2.7fromrobinlehrmann:issue-20135
Feb 3, 2017

Conversation

@robinlehrmann
Copy link

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#20135
LicenseMIT
Doc PR

* @var array
*/
protected$sequences =array(
protectedstatic$sequences =array(
Copy link
Member

Choose a reason for hiding this comment

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

Thestatic change should be reverted.

Choose a reason for hiding this comment

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

Done.


for ($key =0;$key <$tokenIterator->count(); ++$key) {
foreach ($this->sequencesas$sequence) {
foreach (self::$sequencesas$sequence) {
Copy link
Member

Choose a reason for hiding this comment

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

Must then be reverted too.

Choose a reason for hiding this comment

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

Done

}
}

privatefunctionseekToMessageParamsEnd(\Iterator$tokenIterator)
Copy link
Member

Choose a reason for hiding this comment

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

maybe better name thisseekBehindMessageParams

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

I would now rename this too (something likeskipMethodArgument())

protectedfunctionnormalizeToken($token)
{
if (isset($token[1]) &&'b"' !==$token) {
if ('b"' !==$token &&isset($token[1])) {
Copy link
Member

Choose a reason for hiding this comment

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

IMO this should be reverted as it is not part of the bug fix.

Choose a reason for hiding this comment

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

Done

* match allowed tokens.
*/
privatefunctiongetMessage(\Iterator$tokenIterator)
privatefunctionprovideRawString(\Iterator$tokenIterator)
Copy link
Member

Choose a reason for hiding this comment

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

What aboutgetStringValue() instead?

Choose a reason for hiding this comment

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

Done

for (;$tokenIterator->valid();$tokenIterator->next()) {
$t =$tokenIterator->current();

if ('[' ===$t[0] ||'(' ===$t[0]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you should not take account of braces inside a string

->trans('msg', ['p' =>'[\'' ],'not_messages')

Choose a reason for hiding this comment

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

I added this line to my tests too and it passes.

Copy link
Member

Choose a reason for hiding this comment

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

@aitboudad In your example,$t will be an array consisting of three elements where the value at index 0 isT_CONSTANT_ENCAPSED_STRING if I am not mistaken.

'(',
self::MESSAGE_TOKEN,
',',
T_LNUMBER,
Copy link
Contributor

Choose a reason for hiding this comment

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

it can be an expression or function call

Choose a reason for hiding this comment

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

I added a new test with array_map function and the tests passes. Can you explain what you mean please :) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

<?phpecho$view['translator']->transChoice('msg',10 +1, [],'not_messages');?><?phpecho$view['translator']->transChoice('msg',intval(4.5), [],'not_messages');?>

Choose a reason for hiding this comment

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

Okay, I added this lines and the Tests don't pass. Thank you!
I will fix it asap.

Copy link
Member

Choose a reason for hiding this comment

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

I guess you can use the same approach here that is already used for skipping the message params.

Copy link
Author

@robinlehrmannrobinlehrmann left a comment

Choose a reason for hiding this comment

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

I added some tests and it passes.

@nicolas-grekasnicolas-grekas added this to the2.7 milestoneJan 24, 2017
@robinlehrmann
Copy link
Author

Hi,@aitboudad@xabbuh
I've fixed the issue and added some tests for it. Could you review my changes please ?

class PhpExtractorextends AbstractFileExtractorimplements ExtractorInterface
{
constMESSAGE_TOKEN =300;
constMESSAGE_ARGUMENTS_TOKEN =1000;
Copy link
Member

Choose a reason for hiding this comment

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

I would name thisMETHOD_ARGUMENTS_TOKEN

Copy link
Member

@xabbuhxabbuh left a comment

Choose a reason for hiding this comment

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

👍

Status: Reviewed

@fabpot
Copy link
Member

Thank you@robinlehrmann.

@fabpotfabpot merged commit78c0ec5 intosymfony:2.7Feb 3, 2017
fabpot added a commit that referenced this pull requestFeb 3, 2017
…php templates (robinlehrmann)This PR was merged into the 2.7 branch.Discussion----------[FrameworkBundle] fixed custom domain for translations in php templates| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#20135| License       | MIT| Doc PR        |Commits-------78c0ec5 [FrameworkBundle] fixed custom domain for translations in php templates
This was referencedFeb 6, 2017
@robinlehrmannrobinlehrmann deleted the issue-20135 branchFebruary 6, 2017 20:57
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@xabbuhxabbuhxabbuh approved these changes

+1 more reviewer

@aitboudadaitboudadaitboudad approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

6 participants

@robinlehrmann@fabpot@aitboudad@xabbuh@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp