|
@@ 102-108 (lines=7) @@
|
| 99 |
|
* @param string $locale |
| 100 |
|
* @return string |
| 101 |
|
*/ |
| 102 |
|
public function translate($message, $textDomain = 'default', $locale = null) |
| 103 |
|
{ |
| 104 |
|
$textDomain = $textDomain !== 'default' ? $textDomain : $this->domain(); |
| 105 |
|
$locale = $locale ?: (string) $this->currentLanguage(); |
| 106 |
|
|
| 107 |
|
return $this->translationService()->translate($message, $textDomain, $locale); |
| 108 |
|
} |
| 109 |
|
|
| 110 |
|
/** |
| 111 |
|
* Translate a plural message. |
|
@@ 120-132 (lines=13) @@
|
| 117 |
|
* @param string|null $locale |
| 118 |
|
* @return string |
| 119 |
|
*/ |
| 120 |
|
public function translatePlural( |
| 121 |
|
$singular, |
| 122 |
|
$plural, |
| 123 |
|
$number, |
| 124 |
|
$textDomain = 'default', |
| 125 |
|
$locale = null |
| 126 |
|
) |
| 127 |
|
{ |
| 128 |
|
$textDomain = $textDomain !== 'default' ?: $this->domain(); |
| 129 |
|
$locale = $locale ?: (string) $this->currentLanguage(); |
| 130 |
|
|
| 131 |
|
return $this->translationService()->translatePlural($singular, $plural, $number, $textDomain, $locale); |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
/** |
| 135 |
|
* Adds a translation to the translator |