Skip to content

[2.1][2.2][Routing] Generated urls ignores the current locale and takes the default one #7063

@tristanbes

Description

@tristanbes

Hi,

(Since I moved to 2.2), the links that are generated simply ignores the current locale of the user. The only way to change the locale in the generated url are to change to default_locale setting under framework.

It results having english links generated with a french URL (which looks like : myhost.com/fr/test)

  • When dumping {{ app.request.locale }} it shows the right locale (fr)
  • When dumping the url produced by any {{ path() }} (without precising the current locale) it only takes the default_locale which in our case produces (en) links

This does not affect the translated content.

My routes are prefixed with {_locale}
Symfony2.2 at commit 63bfd9e

framework:
    esi:             { enabled: true }
    translator:      { fallback: %locale% }
    secret:          %secret%
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        strict_requirements: %kernel.debug%
    form:            true
    csrf_protection: true
    validation:      { enable_annotations: true }
    templating:      { engines: ['twig'] } #assets_version: SomeVersionScheme
    default_locale:  %locale%
    session:`
        lifetime: 0
        save_path: ~ # default php ini value
        #cookie_domain: .seek-team.com
    trusted_proxies: ~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions