-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Allow new lines in Messages translated with transchoice() (replacement for #14867) #14897
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
Conversation
@@ -93,6 +93,20 @@ public function getChooseTests() | |||
array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0), | |||
array('There are no apples', '{0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0.0), | |||
array('There are no apples', '{0.0} There are no apples|]0,1[There are %count% apples|{1} There is one apple|[1,Inf] There is more than one apple', 0), | |||
|
|||
// Test texts with new-lines | |||
array('This is text with a\n new-line in it. Selector = 0.', '{0}This is a text with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
is not evaluated when using single-quoted strings (see the failing tests).
As long as the interpreted string is the same, the new-lines work fine. But the following combination does not work: key: "some text \n with a new line" text: 'some text \n with a new line" But I would say this is expected behavior.
👍 |
1 similar comment
👍 |
Thank you @azine. |
…(replacement for #14867) (azine) This PR was submitted for the 2.8 branch but it was merged into the 2.3 branch instead (closes #14897). Discussion ---------- Allow new lines in Messages translated with transchoice() (replacement for #14867) | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Hi, I found that the MessageSelector does not handle new lines in messages very well. I suggest adding the "s" modifier to the regexp used to identify the parts and ranges. What do you think? PS: would be nice to have this change also in Symfony 2.6 & 2.7 Commits ------- 786b8a6 Allow new lines in Messages translated with transchoice() (replacement for #14867)
@fabpot: my pleasure. Will this change/feature be backported to Symfony 2.6 and 2.7 as well? Or should I open separate pull-requests for that? Cheers, |
This is a bug fix, so it was merged in 2.3 and will be merged into newest branches as well. |
new-line in it. Selector = 0.|{1}This is a text with a | ||
new-line in it. Selector = 1.|[1,Inf]This is a text with a | ||
new-line in it. Selector > 1.', 1), | ||
// with single-quotes and id split accros lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this case is strictly the same than the previous one (the quote style being used does not change the string value here)
Hi,
I found that the MessageSelector does not handle new lines in messages very well.
I suggest adding the "s" modifier to the regexp used to identify the parts and ranges.
What do you think?
PS: would be nice to have this change also in Symfony 2.6 & 2.7