Open kironet opened 6 years ago
Good question! I wonder it too. In docs I see we can use custom
strategy to solve this:
http://jmsyst.com/bundles/JMSI18nRoutingBundle/master/configuration#scenario-something-else
But there's not enough information about it :/
@bocharsky-bw I've figured it out.
Create routes.locale.yml file and put there your routes translation. Example from my project:
routes.en.yml
accessories_index: /accessories
accessories_list: '/accessories/{category}'
accessories_list_paginated: '/accessories/{category}/page/{page}'
accessory_detail: 'accessories/{url}'
contact_index: /contact-us
routes.cs.yml
accessories_index: /prislusenstvi
accessories_list: '/prislusenstvi/{category}'
accessories_list_paginated: '/prislusenstvi/{category}/stranka/{page}'
accessory_detail: 'prislusenstvi/{url}'
contact_index: /kontakty
Hey @kironet ,
That's great! And thanks for this ping! Just want to clarify a bit, do you need to create those routes.%locale%.yml
files in a specific directory? Or it's no difference, you just need to require it in main routing.yml
?
@bocharsky-bw For symfony flex(SF 3.4/4.0+)
Directory: /translations
For symfony standard(../3.3/3.4)
the app/Resources/translations directory; the app/Resources/[bundle name]/translations directory; the Resources/translations/ directory inside of any bundle.
Ah, ok, thanks again! I'll give it a try. Btw, would you like to create a PR to the docs about this feature?
Hello,
I'm trying to translate url. Example:
Now:
Expected:
I'm searching on google but can't find the solution or hint for this.
My config:
My route:
@Route("/category/{categoryID}", name="category_products")