Skip to content

Commit

Permalink
fix (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleswita authored Jun 4, 2022
1 parent cea48ff commit 9796ce3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ public function translate(
$translated = $this->trans($message, $params, $domain, $locale);

if ($this->returnOriginalMessage) {
if (!$this->getCatalogue()->has($message, $domain)) {
if (!$this->getCatalogue($locale)->has($message, $domain)) {
return $originalMessage;
}
}
Expand Down
4 changes: 4 additions & 0 deletions tests/Tests/TranslatorTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ final class TranslatorTest extends TestAbstract
Assert::same('It\'s a boy!', $translator->translate('baby_gender', ['gender' => 'boy']));
Assert::same('It\'s a girl!', $translator->translate('baby_gender', ['gender' => 'girl']));
Assert::same('It\'s something else!', $translator->translate('baby_gender', ['gender' => 'kibork']));

$translator->setLocale('en_US');

Assert::same('Přelož', $translator->translate('keyOnlyInCsCz', null, [], 'messages', 'cs_CZ'));
}

public function test03(): void
Expand Down
1 change: 1 addition & 0 deletions tests/lang/messages.cs_CZ.neon
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
plural: "Kontakt|Kontakty|Hodně kontaktů"
keyOnlyInCsCz: "Přelož"

0 comments on commit 9796ce3

Please sign in to comment.