When entity_translation is enabled tagclouds displays terms of other languages in block even if tagclouds_language_separation is enabled

Comments

joseph.olstad’s picture

To test this patch:

  1. enable entity translation if it isn't already (or use a distro like this)
  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 patch: the content type in question should be checked for the translation type rather than a simplistic check exists on entity_translation . This will be more accurate especially for D8 as entity_translation is part of core in D8 but also work better for D7 as well.

  • joseph.olstad committed 3e37882 on 7.x-1.x
    Issue #2286023, feature enhancements - improved language separation...
joseph.olstad’s picture

Version: 7.x-1.x-dev » 7.x-1.10
Issue summary: View changes
Status: Patch (to be ported) » Fixed

The patch was modified to add a radios button and committed directly into dev and into 7.x-1.10

See release notes for 7.x-1.10 and also see readme.txt for how to use and also see source code if you really want to know more.

joseph.olstad’s picture

Status: Fixed » Closed (fixed)
PascalAnimateur’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new11.95 KB

I ran into errors when using the entity_translation + title modules to translate my vocabularies and terms, even when selecting 'entity' as the translation method.

Upon closer inspection of the code, I noticed it could be simplified a lot by using EntityFieldQuery instead of db_select, as this would get the translated name no matter what is used (i18n_taxonomy or entity_translation).

So I refactored the tagclouds_get_tags function to use that and it works great. I could even eliminate the tagclouds_language_separation variable which is not needed anymore.

Here's a patch!

joseph.olstad’s picture

Hi PascalAnimateur, your work looks great at first glance and it sounds reasonable. I'm going to take a passive stance on this and hope that someone from the community can provide some evaluation(s).

joseph.olstad’s picture

Assigned: joseph.olstad » Unassigned

Looking for some community evaluations.

joseph.olstad’s picture

Version: 7.x-1.10 » 8.x-1.x-dev
Assigned: Unassigned » martin107
Status: Needs review » Patch (to be ported)

Hi Martin, we should probably get this into 8.x before committing it to 7.x

since you're working on 8.x, I'm assigning this to you.

joseph.olstad’s picture

PascalAnimateur’s picture

IMHO the only thing missing for a 7.x commit would be an update hook to delete the 2 language separation variables (there's a second one with _radios suffix).

martin107’s picture

Assigned: martin107 » Unassigned

@PascalAnimateur

The refactoring of refactored the tagclouds_get_tags() provides a solution that I was looking for ... so I think that is going to be rolled into an upcoming issue. ( I will give you credit - on that issue. )

My current focus is working out the kinks in d8 branch, I am unassigning as this issue is not my immediate focus and I want to signal others are free to work on this.

joseph.olstad’s picture

I haven't had time to test this patch, but if one other person reviews it and tests it and marks this RTBC then I'll commit it.

Thanks,

joseph.olstad’s picture

Version: 8.x-1.x-dev » 7.x-1.x-dev
Status: Patch (to be ported) » Needs review
jantoine’s picture

StatusFileSize
new11.39 KB

The attached patch:

  • Implements hook_update_N() to delete the obsolete language separation variables per #11
  • Fixes a bug where the cache could be duplicated for the default display "style" using both "style" and NULL in the cache name
  • Restores a range on the query that was removed
  • Restores a filter on the query of count > 0 that was removed
  • Greatly cleans up the theme_tagclouds_weighted() function and helper functions.

Status: Needs review » Needs work

The last submitted patch, 15: tagclouds-language-negotiation-2286023-15.patch, failed testing.

joseph.olstad’s picture

The CI error will be fixed once we add a simpletest for tagclouds .. Start with a very basic one that just checks that the module installs correctly.

joseph.olstad’s picture

joseph.olstad’s picture

Sorry I haven't had much time for tagclouds lately

If someone can please create a very basic simpletest that just checks that the module installs correctly then I'll commit this as it looks good.

we may also have to update the readme.

chris matthews’s picture

Status: Needs work » Needs review

The patch in #15 is 2 years old, but still applied cleanly to 7.x-1.x and after testing/reviewing seems ready for RTBC, but it would be good if one other person could review/test as well.

joseph.olstad’s picture

Status: Needs review » Reviewed & tested by the community
andrey.troeglazov’s picture

Issue tags: +TagCloud Release 7.x-1.12
andrey.troeglazov’s picture

Issue tags: -TagCloud Release 7.x-1.12 +TagCloud Release 7.x-1.13

Patch no longer applies, it needs more closer look, I moved it to next release.

andrey.troeglazov’s picture

Status: Reviewed & tested by the community » Needs work
grask0’s picture

Status: Needs work » Closed (outdated)
Issue tags: -

D7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.

If the issue remains relevant for D10+ versions, merge requests with proposed solutions for a new module version (D10+) are welcome in a new follow-up issue.

Thanks!

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.