Kirbytext, str_replace and multilanguage

Hello,

I want to use site/plugins to make some str_replace depending of the “active” language.

How can I mix that :

if ($site->language()->code() === 'en') {

With that kind of code?

kirbytext::$post[] = function($kirbytext, $value) {
return str_replace(' a', ' b', $value);
 }; 

Thank for the help!

<?php
kirbytext::$post[] = function($kirbytext, $value) {
  if(site()->language()->code() == 'en') {
    return str_replace(' a', ' b', $value);
  } else {
    return str_replace(' a', ' c', $value);
  }
 };

Clever, thanks for the quick answer!