If I enable Taxonomy as a translated entity the Taxonomy Term Reference fields on node edits do not show the translated terms when adding a translation of the node. The Taxonomy Terms show in the default language on the node edit page but not in any of the translated languages.
Taxonomy Vocabulary translation:
I have configured the Taxonomy Vocabulary two different ways with no effect:
- Localize. Terms are common for all languages, but their name and description may be localized.
- No multilingual options for terms. Only the vocabulary will be translatable.
Taxonomy term translation:
I configured the taxonomy terms translation under Entity Translation with default language = default language.
I configured the Taxonomy Term Reference field translation as: Field translation Users may translate all occurrences of this field: Blog Categories in Blog entry.
Using i18n instead of Entity translation taxonomy terms translations show in node edits:
When I un-ticked the select box Taxonomy term as a Translatable Entity Type under admin/config/regional/entity_translation Translatable Entity Types the translated taxonomy terms became available for selection on the translated node edit form which I believe is related to the localize translation of the taxonomy terms provided by the i18n module.
Entity Reference field has same problem:
Also I have added an Entity Reference Field for the Taxonomy which has the same issue which again suggests that Entity Translation is not providing the translated taxonomy term to the Entity Reference field on node edits.
Displaying translated Taxonomy terms works:
Displaying the translated Taxonomy terms on node views is OK presumably because the TID is used to pickup the translated taxonomy term.
Same behaviour on test site with minimal enabled modules
I also tested this on a testbed site and had the same problem.
The issue:
I think that the Entity Translation module is not properly configured to pick up the translated terms for the Term Reference field or Entity Reference field when adding translations on the node edit form?
Comments
Comment #0.0
inventlogic commentedadded additional details of configurations that were tried.
Comment #0.1
inventlogic commentededited the question on the Entity Translation not providing translated terms to the Term reference field
Comment #0.2
inventlogic commentedadded additional information regarding node displays
Comment #1
plachI think this is a duplicate of #1506054: Taxonomy term reference: language-aware widget and autocomplete.
Comment #1.0
plachreevaluated the issue as a problem with Entity Translation
Comment #2
ippy commentedI had same problem and struggled with it for a while until I came across this post: http://drupal.stackexchange.com/questions/29673/limit-taxonomy-display-i... which suggests some possible workarounds.
First, here's the scenario in which my problem occurs:
- vocab with term title replaced as an entity;
- ability to add terms in specific language;
- ability to translate those terms into a different language;
- term reference field added to content type;
- field set to be translatable;
- but all terms, irrespective of current language, displayed on /node/add forms;
In the end I used https://drupal.org/project/term_reference_tree and did as follows:
- created a "translated entity aware" view (add relationship "(node) Content: Entity translation: translations" and filter to "(Translations) Entity translation: Language (= Current user's language)");
- set my term reference field to use term_reference_tree widget;
- set some (newly available from the widget) options, such as which view to use, by editing the field;
Now when I go to /node/add the language I am in is considered the language to offer terms in (where they exist). This does have some limitations, but for my purposes its good enough :)
Comment #3
giorgosk@ippy
I tried all other scenarios and seems yours is the best solution at this moment
however
I am getting to a point were I have the view display correctly translated terms for each language
but when the widget presents it in the node/edit the translations they are not displayed at all
only the original terms when viewing the souce language are displayed
if it makes any difference the LABEL of the vocabulary is untranslated even though I have it translated
a little more light on how you created the view might help
I crated a term reference view with relationship: Taxonomy term: Entity translation: translations
with term id include as term reference tree widget wants and at the level of the view seems to work...
Comment #4
giorgosk@ippy @everyone
anyone still looking for a solution
http://drupal.org/project/entityreference
lets you choose term references and it allows you to do so with the use of a view
worked great
Comment #5
lmeurs commentedI ran into the same problem, think it is caused by the Multilingual select (i18n_select) module and might have a solution. This is our situation:
taxonomy_vocabularydb table tells us the vocabulary's language is UND andi18n_modeis 1.taxonomy_term_datadb table tells us the terms' languages are Dutch.When we create / edit a node in the term's language (NL), all terms show up in the term reference field, but when creating / editing a node in a different language (EN), the field shows an empty list though the terms are translated.
After some digging around I found out this was caused by a condition in the db query that retrieves the taxonomy tree. This condition checks whether the term's language is the current language or UND. Since we use localized terms for this vocabulary, we do not want this restriction.
I think the problem lies within
Multilingual select'sEntity translation getting along with Multilingual select:i18n_select_check_query()i18n_taxonomy_allowed_values()which callstaxonomy_get_tree().taxonomy_get_tree()adds theterm_accesstag to the db query when generating the taxonomy tree that it returns.i18n_select_query_term_access_alter()uses this tag to add the language condition to the query, but asksi18n_select_check_query()for permission.i18n_select_check_query()does not check the vocabulary'si18n_mode.It wouldn't be that hard to write a patch to fix this, but since I am not sure whether I am on the right track or not,I wrote a workaround that removes the condition from the query if necessary. This workaround works great for us so farand could possibly be used as a base for a patch.If you guys can confirm whether this seems to be the problem, we should create an issue for the Multilingual select module and close this issue.Comment #6
lmeurs commentedIn the issue queue for i18n I found #1868418: Taxonomy terms dont work as expected in multilingual environment which refers to i18n's Compatibility with contributed modules which states:
Though I could not find any elaboration on this, I think our problem is not Entity Translation related per se.Another similar (unsolved) issue is #946100: "Localize terms" vocabulary selectable only for nodes in default or original language for D6 from 2010.Comment #7
lmeurs commentedI just tried a clean install with the Taxonomy translation module instead of Entity translation to find the differences in db storage. Independently of the site's default language and i18n's string source language at
admin/config/regional/i18n/strings, terms always seem to be stored in the db with an "und" value for thelanguagefield where the Entity translation module stores langcodes. So I think it is up to Entity translation to play nice with Multilingual select (i18n_select).Two solutions:
admin/config/regional/i18n/select. I have not tried this thoroughly yet, but it seems a great quick fix when not using Entity translation on one vocabulary and Content translation (i18n) on another.Comment #8
odegard commentedRunning into the same problem. Found this: http://drupal.stackexchange.com/a/64666
It may be that this solution is too heavy since it involves loading each term to find the translation, or perhaps that is offset by caching somewhere.
Comment #9
tanmoy1981 commentedWe also faced the same issue and came up with a working solution.
Inside our custom module , we implemented hook_form_alter and re-created the taxonomy input fields once again.
Here my modules's name is "mymodule", the content type having taxonomy term reference fields (field_myfield1', 'field_myfield2', 'field_myfield3' and so on) is "my_content_type".
Here follows the working example.
Comment #10
giorgosk#7 2. is an incomplete solution since the list always comes up in SOURCE language regardless of the interface language even though admin/config/regional/entity_translation "default language" is set to "current language" (but this might be an irrelevant setting)
Comment #11
giorgoskmodified #9 to accommodate for hierarchy within the vocabulary
this is just a workaround until entity_translation properly supports taxonomy terms select
Comment #12
giorgosksolution above does not seem to work
This module helps resolve this problem
https://www.drupal.org/project/translated_entityreference
but not with select list (only autocomplete widget)
EDIT:
to use above mentioned module properly
I think you need to disable
"Select taxonomy terms by language"
in admin/config/regional/i18n/select
Comment #13
zekvyrin commentedI don't know about other translation methods, but using title's dev version which includes fixes #1920096: Title incompatibility with the entity reference widget, term names are properly translated (using entity translation, I haven't tested for 18n)
Comment #14
giorgoskso this is possibly a related issue
Comment #15
kopeboyI am able to pay some hundred Euros to someone able to fix this.
This is at least major since entity translation is literally ruining my sites.
Hundreds of doc pages and issues saying different things, dev versions trying to work together, trials & errors on the site that are never easy and will cause the need to recreate all references or translations when changing a module or configuration between i18n and ET.. this is a nightmare.
I can't stand it anymore, please fix this.
Comment #16
gonssalWell, I also had this issue and I tackled it down as well as I could, which let me to post this:
#2418629: Make taxonomy_get_tree load entities by default
If you don't want to read it all, skip to the last 3 paragraphs, where the 'fix' is proposed. It's basically a matter of changing a default parameter to TRUE in the taxonomy_get_tree() module in core's taxonomy module. Sadly, this being a v7 core issue related to internationalization and adding a bit of overhead, I don't expect it to be implemented.
Comment #17
f0ns commentedI also had this issue, I resolved it by updating the contrib title module to the 7.x-1.x-dev version instead of using 7.x-1.0-alpha7.
Hope this helps!
Comment #18
slowflyer commented@Fons Vandamme: really, only updating title module safed the issue with terms showing in original language on the node/add node/edit forms? Nothing else?
thanks,
slowflyer
Comment #19
jas1988 commented@Fons Vandamme and @slowflyer no its not working only by updating module. While using latest version of module it still shows original values of terms in node/add or node.edit forms. Any solution you guys found ?
Thanks!
Comment #20
suldan commentedYep! Use Entity Reference Field
Comment #21
rcodinaSorry, the comment I wrote wasn't meant to be posted on this issue.
Comment #22
Aldus commentedI can confirm having the same problem.
One solution is to disable $query->addTag('term_access'); in function _term_reference_tree_get_children, that will not run i18n's language control.
But won't run any other term access hooks as well. Warned.
Comment #23
Aldus commentedMy temporary workaround:
This will remove the i18n language check from term_access tag.
I would suggest that the module also add some specific tag to the query, so at least we could add that to the conditions as well.
Comment #24
juankvillegas commented#7 solution 2 is now letting me sleep well in the nights. Thank you @lmeurs.
It is not the perfect solution, but at least I can save the translated content without lose the original values for non-translatable fields.
Comment #25
lamp5It is solution:
https://www.drupal.org/project/term_reference_tree
Comment #26
nachenko commentedAltering a form and fixing filed by field is not scalable. A better way is to fix the widget everywhere is used. Let me show you an example on how to overcome this problem on a Entity reference field targeting Taxonomy terms and using a BUTTONS SELECT widget. This solution requires i18n module:
More info on this hook:
https://api.drupal.org/api/drupal/modules%21field%21field.api.php/functi...