With the way the [save-lineage-termpath] is generated, terms are translated. That's good.
However, for vocabularies with 'localized terms', they are translated to the interface language, not the node language. Which means english nodes can end up with non-english terms in their path, and vice versa.

This turned out to be easier to fix than I feared. I hope you can review the code with me...

'Call tree' from hook_token_values to where the translation happens:

6. hs_taxonomy.module._hs_taxonomy_hierarchical_select_terms_to_options:888	

5. (module_invoke) hs_taxonomy.module.hs_taxonomy_hierarchical_select_root_level:411
 & hs_taxonomy.module.hs_taxonomy_hierarchical_select_children:437 <- $params is passed up to here

4. hierarchical_select.module._hierarchical_select_dropbox_reconstruct_lineages_save_lineage_enabled:2185 / 2204	

3. hierarchical_select.module._hierarchical_select_dropbox_generate:2122	

2. hs_taxonomy.module._hs_taxonomy_token_termpath_for_vid:748  <- creates $params array

1. hs_taxonomy.module.hs_taxonomy_token_values:678

Functions 2 and 6 are purely internal helper functions. So if we can give those a '$langcode' function argument, and then stick the language code into your omnipresent $parameters array... we can push the node's language up to function 6, where it can be used.

Is it allowed to just add an entry 'langcode' to your $parameters array? I haven't checked for possible implications...

Note: Hunk 3 of the attach patch will only apply correctly after you apply the patch from #1073858: [save-lineage-termpath] token generation revisited. I hope that's OK; it's hard to reliably generate aliases for testing, anyway...

CommentFileSizeAuthor
#4 1073974-4.patch2.53 KBroderik
hs_token_translation.patch2.53 KBroderik

Comments

wim leers’s picture

This first needs some positive reviews before it can go in :)

roderik’s picture

That's fine - with this particular issue.

But could you please answer the following question? I don't think there's a lot of other people who will.

Is it allowed to just add an entry 'langcode' to your $parameters array? I haven't checked for possible implications...

wim leers’s picture

Oh, sorry!

It's not explicitly allowed, but it won't break anything. If this is what it takes to make it work, that's fine.

roderik’s picture

StatusFileSize
new2.53 KB

Meh- _hs_taxonomy_hierarchical_select_terms_to_options() is called from hs_content_taxonomy.module too.

Made the added function argument optional. No functional change.

stefan.r’s picture

Status: Needs review » Closed (won't fix)

6.x issue without activity for over 3 years, closing.

Please reopen if this is still an issue in 7.x.