Routing multi-language plugin

I wrote a Plugin that sends emails on a form post, but it’s not working when changed to english (standard language is german). There is no error message, i just get skipped to the page and it seems to not execute the plugin in this case. Here is the plugin index.php:

     '****\\bestellungen\\mailer' => __DIR__ .'/src/Mailer.php'

 Kirby::plugin('****/bestellungen', [
  'snippets' => [
   'bestellungen/form' => __DIR__ . '/snippets/form.php'
  'routes' => [
      'pattern' => 'service/order',
      'action'  => function() { return ****\Bestellungen\Mailer::recipeOrder(); },
      'method' => 'POST'

The german page is /service/order, the english page is /en/service/order. This seems to break the routes. Any ideas?

I’d say the route needs the language code.

Okay. So german is /service/order, english is /en/service/order. Which pattern can i use to get both? Something like (:any)/service/order?

If your German version doesn’t use the language code, you have to make it optional in your route pattern.

'pattern' => '(?:(:any)//?)?service/order'

Routes for languages will get more comfortable in 3.2.

Thanks! :slight_smile: