| 1 |
<?php |
| 2 |
|
| 3 |
namespace ipl\I18n; |
| 4 |
|
| 5 |
use ipl\Stdlib\Contract\Translator; |
| 6 |
|
| 7 |
/** |
| 8 |
* Translator that just returns the original messages |
| 9 |
*/ |
| 10 |
class NoopTranslator implements Translator |
| 11 |
{ |
| 12 |
public function translate(string $message, ?string $context = null): string |
| 13 |
{ |
| 14 |
return $message; |
| 15 |
} |
| 16 |
|
| 17 |
public function translateInDomain(string $domain, string $message, ?string $context = null): string |
| 18 |
{ |
| 19 |
return $message; |
| 20 |
} |
| 21 |
|
| 22 |
public function translatePlural(string $singular, string $plural, int $number, ?string $context = null): string |
| 23 |
{ |
| 24 |
return $number === 1 ? $singular : $plural; |
| 25 |
} |
| 26 |
|
| 27 |
public function translatePluralInDomain( |
| 28 |
string $domain, |
| 29 |
string $singular, |
| 30 |
string $plural, |
| 31 |
int $number, |
| 32 |
?string $context = null |
| 33 |
): string { |
| 34 |
return $number === 1 ? $singular : $plural; |
| 35 |
} |
| 36 |
} |