diff --git a/src/GoogleTranslate.php b/src/GoogleTranslate.php index efc1e37..c70115f 100644 --- a/src/GoogleTranslate.php +++ b/src/GoogleTranslate.php @@ -364,6 +364,9 @@ function ($matches) { */ protected function injectParameters(string $string, array $replacements): string { + // Remove space added by google in the parameters + $string = preg_replace('/#\{\s*(\d+)\s*\}/', '#{$1}', $string); + return preg_replace_callback( '/\#{(\d+)}/', fn($matches) => $replacements[$matches[1]],