Taxonomy Term that were created through Taxonomy_Manager/voc/XYZ can't be translated even when Taxonomy Term XYZ has "Enabled translation"

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Rar9 created an issue. See original summary.

tklepsch’s picture

I had a similar issue and was able to fix the bug by removing the langcode as a value when the term is created. I have attached a patch with the fix.

JacobSanford’s picture

I'm not entirely convinced removing this is the correct solution. From the language() getter method on Entities, LanguageInterface::LANGCODE_NOT_SPECIFIED is what gets returned if no language was stored with the entity on creation. IMHO, this is correct unless we make assumptions that the 'default' language is the one we should associate with new items. And I'd need a lot of convincing there.

As this issue is quite old, I'm going to test if this issue still applies. Hopefully it doesn't and we can close!

JacobSanford’s picture

Status: Active » Closed (cannot reproduce)

It looks like translations are working as expected. I'm going to close this and consider it as a legacy issue related to a changing codebase.

Please do open again if you can reproduce!

joel_osc’s picture

Status: Closed (cannot reproduce) » Needs review
FileSize
1.74 KB

I am still seeing this issue... here is a first attempt at a patch that uses the language configuration for the vocabulary to determine the default term language. There is likely method that exists that handles the code in my conditional logic but I could not seem to find it - at least this patch will help people for now. Thanks for your great work maintaining this module!

sashken2’s picture

Patch #5 works for me, but I change this line in patch:
'langcode' => $lang_code,
to:
'langcode' => $langcode,

joel_osc’s picture

Ooops, will need to re-roll thx.

joel_osc’s picture

FileSize
1.74 KB

Re-roll with fix from @sashken2!

devad’s picture

Status: Needs review » Reviewed & tested by the community

Thank you!

Patch "8 applies cleanly to alpha2 and in my case fixed issue as expected.

I didn't test it in details, but new bulk-added terms have properly assigned language now.
Before patching new added terms all had language "Not specified" value regardless of Vocabulary translation settings.

New version release would be great after this patch is hopefully committed soon. Translation support is such an essential feature.

RTBC

devad’s picture

Title: Created Terms can't be Translated » Created terms' language doesn't respect Vocabulary translation settings
joel_osc’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.73 KB

Fixing a line of code from debugging that snuck through.

cosolom’s picture

Version: 8.x-1.x-dev » 2.0.0-alpha2
FileSize
1.92 KB

Rerolled for 2.0

VladimirAus’s picture

Status: Needs review » Reviewed & tested by the community
VladimirAus’s picture

  • VladimirAus committed 9f6b831 on 2.0.x authored by cosolom
    Issue #2662060 by joel_osc, tklepsch, cosolom, JacobSanford, sashken2,...
VladimirAus’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone for contributing, testing and reviewing!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.