dachcom-digital / pimcore-i18n

Pimcore - i18n Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Single domain setup with multiple locales

studio1gmbh-pimcore opened this issue · comments

In Pimcore projects we often have a setup similar like this, just like in the pimcore demo:

  • Only one domain, specified in pimcore system settings (no site is used)
  • One specific default language (de in this example), that will be the base for translations
  • The link de points at the root document (id 1) wich will make it the main page for the default language
  • Other languages get their own main pages

image

If we install the bundle in such a projects we run into errors like this. The language is setup properly and defintion of zones are not possible, since we use no sites.
image
image

I've read all the documentation but either I don't understand it or I'm lacking some other important part.


The goal in this setup also is to strip the locale fragment of the url in the default language (domain.com/de/seite1 should be domain.com/seite1).

It seems that this could be possible with i18n:

## Optional Locale in Url
The I18nBundle allows you to have domains without a locale fragment in url. For Example:
- `domain.com/about-us`
- `domain.com/news`
To achieve that you just set the language property to the `domain.com` document which is also a pimcore site.

But at another point we have the following conflicting convention in the docs:

For multi-language sites (e.g. example.org/de and example.org/en): Please ensure that the site document (domain, e.g. example.org) does not have a defined language (Document => Tab "Navigation & Settings" => "Language" Dropdown: Select `None` and save).


Can you please confirm if such setup is possible with i18n or not?

Thanks in advance! 😊

@solverat 🏓 short feedback would be highly appreciated. Thank you.

Hey @studio1gmbh-pimcore.

Yes, the setup you've described, is not possible with i18n.

While it is true, that you're able to use it without the locale fragment, you're not allowed to mix them.

So either

  • you use multiple sites with defined locale properties (then you're able to skip the locale part)
  • or you're using a single site (without locale property), but then you need to provide valid subpages (en, de → add locale fragment and those pages).

If you're able to change your setup (using a locale fragment in your routes all the time), i18n is the right tool for you.

@solverat thanks for clarify!

For single domain environments we commited us to use the following solution:

  • Use only one site, which is the root document (ID 1)
  • Specify domain, languages and default language in pimcore system settings
  • Remove locale property from root document
  • Setup individual document trees for each language
  • Implement a redirect action for the root document (as fallback, in case the automatic i18n redirects will fail for any reason)

Once setup, i18n works like a charm.

Awesome, glad to hear!