BeSimple / BeSimpleI18nRoutingBundle

NOT MAINTAINED - Full routing internationalized on your Symfony project
185 stars 63 forks source link

prefix #90

Open davidsanz opened 8 years ago

davidsanz commented 8 years ago

Hello.

I use symfony 3.1 and if put prefix routing in app/config/routing like this:

prefix:
        en: /website
        fr: /site
        de: /webseite

got this error:

Warning: trim() expects parameter 1 to be string, array given in /Users/davidsanz/Documents/httpdocs/perieven/app/config/routing.yml (which is being imported from "/Users/davidsanz/Documents/httpdocs/perieven/app/config/routing_dev.yml").

Can help me please.

Thanks!

aistis- commented 8 years ago

I confirm it is a bug - I have the same issue on Symfony 3.1

boekkooi commented 8 years ago

Hi @davidsanz,

Did you by any chance for get the type: be_simple_i18n in you route definition?

aistis- commented 8 years ago

I've managed to replicate it with type: be_simple_i18n set.

EDIT: looks like I forgot to add type: be_simple_i18n to the parent routing file of the one where multilanguage prefix is defined. So it works for me on 3.1 Symfony :) Thanks @boekkooi

davidsanz commented 8 years ago

I dont know why but i've this error: Warning: trim() expects parameter 1 to be string, array given in C:\wamp\www\perieven\app/config\routing.yml (which is being imported from "C:\wamp\www\perieven\app/config/routing_dev.yml") with this routing file: expedientes:

    resource: "@ExpedientesBundle/Resources/config/routing.yml"
    type: be_simple_i18n
    prefix:
        es: /expedientes
        en: /files
        it: /cartella
        de: /fahrzeug-unterlagen
        fr: /archives
aistis- commented 8 years ago

I guess app/config/routing.yml itself isn't loaded as be_simple_i18n type, so it throes an error. An easy workaround would be to have one more middle file in the routing files tree. Maybe there is a better way to define app/config/routing.yml as be_simple_i18n resource :bulb:

aistis- commented 8 years ago

@davidsanz try in you app/config/config.yml add:

framework:
    router:
        resource: "%kernel.root_dir%/config/routing.yml"
        type: be_simple_i18n
davidsanz commented 8 years ago

Thanks aistis- but dont work. Return same error.

kardi31 commented 7 years ago

I've got the same error. Any updates on this issue?

anelad commented 7 years ago

You can solve that issue with changing routing_dev.yml;

//routing_dev.yml
.....
....
_main:
    resource: routing.yml
    type: be_simple_i18n
ibrambe commented 6 years ago

@anelad That fix makes your app_dev.php work, but production (app.php) won't work that way.

This issue wasn't there in beta1, only in 2.4.0.