Download the PHP package remmel/i18n-routing-bundle without Composer
On this page you can find all versions of the php package remmel/i18n-routing-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download remmel/i18n-routing-bundle
More information about remmel/i18n-routing-bundle
Files in remmel/i18n-routing-bundle
Package i18n-routing-bundle
Short Description This bundle allows you to create i18n routes.
License Apache2
Homepage http://jmsyst.com/bundles/JMSI18nRoutingBundle
Informations about the package i18n-routing-bundle
Full prefix per locale
That bundle allows you to configure host+prefix per locale.
For the following websites:
- www.website.com (english)
- www.website.de (german)
- www.website.be/fr/ (french of Belgium)
- www.website.be/nl/ (dutch of Belgium)
Minimum configuration
The configuration will be:
Translation configuration
To translate the route named "contact_page" in german :
Thus the route named _contactpage will be used when calling:
- www.website.com/contact
- www.website.de/kontakt
Optional configuration
To disable i18n feature for specific route:
@Route("/api", options={"i18n"=false})
or
To enable the routes only for a subset of locales:
@Route("/about", options={"i18n_locales"={"en", "de"}})
Thoses locales must be configured in jms_i18n_routing.locales
Installation
Download the Bundle
composer req remmel/i18n-routing-bundle
Enable the Bundle - For applications that don't use Symfony Flex :
Create configuration
Simple configuration with 2 "folders" :
When updating that config, it might be needed to clear cache: bin/console cache:clear
Check that configuration is fine running bin/console debug:router
Symfony demo app
Full Symfony application example
JMSI18nRoutingBundle vs Symfony i18n routing vs that extension
JMSI18nRoutingBundle
That code is based on JMSI18nRoutingBundle.
That fork has been simplified to only keep the code related to the prefix/host per locale.
Symfony
Symfony 4.1 now handle the translation of route and the prefix.
Symfony 5.1 now handle the different host per locale.
Thus, that extension is usefull if you want to externalize route translations (eg in routes.xx.yml).
That bundle will be useless when that feature will be implemented and translations externalized in routes.??.yml files.