Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
getReferencableEntities() uses taxonomy_get_tree() to load taxonomy terms for the options lists (select widget) and the autocomplete widget.
taxonomy_get_tree() by default doesn't do an entity_load(), which means that the Title module can't do its magic, so the term name stays untranslated.
A simple one line patch fixes this issue, and allows terms to be returned in the correct language (on node add / edit forms, commerce add to cart form, etc).
Comment | File | Size | Author |
---|---|---|---|
#4 | entityreference-translate_terms-2013849-4.patch | 924 bytes | plach |
Comments
Comment #1
bojanz CreditAttribution: bojanz commentedComment #2
amitaibuCommitted, thanks.
Comment #4
plachSame problem when using
i18n_taxonomy
to translate terms. We are missing anentity_label()
call.Comment #5
letrotteur CreditAttribution: letrotteur commentedWorks like a charm for me. Thanks
Comment #6
plachComment #7
GiorgosKtaxonomy with Localize or translate setting
added a few terms and translated them
entityreference on basic page
created a basic page
on English edit form terms appear
on Greek language edit from NO terms appear
but apparently on the view the terms are display correctly (translated)
have a look at a related issue #2028225: Term reference field on node edit fails to show translated taxonomy terms when Taxonomy term selected as a Translatable Entity
Comment #8
GiorgosKThis 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 #9
Stevel CreditAttribution: Stevel commentedSetting this back to RTBC
Comment #10
geek-merlin#8:
> This module helps resolve this problem
> https://www.drupal.org/project/translated_entityreference
I don't think so.
That module is about entity translation.
This patch about string translation.
Comment #11
geek-merlinYES i can confirm #4 patch fixes this issue for me. :-)
Comment #12
amitaibuMerged, thanks.
Comment #17
Stevel CreditAttribution: Stevel commentedBack to Closed (fixed)