Skip to content

Commit

Permalink
Merge pull request #208 from Chitzi/patch-1
Browse files Browse the repository at this point in the history
Remove space in the parameters
  • Loading branch information
Stichoza committed Jun 27, 2024
2 parents bd9ef8a + f47197b commit 3e4dbbf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/GoogleTranslate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]],
Expand Down

0 comments on commit 3e4dbbf

Please sign in to comment.