php - Different host and routes in Symfony witho JMS i18n -
i want different host , different routes in multicountry web symfony 3. used jms i18n routing this. config yml file:
jms_i18n_routing: default_locale: es_es locales: [es_es, fr_fr, en_gb] strategy: custom hosts: es_es: www.aaa.local fr_fr: www.aaa-fr.local en_gb: www.aaa-uk.local redirect_to_host: true with this, can use different host correctly, don't know how can "translate" routes, f.ex: /contacto /contact , /contact.
i want load differents routing.yml depends on locale.
when using jmsi18nroutingbundle routes being translated automatically based on route_name using routes domain (symfony translation component). so, assumed route_name contact, create translations this:
id/source: contact domain: routes locale: en translation/target: /contact id/source: contact domain: routes locale: es translation/target: /contacto now routes using symfony router (which wrapped 1 bundle) return automatically translated route current locale. if want translate specific locale, add route parameter _locale this:
{{ path("contact", {"_locale": "es"}) }} or
$this->get('router')->generate('contact', array('_locale' => 'es'));
Comments
Post a Comment