Open andrzejdziekonski opened 8 years ago
Are you able to use different parameters.yml files for each site? That would solve your problem I guess.
May be need support for default locale for each domain too, for example:
example.be -> default locale: fr
example.fr -> default locale: fr
example.com -> default locale: en
Only one default locale for all domains is not possible, each domain have their own default locale
.be -> fr
.cat -> ca
.com -> en
.es -> es
.fr -> fr
.it -> it
.pt -> pt
etc...
Many parameters per machine/domain/site is not a solution...
I would also need something like this, so I can have several hosts in dev mode (one for local, and one for preprod server for instance). Any solution like an array or something ?
Hi @picks44,
i managed that by using 'fake' locales e.i. 'en1', 'en2', 'en3' so i have one host to one locale as the bundle needs. Then i wrote some event listener that overwrites those fakes to proper one. Kinda tricky but didnt find any better solution for this one.
OK I see, I had something similar at first when i was working with prefixes. I'll try it thanks.
@andrzejdziekonski or @picks44 could you guys give a detailed example on how to achieve this please? I would like my root domain (/) to have the same content as /en
We solve this with BeSimpleI18nRoutingBundle and works fine, our config:
# @ParclickWebsiteBundle/Resources/config/routing.yml
routing_parclick.be:
resource: "@ParclickWebsiteBundle/Resources/config/routing_parclick.be.yml"
host: "%subdomain%parclick.be"
requirements:
_locale: de_BE|fr_BE
type: be_simple_i18n
routing_parclick.cat:
resource: "@ParclickWebsiteBundle/Resources/config/routing_parclick.cat.yml"
host: "%subdomain%parclick.cat"
requirements:
_locale: ca_ES
type: be_simple_i18n
routing_parclick.com:
resource: "@ParclickWebsiteBundle/Resources/config/routing_parclick.com.yml"
host: "%subdomain%parclick.com"
requirements:
_locale: en_GB
type: be_simple_i18n
# etc...
And:
# @ParclickWebsiteBundle/Resources/config/routing_parclick.be.yml
home:
locales: { fr_BE: "/", de_BE: "/de/" }
defaults: { _controller: ParclickWebsiteBundle:Home:index }
methods: [GET]
search:
locales: { fr_BE: "/search", de_BE: "/de/search" }
defaults: { _controller: ParclickWebsiteBundle:Search:index }
methods: [GET]
city:
locales: { fr_BE: "/parking-{city}", de_BE: "/de/parking-{city}" }
defaults: { _controller: ParclickWebsiteBundle:City:index }
methods: [GET]
# etc...
And we use each domain only for their locales configured.
You can copy same locales between domains.
NOTE 1: The locale prefix is NEVER used in our generated URLs, is only used for building URLs, for example if we need to build a URL with internal locale "de_BE" we not put the locale as prefix in the URL, we fake a more apropiate prefix (/en/
For parclick.be -> locale fr_BE (French): url /parking-123
For parclick.be -> locale de_BE (Deutch): url /de/parkeren-123
One application, one config, one parameters, all domains.
Hope this help someone.
Thanks for the answer @tecnocat ! I will try your solution.
Still no other other simpler solution ?
Up :)
+1
Is it possible to have application working with multiple domains for one locale? I mean:
I need my application to run for two smiliar in code but different content websites. They are in same language, use same image uploads and the same database so i want them to work in one application. Is it possible with this bundle? Of course not by default, but has anybody found solution?