0

We have a situation where we want to have Content Translation enabled. It is our understanding that this is using Entity Translation(from D7) that is now in D8 core. This also means that there will be one Node (ID), but there will be a table to hold translations for the fields.

Goal:

  1. Enable Content Translation for Article content type and make all fields translatable
  2. Create an English page call Test-Page
  3. Click Translate and add translation to Spanish
  4. Enter in the Spanish content for the body and title field

Expectation:

  1. As a site visitor, When i clicked on the Language Switcher and select Spanish, I should see Spanish content
  2. As a logged in user (admin or content editor) when i view the English version I should see English content on the edit screen for body and title
  3. As a logged in user when editing the Spanish translation I should see the Spanish translations for body and title.

Issue:

  1. Whenever we click on the Spanish translation we are always served up the English content
  2. When i change the language using the Language Switcher to Spanish, we are still served up the English content

How can we setup the translations so that the issues above do not occur?

4
  • So you've disabled language detection by URL? Then you need another method, for example by Session. Otherwise Selected language, which obviously is English, will always be detected.
    – 4uk4
    Dec 18, 2017 at 21:54
  • @4k4 Yes we have disabled by URL. We found that using Session did not work properly either. We were thinking of going with some hook alter that we can apply custom logic so that our two issues are resolved, but wasn't sure if that was best practice or the right approach Dec 19, 2017 at 16:37
  • Don't think you can do this in some hook. The right approach would be a custom LanguageNegotiation plugin like one of the core plugins, see for example LanguageNegotiationSession.
    – 4uk4
    Dec 19, 2017 at 17:19
  • @4k4 looks like we were able to resolve it using the settings in my response. Dec 20, 2017 at 23:41

1 Answer 1

0

I am adding an answer so others can see what i had to do.

To resolve this we did the following:

  1. Enabled the custom settings for language detection
  2. Enabled "Selected Language"
  3. Set "Selected Langauge" with the highest row weight so it is done first
  4. Enabled "URL" with the second highest row weight
  5. Modified Admin Content (/admin/content) view to output a customized URL that has "?language_content_entity="
  6. Now on click of edit or translate of the that page, it will redirect to the correct language and all my issues are resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.