Skip to content

Locale in path #92

Description

@aistis-

Hello,

I have a case where the paths of the site looks:

  • example.com/en/banana
  • example.com/fr/banane
  • example.com/lt/bananas

My current routing definition:

# app/config/routing.yml
my_fruits:
    resource: '@MyFruitsBundle/Resources/config/routing/banana.yml'
    type: be_simple_i18n
    prefix:   /{_locale}/
    requirements:
        _locale: 'en|fr|lt'
# src/My/FruitsBundle/Resources/config/routing/banana.yml
my_fruits_banana:
    locales:
        en: '/banana'
        fr: '/banane'
        lt: '/bananas'
    defaults:
        _controller: 'MyFruitsBundle:Banana:list'

How would be possible to deny paths with mismatched _locale and parameter with a translation locale?

What I want to achieve:

  • example.com/en/banana - 200
  • example.com/fr/banane - 200
  • example.com/lt/bananas - 200
  • example.com/fr/banana - 404
  • example.com/lt/banane - 404
  • example.com/en/bananas - 404

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions