8000 Added i18n support to ConfirmationQuestion · symfony/symfony@c85247b · GitHub
[go: up one dir, main page]

Skip to content

Commit c85247b

Browse files
committed
Added i18n support to ConfirmationQuestion
1 parent f4a087b commit c85247b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Symfony/Component/Console/Question/ConfirmationQuestion.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@
1818
*/
1919
class ConfirmationQuestion extends Question
2020
{
21-
public function __construct($question, $default = true)
21+
private $trueAnswer;
22+
23+
public function __construct($question, $default = true, $trueAnswer = 'y')
2224
{
2325
parent::__construct($question, (bool) $default);
2426

2527
$this->setNormalizer($this->getDefaultNormalizer());
28+
$this->trueAnswer = $trueAnswer;
2629
}
2730

2831
private function getDefaultNormalizer()
@@ -35,10 +38,10 @@ private function getDefaultNormalizer()
3538
}
3639

3740
if (false === $default) {
38-
return $answer && 'y' === strtolower($answer[0]);
41+
return $answer && $this->trueAnswer === strtolower($answer[0]);
3942
}
4043

41-
return !$answer || 'y' === strtolower($answer[0]);
44+
return !$answer || $this->trueAnswer === strtolower($answer[0]);
4245
};
4346
}
4447
}

0 commit comments

Comments
 (0)
0