|
@@ 67-88 (lines=22) @@
|
| 64 |
|
/** |
| 65 |
|
* {@inheritdoc} |
| 66 |
|
*/ |
| 67 |
|
public function trans($id, array $parameters = [], $domain = null, $locale = null): string |
| 68 |
|
{ |
| 69 |
|
$id = (string) $id; |
| 70 |
|
if (empty($domain)) { |
| 71 |
|
$domain = 'messages'; |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
$catalogue = $this->getCatalogue($locale); |
| 75 |
|
if ($catalogue->defines($id, $domain)) { |
| 76 |
|
return $this->symfonyTranslator->trans($id, $parameters, $domain, $locale); |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
$locale = $catalogue->getLocale(); |
| 80 |
|
if (empty($locale) || $locale === $this->defaultLocale) { |
| 81 |
|
// we cant do anything... |
| 82 |
|
return $id; |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
$orgString = $this->symfonyTranslator->trans($id, $parameters, $domain, $this->defaultLocale); |
| 86 |
|
|
| 87 |
|
return $this->translateWithSubstitutedParameters($orgString, $locale, $parameters); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
|
/** |
| 91 |
|
* {@inheritdoc} |
|
@@ 93-114 (lines=22) @@
|
| 90 |
|
/** |
| 91 |
|
* {@inheritdoc} |
| 92 |
|
*/ |
| 93 |
|
public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null): string |
| 94 |
|
{ |
| 95 |
|
$id = (string) $id; |
| 96 |
|
if (empty($domain)) { |
| 97 |
|
$domain = 'messages'; |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
$catalogue = $this->getCatalogue($locale); |
| 101 |
|
if ($catalogue->defines($id, $domain)) { |
| 102 |
|
return $this->symfonyTranslator->transChoice($id, $number, $parameters, $domain, $locale); |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
$locale = $catalogue->getLocale(); |
| 106 |
|
if ($locale === $this->defaultLocale) { |
| 107 |
|
// we cant do anything... |
| 108 |
|
return $id; |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
$orgString = $this->symfonyTranslator->transChoice($id, $number, $parameters, $domain, $this->defaultLocale); |
| 112 |
|
|
| 113 |
|
return $this->translateWithSubstitutedParameters($orgString, $locale, $parameters); |
| 114 |
|
} |
| 115 |
|
|
| 116 |
|
/** |
| 117 |
|
* {@inheritdoc} |