- Issue created by @levmyshkin
- 🇨🇦Canada wilco
To be honest, I've never really come across a site where the argument following the language isn't a path element to something.
For instance:
someplace.earth/sites/en/english-wording
If I were to interpret this, my setup would tell me that our domain points to a codebase inside a folder path called 'sites'. This is usually achieve with a symlink or other linking back to the Drupal root. Then, the site language negotiation begins and we are now working with a site that has "en" as a language identifier. From this point forward, the index.php is rewritten via some rules to be hidden and the path query would be "english-wording". What this means is that "english-wording" points to something internal with drupal, like a front page or a node or a module function. Whatever it is, that is usually how that goes.
Now, there is nothing saying you couldn't do some trickery and have all sorts of symlinks just to root the site at "sites/en/english-wording" but that would defeat the purpose of a language identifier in the path.
Given how the language configuration for Drupal works, I'm not sure you can have this "/en/english-wording" and this "/en/wording-in-french" as bases. Seems awfully complicated to me.
- 🇨🇦Canada wilco
Just as an aside, in my example, I am showing a complex site setup:
someplace.earth/sites/english-wording/en
How to read this is:
someplace.earth
= domain
/sites
= folder on the drive
/english-wording
= folder inside the above folder which symlinks BACK to Drupal Root
/en
= language negotiationAnything that follows
someplace.earth/sites/english-wording/en
like saysomeplace.earth/sites/english-wording/en/front-page
would be linking to a node or something IN Drupal. - 🇷🇸Serbia levmyshkin Novi Sad, Serbia
Hi wilco, thank you for your explanation! I think I described my case not detailed. I have two sites "Main" (in document root) and "Second" (another site in "second" directory)
/
/secondI have a request for SEO team to have one langcode for both different sites (two different databases and two different codebases):
EN:
/
/secondFR
/fr
/fr/secondI already setup symlinks fr, de, pl from document root to /fr/second, so it's possible to fetch URLs as described.
I also added custom Language Negotiator class to set current language using base path (/fr/second, for example). It's working fine.
But here is mind blowing approach with inbound/outbound URL, so I'm trying to fix all URLs on the site. My problem is Drupal core uses langcode prefix, for generating URLs and now I have these URLs:
/fr/second/fr/path
/de/second/de/pathBecause second langcode is part of generated URL. I'm still working around to remove second "prefix" langcode. I will share results here.
- 🇨🇦Canada wilco
Usually, the way Drupal handles language negotiation, the folder structure of a site (its location) comes before the language negotiation aspect. Such that,
http://example.site/fr
-> to the root folder
http://example.site/somelocation/fr
-> would have a symlink back to the root called somelocation and not your language negotiation doesn't get in the way.Technically speaking the path looks like this:
http://example.site/somelocation/fr/index.php
So, based on your example above, you would have this:
http://example.site/fr/index.php?q=second
Which at this point, the path is a request for an internal path. Hence why it doesn't likely do what you want it to do.
Negotiation language prefixes comes BEFORE the index.php BUT AFTER all symlinked folders.
I hope that helps.
- Assigned to wilco
- Status changed to Needs review
about 1 year ago 5:01pm 6 October 2023