How to keep the Language Choice

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
ARTIMEDIA's picture

Hi, I have a problem: I have been working on a multilingual site: http://rangeco.pt/

I have the following modules installed for the Purpose:

  • Locale
  • i18N
  • Content Translation
  • Entity Translation
  • Language Dropdown
  • Language Icons
  • Entity
  • Title
  • Variable

I have translated both the Interface (Menus, Menu Items, Blocks) and Content (Basic Page, Articles, Fields: Body, Title, etc...) in Portuguese (default), English, Spanish, and German. My idea is to have a website that when a user chooses a language, the whole website is translated in that Language and remains so. But what I get is a momentary translation of the page the user is at... And when the user clicks on a menu to another page, the website goes to the default language again. The only page where that doesn't happen, is the Home page: If a user is at the "Who We Are" page for instance, and clicks on the "Home" button, it takes him to the Home page and remains in the language he was at. But with all other pages, it falls back to Portuguese (default). This is NOT what I want.

Using Entity translation, I translated every Body content of every basic page, into the four languages. Then I also translated every Menu Item into the four languages. However, all translations of a given Menu Item link to the same URL (there is not a different link URL for each translation of the Menu Item). So when a user clicks on a menu item, it takes him to the default language (www.mysite.com/node) instead of the translated version of the page (www.mysite.com/en/node).

I want Drupal to know that I want the language version of the page that matches the language version of the previous page the user was at. For instance, if the user was at www.mysite.com/en/contacts and wants to go to the "Products" page, I want him to click at the menu item "Products" and be taken to www.mysite.com/en/products... And NOT www.mysite.com/products. But the website takes him to the default language version of the page because that's where the menu item links.

How can I overcome this? Do I need to disable language fall back? Do I need to create different menu items in different languages and with different links , that only display in the said language, instead of translating THE menu items themselves?

Note: I have both Content Translation and Entity Translation installed, because I started thinking I was going to use CT and then decided it was better to use ET. So I never used CT but let it remain enabled, since I read there are currently no compatibility issues. I also read that past compatibility issues between ET and i18N were overcome and that in fact they complement each other.

Comments

Separate interface and content language switching

joseph.olstad's picture

see this issue: Separate interface and content language switching

https://www.drupal.org/node/2353119

It can be done , and I've given you a head start on it. We didn't complete this functionality, but we did some prototype work as a proof of concept and it was functional enough to see that it could be quite helpful for multilingual setups.

Have a really good read through this issue and you'll see where it was going and what your options are.

If I understand well, this is

ARTIMEDIA's picture

If I understand well, your suggestion is a patch that allows the back end user/developer interface (ie, configuration, modules, structure, etc... menus) to have translation switching independent from the translation switching of the end user interface and contents (ie, articles and posts text, basic page body text, website navigation menus, etc...).

However this is not my issue. I am the only developer working in my website and I speak many languages. ;). So I don't mind if back end interface, front end interface and content are in the same language.

My problem is that a end user switches language and as soon as he change page the site falls back again to the default language. This shouldn't happen... If user chooses to have the site in French, the site shouldn't fall back to the default language unless the user decides to change it back, using the language switcher.

I think the problem is with the (end user) Menu item links, which despite the fact that I have translated them, all those translations still share the same link URL.

A practical example:

  1. A user arrives at the home page: http://rangeco.pt/ (default language - portuguese)
  2. The user switches language to French so the URL becomes http://rangeco.pt/fr
  3. The user clicks on "Contacts" main menu button. This takes him to http://rangeco.pt/contacts instead of http://rangeco.pt/fr/contacts so... He has just been redirected to the "fall back" portuguese version of the website.

This is not how it is supposed to work.

configuration issue

joseph.olstad's picture

Hi Artimedia, I read your comment, and it seems that the issue is configuration. Are you using domain url for language detection? or are you using a language code for language detection?

There is likely some confusion between your base_url and your domain language detection, if you change this to either cookie detection or imho the best solution is the language code /en /es /de /fr /it for language detection

sounds like a configuration issue on your site.

Translations

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: