Skip to content

Commit

Permalink
Log language along with placeholder error message
Browse files Browse the repository at this point in the history
This makes it easier to find if you're translating multiple languages.
  • Loading branch information
q-- committed Sep 17, 2024
1 parent 5412ef2 commit fc9519f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Drivers/Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ public function getGoogleTranslate($language, $token)
if (count($translatedMatches[0]) !== count($placeholders)) {
// Print a warning to stderr
fwrite(STDERR, sprintf(
"Warning: Placeholder count mismatch in translated text.\nOriginal text: %s\nTranslated text: %s\nExpected placeholders: %s\nActual placeholders: %s\n",
"Warning: Placeholder count mismatch in translated text when translating %s to %s.\nOriginal text: %s\nTranslated text: %s\nExpected placeholders: %s\nActual placeholders: %s\n",
$this->sourceLanguage,
$language,
$token,
$translatedText,
json_encode($placeholders),
Expand Down

0 comments on commit fc9519f

Please sign in to comment.