Routing issues with multi language

Your code from earlier in the forum works really well, on how to insert the language code for urls that do not have it, @texnixe :slight_smile: . And the code from @lukasbestle does not. Is there anything that have changed in the last releases?

array(
    'pattern' => '(:any)',
    'action' => function($uri) {
      if ($uri == 'br' or $uri == 'en' or substr( $uri, 0, 2 ) === "br" || substr($uri, 0, 2) == 'en') {
        $site = kirby()->site();
        $page = page('home');
        return $site->visit($page);
      } else {
          $site = kirby()->site();
          $page = page($uri);
          go('br/' . $page);
      }
   }
 ),

How hard is it for this code to also be URL-key aware as well @texnixe?