tc()
Translates a count
tc(string $key, int $count, ?string $locale = null, bool $formatNumber = true): mixed|null
Parameters
Name | Type | Default | Description |
---|---|---|---|
$key * | string |
– | |
$count * | int |
– | |
$locale | string |null |
null |
|
$formatNumber | bool |
true |
If set to false , the count is not formatted |
Return type
mixed
|null
Example
Given a translation with a placeholder
'translations' => [
'en' => [
'errors' => 'There are { count } errors in the form.',
],
// …
],
Replace placeholder with given number
echo tc('errors', 5);
// There are 5 errors in the form.