We are using (and enhancing) a bilingual (multilingual) distro of Drupal mainly used Canadian federal, provincial and municipal governments that takes great care and attention to internationalization capabilities and came accross this module.

Discovered this on 7.x and noticed it's the same problem in 8.x
When entity translation is enabled (each node/entity can have one to many field translations for 1 to many languages) Tagclouds displays terms of other languages in block even if separation by language is selected

Patch to follow for both 8.x dev and 7.x dev

Comments

joseph.olstad’s picture

Title: Tagclouds displays terms of other languages in block even if tagclouds_language_separation is enabled » Tagclouds displays terms of other languages in block even if tagclouds_language_separation is enabled and entity_translation is enabled
Issue summary: View changes

Need to check in code if using entity_translation (not node translation) add appropriate condition. Otherwise it won't work in entity_translation mode

joseph.olstad’s picture

Title: Tagclouds displays terms of other languages in block even if tagclouds_language_separation is enabled and entity_translation is enabled » When entity_translation is enabled tagclouds displays terms of other languages in block even if tagclouds_language_separation is enabled
joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

See attached patch (has not yet been tested but should work)

joseph.olstad’s picture

To test this patch:

  1. enable entity translation if it isn't already
  2. create taxonomy vocabulary with translation mode "Translate." enabled (Different terms will be allowed for each language and they can be translated.)
  3. add taxonomy term reference field to basic page content type
    (options: use autocomplete widget)
    (more options: enable translation on taxonomy term reference field)
  4. install and enable tagclouds
  5. enable "Separation of Tags per language" in eng/admin/config/content/tagclouds
  6. add tagclouds block to a panel or page
  7. add new basic page , add two taxonomy terms to your autocomplete taxonomy term reference field "taxonomy1-eng, taxonomy2-eng"
  8. translate the same basic page (entity translation so the same "entity id /node id") , add terms "taxonomy1-lang2, taxonomy2-lang2"
  9. add a second basic page, and translate it as done in step 7 and step 8, (use same taxonomy (tag) names "taxonomy1-eng, taxonomy2-eng" for english and "taxonomy1-lang2, taxonomy2-lang2" for the "other " language
  10. compare results, you should see tag clouds for both english and lang2

Now, this patch works great most of the time. There are some edge cases though. It just so happens that some words are the same accross different languages. For instance the word "corruption" is the same in English as it is in French, for these cases the condition in the query should not be using taxonomy_index table it should be using the field_data_field_xyz field_xyz_tid.language instead of td.language in the join. However this will require some UI work and some more stuff on the other end. The attached patch is far better than what the current implementation is (for entity_translation) but a more graceful solution should be attempted in a new issue, I'll create a new issue for that and reference this one.

joseph.olstad’s picture

Enhancement for the above patch: a radios button for language separation settings was added to the 7.x parent issue (see D7 commits for how it was done). Look into something like this for D8 branch. Note that entity_translation is now part of D8 core.

joseph.olstad’s picture

Status: Patch (to be ported) » Closed (duplicate)
Related issues: +#2434367: improve i18n support, port the improvements from 7.x-1.10