# Prevent Route Parameter Translation in Mezzio with Laminas\\I18n Integration

**URL:** <https://discourse.laminas.dev/t/prevent-route-parameter-translation-in-mezzio-with-laminas-i18n-integration/3822>\
**Category:** Mezzio\
**Tags:** mezzio\
**Created:** [December 17, 2024, 10:51am UTC](https://discourse.laminas.dev/t/prevent-route-parameter-translation-in-mezzio-with-laminas-i18n-integration/3822 "2024-12-17T10:51:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanjivsharmalv](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/sanjivsharmalv/32/1164_2.png) [@sanjivsharmalv](https://discourse.laminas.dev/u/sanjivsharmalv)\
**Post date:** [December 17, 2024, 10:51am UTC](https://discourse.laminas.dev/t/prevent-route-parameter-translation-in-mezzio-with-laminas-i18n-integration/3822/1 "2024-12-17T10:51:29Z")

</div>

I am encountering an issue where the route parameter in my Mezzio application seems to be causing errors due to unintended **translation** behavior.

Here is my route configuration for editing a `Locale`:

```auto
// Edit Locale Route
[
    'name' => 'web.locales.edit',
    'path' => '/locales/edit/{id:\d+}',
    'middleware' => [
        Mezzio\Session\SessionMiddleware::class,
        Mezzio\Csrf\CsrfMiddleware::class,
        \Web\Locales\LocalesEditHandler::class,
    ],
    'allowed_methods' => ['GET', 'POST'],
],

```

The problem occurs when the `{id}` parameter is included in the route path. Specifically:

- If I change the route to `/locales/edit` (without `{id}`), the route works fine.
- When `{id}` is added as a dynamic segment, I encounter an error: **“No Translator provided”**.

I am using:

- **Mezzio** with **Laminas\Router** (and Laminas\I18n installed)
- Dynamic route matching with **`Segment`** type
- Translator is configured (likely through Laminas\I18n)

### **What I’ve Tried** :

1. I ensured that the route itself does not include translatable content.
2. I tested removing Laminas\I18n entirely, but the problem persisted.
3. I attempted switching to the **`Literal`** route type instead of `Segment`, but this doesn’t solve the issue since `Literal` routes do not support dynamic parameters.

* * *

### **Questions** :

1. Is there a way to **prevent the translator** from affecting the route parameters like `{id}`?
2. Is this a configuration issue with Laminas\I18n or the router setup?
3. How can I explicitly disable translation for a specific route or ensure dynamic segments like `{id}` are treated as plain route parameters?

* * *

### **Environment** :

- **Mezzio** : 3.x
- **Laminas\Router** : Latest
- **Laminas\I18n** : Installed
- PHP: 8.1.x

Any guidance on how to resolve this issue or prevent the translator from interfering with dynamic route parameters would be greatly appreciated. Thank you!

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [December 17, 2024, 1:25pm UTC](https://discourse.laminas.dev/t/prevent-route-parameter-translation-in-mezzio-with-laminas-i18n-integration/3822/2 "2024-12-17T13:25:28Z")

</div>

> [@sanjivsharmalv](#):
>
> When `{id}` is added as a dynamic segment, I encounter an error: **“No Translator provided”**.

Instead of `{id}` try to use `:id`.

---

<div class="post-metadata">

**Author:** ![sanjivsharmalv](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/sanjivsharmalv/32/1164_2.png) [@sanjivsharmalv](https://discourse.laminas.dev/u/sanjivsharmalv)\
**Post date:** [December 17, 2024, 1:43pm UTC](https://discourse.laminas.dev/t/prevent-route-parameter-translation-in-mezzio-with-laminas-i18n-integration/3822/3 "2024-12-17T13:43:29Z")

</div>

> [@froschdesign](#):
>
> Instead of `{id}` try to use `:id`.

Thanks a ton, that worked!!
