JMSI18nRoutingBundle icon indicating copy to clipboard operation
JMSI18nRoutingBundle copied to clipboard

How to combine prefix_except_default strategy with different hosts?

Open onlime opened this issue 9 years ago • 1 comments

I love the prefix_except_default strategy but I would like to combine it with multiple hosts. What I would like to accomplish:

  • http://example.ch/ -> de_CH
  • http://example.ch/en/ -> en
  • http://example.de/ -> de_DE

Tried it with the following configuration:

jms_i18n_routing:
    default_locale: de_CH
    locales: [de_CH, de_DE, en]
    hosts:
        de_CH : example.ch
        de_DE : example.de
        en: example.ch
    strategy: prefix_except_default

No luck, this will give me the following error:

Invalid configuration for path "jms_i18n_routing.hosts": Every locale must map to a different host. You cannot have multiple locales map to the same host.

Can this be done with the current version of the JMSI18nRoutingBundle bundle or could you push this feature into a future version? Thanks. Best regards, Philip

onlime avatar Mar 15 '15 14:03 onlime

I've spent past week playing around different approaches and finally came up with the following: https://github.com/MichaelKubovic/JMSI18nRoutingBundle. Let me know whether it helps!

MichaelKubovic avatar Jul 20 '15 09:07 MichaelKubovic