Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"php": ">=7.1",
"nette/component-model": "^3.0.0-beta2",
"nette/http": "^3.0.0-beta2",
"nette/utils": "^3.0-beta2"
"nette/utils": "dev-master"
},
"require-dev": {
"nette/di": "^2.4 || ~3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(array $table)
/**
* Translates the given string.
*/
public function translate($message, int $count = null): string
public function translate($message, ...$parameters): string
{
return $this->table[$message] ?? $message;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Forms/Controls/BaseControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,13 @@ public function getTranslator(): ?Nette\Localization\ITranslator
* Returns translated string.
* @return mixed
*/
public function translate($value, int $count = null)
public function translate($value, ...$parameters)
{
if ($translator = $this->getTranslator()) {
$tmp = is_array($value) ? [&$value] : [[&$value]];
foreach ($tmp[0] as &$v) {
if ($v != null && !$v instanceof Html) { // intentionally ==
$v = $translator->translate($v, $count);
$v = $translator->translate($v, ...$parameters);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.Button.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.Checkbox.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.CheckboxList.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.HiddenField.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.ImageButton.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.MultiSelectBox.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.RadioList.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.SelectBox.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.TextArea.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.TextInput.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.UploadControl.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
public function translate($s, int $count = null): string
public function translate($s, ...$parameters): string
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.translate().phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements \Nette\Localization\ITranslator
{
public function translate($message, int $count = null): string
public function translate($message, ...$parameters): string
{
return is_object($message) ? get_class($message) : $message;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Forms.renderer.translate.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Translator implements ITranslator
public $counter = [];


public function translate($message, int $count = null): string
public function translate($message, ...$parameters): string
{
@$this->counter[$message]++; // @ intentionally
return strtoupper($message);
Expand Down