I'm currently working on a multilingual website, whose addressing works perfectly without installing this module and there are no problems with the menus and sidebars. But there is a serious problem, let's see:
This website uses two languages: Brazilian Portuguese (pt-br) and English (en). Portuguese is the main language and the site was built so that URLS work as follows:
Portuguese: localhost/sitename or sitename/
English: localhost/sitename/en or sitename/en
The big problem is with the links on English language content pages, as Drupal cannot see the URL indicated in the link correctly.
For example:
User browsing in English, opens a page and clicks on the "Contact Us (node 20)" link. The URL for this link should be: "localhost/sitename/en/contact/contact-us", but the results are as follows:
Link: /node/20 -> URL: localhost/sitename/contato/fale-conosco - Refers the user to node 20, in Portuguese
Link: en/node/20 -> URL: localhost/sitename/contato/fale-conosco - Refers the user to node 20, in Portuguese
Link: /en/node/20 -> URL: localhost/sitename/contato/fale-conosco - Refers the user to node 20, in Portuguese
Link: ../en/node/20 -> URL: localhost/en/node/20 - Message from Apache, informing that the URL was not found on the server
Link: /contact/contact-us -> URL: localhost/sitename/contact/contact-us - ERROR 404, in Portuguese
Link: ../contact/contact-us -> URL: localhost/contact/contact-us - Message from Apache, informing that the URL was not found on the server
Link: en/contact/contact-us -> URL: localhost/sitename/contact/contact-us - ERROR 404, in Portuguese
Link: /en/contact/contact-us -> URL: localhost/sitename/contact/contact-us - ERROR 404, in Portuguese
Link: ../en/contact/contact-us -> URL: localhost/en/contact/contact-us - Message from Apache, stating that the URL was not found on the server
Furthermore, we can see that there are no subfolders in the construction of the URLS, as in the description of this module (e.g. this.example.domain/lives/here/en or this.example.domain/lives/here/fr), a fact that makes me wonder: Will this module be able to help fix the issue with website language detection?
In a test installation, copy of the website above, I installed the Matrix module, hoping to resolve this problem. Before installation, language detection had the URL and Selected Language options enabled. I tried other settings, but they gave me more problems instead of a solution.
On localhost, I tried to configure the module using the JSON Matrix Definition and added the following code to the JSON Language Matrix:
{"pt-br":"/sitename", "en":"/sitename"}
After that, I simply added the "en" prefix to the English path and clicked save and received the following return message:
"Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it."
I tried this configuration because the site architecture does not have folders in the path.
Based on the information above, I ask: Can this module help me to fix the issue with website language detection?? How should I configure it? Does anyone have any ideas?